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.
is the actual dhcp server process.
From the command line is you issue the command
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:
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. “220.127.116.11”.
- 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
In this file, just change the Disabled key to False, by changing the word True toFalse.