DHCP, DHCP, Wherefore Art Thou DHCP?

By Richard Mallion

So, Mountain Lion client and server have been out for approx a week.

One of the controversies of the server product is the apparent removal of the DHCP service. It is true that Apple for some reason has decided to remove all traces of the DHCP service from the UI. The revamped Server.app does not list it as a service to manager, the old server admin application is deprecated and it’s also missing from the command line tool ‘serveradmin’ .

However it’s not all bad news, the DHCP service is in fact still there, but it now has to be managed manually from the command line.

So, here are a few things to know.

Upgrades form Lion server will preserve any settings you had for the DHCP service.

Secondly if you enable Internet Sharing on the server this will also enable the DHCP service.

However most people will probably not want to install Lion first to carry some dhcp settings to Mountain Lion so here is an overview  on how to configure the dhcp server by hand.

bootpd

is the actual dhcp server process.

From the command line is you issue the command

man bootpd

you can review the manual for this service.

You can start the DHCP service by using launchd:

sudo /bin/launchctl load -w /System/Library/LaunchDaemons/bootps.plist

You can stop the DHCP service by using launchd:

sudo /bin/launchctl unload -w /System/Library/LaunchDaemons/bootps.plist

To create the dhcp scopes required you can edit the following text file:

/etc/bootpd.plist

This file is a typical Apple preference (.plist) file that holds all the settings for the dhcp server such as ip range, subnet mask, which interfaces to serve the scopes over. The man page has some details on what you need to edit here but here is a summary of some of its key components.

  • dhcp_enabled – Used to enable dhcp for each network interface.
  • bootp_enabled – Enables BOOTP on the specified list of interfaces
  • allocate – Indicates whether the DHCP service should allocate IP addresses from the range specified by net_range.
  • Subnets – Use this array to create additional scopes or subnets that you will be serving up DHCP for. To do so, copy the entry in the array and paste it immediately below the existing entry. The entry is a dictionary so copy all of the data between and including the <dict> and </dict> immediately after the <array> entry for the subnet itself.
  • lease_max and lease_min – Set these integers to the time for a client to retain its dhcp lease
  • name – A descriptive name for the subnet
  • net_address – The network address, e.g. “17.202.40.0″.
  • net_mask – The subnet mask clients should have, e.g. “255.255.252.0″.
  • net_range – The network address range stored as two values: the first IP address and the last IP address.
  • dhcp_domain_name_server – The IP address(es) of the DNS server(s)
  • The domain search list
  • dhcp_router – This entry should contain the router or default gateway used for clients on the subnet, if there is one. If not, you can delete the key and following string entries.

To configure reservations, there is another text file you can edit , which is  /etc/bootptab file. This file should be formatted with a column for the name of a computer, the hardware type (1), the hwaddr (the MAC address) and ipaddr for the desired IP address of each entry:

# hostname hwtype hwaddr ipaddr bootfile
mac1.amsys.com 1 00:00:00:aa:bb:cc 192.168.16.1
mac2.amsys.com 1 00:00:00:aa:bb:cc 192.168.16.2

Once you have setup the dhcp service as you want, you can configure the service to start automatically. To do so, open

/System/Library/LaunchDaemons/bootps.plist

In this file, just change the Disabled key to False, by changing the word True toFalse.

 

 

Share this post online:

3 Responses to “DHCP, DHCP, Wherefore Art Thou DHCP?”

  1. Drewtlo says:

    Excellent article. Any idea where my reservations might be if I have no bootptab file? They’re still functional and I can see them in the Directory utility. I just am not comfortable editing them here. Thank you!

  2. thanks a lot for sharing this.

  3. Ken Stailey says:

    I have connection sharing running. When I go to stop bootpd I get:

    $sudo /bin/launchctl unload -w /System/Library/LaunchDaemons/bootps.plist
    launchctl: Error unloading: com.apple.bootpd

    My quick-and-dirty work around is to hit bootpd with SIGSTOP.

Leave a Reply