Skip to main content
Solved

Automate Setting DHCP client ID to Hostname on Macs

  • August 15, 2018
  • 1 reply
  • 46 views

Forum|alt.badge.img+1

We have 300+ Macs in our environment and have found that they are reporting in other tools like McAfee and Ivanti that they are Windows machines because they are pulling an IP address that a Windows machine previously had. Looking through the Landesk forums, the only thing besides editing the host file I haven't tried is setting the "DHCP client ID".

If your DHCP Server supports it you can go into System Preferences -> Network -> Select your adaptor on the left -> click the Advanced button -> Set the "DHCP client ID" to your hostname.

I have verified that the Macs have the computer name set correctly by using Jamf and another script to set the computer name. I also have "Use a dynamic global hostname" unchecked in the network preferences.

Does anyone know of a way to script the DHCP client ID to the current hostname of the Mac?

Best answer by Jerneheim

Hi Kyle,

The networksetup command will do this for you.

networksetup -setdhcp Wi-Fi $(hostname -s)

Good luck.

Cheers
Patrik

View original
Did this topic help you find an answer to your question?

1 reply

Forum|alt.badge.img+13
  • Contributor
  • 18 replies
  • Answer
  • August 16, 2018

Hi Kyle,

The networksetup command will do this for you.

networksetup -setdhcp Wi-Fi $(hostname -s)

Good luck.

Cheers
Patrik


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings