DHCP is one of the services that Apple has removed from its server product in the latest release, Mountain Lion Server. Given that the Server app and serveradmin command line tools no longer support using DHCP, it would seem on the outside that Apple no longer supports DHCP. However, when enabling Internet Sharing, the DHCP service is enabled and started. When this happens, a file called /etc/bootpd.plist is created and the LaunchDaemon located at /System/Library/LaunchDaemons/bootps.plist is configured to load and started.
When enabled using the Internet Sharing option in the Sharing System Preference pane, the DHCP pool is automatically configured to use the LAN IP scheme of the LAN adapter and NAT is enabled. DHCP can also be used for the NetInstall service, although it cannot be used at the same time that it is used for Internet Sharing, as per http://support.apple.com/kb/HT5412.
Upgrades from Lion Server will leave the DHCP configuration in place. However, most environments won’t want to install Lion and then upgrade to Mountain Lion in order to configure DHCP. Therefore, we can look at setting up DHCP manually, using a custom /etc/bootp.plist file. The way I’ve been doing this is to enable Internet Sharing and then disable it, which creates the bootpd.plist file in /etc. Once disabled again, you won’t be using the System Preference pane again to edit DHCP as doing so will destroy the custom bootpd.plist file we created.
Next, read the man page for bootpd:
man bootpd
Next, open /etc/bootpd.plist in your favorite text editor and make the following changes (if each is pertinent to you):
An example file would look like the following:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NetBoot</key>
<dict/>
<key>Subnets</key>
<array>
<dict>
<key>allocate</key>
<false/>
<key>dhcp_bootfile_name</key>
<string>pxelinux/pxelinux.0</string>
<key>dhcp_domain_name</key>
<string>no-dns-available.example.com</string>
<key>dhcp_domain_name_server</key>
<array>
<string>10.5.20.5</string>
</array>
<key>dhcp_domain_search</key>
<array>
<string>no-dns-available.example.com</string>
</array>
<key>lease_max</key>
<integer>3600</integer>
<key>name</key>
<string>172.16.25 Subnet</string>
<key>net_address</key>
<string>172.16.25.0</string>
<key>net_mask</key>
<string>255.255.255.0</string>
<key>net_range</key>
<array>
<string>172.16.25.2</string>
<string>172.16.25.253</string>
</array>
<key>selected_port_name</key>
<string>vmnet8</string>
<key>uuid</key>
<string>2DC68B2E-9B49-46DF-A929-C9DF8918C77B</string>
</dict>
</array>
<key>allow</key>
<array/>
<key>bootp_enabled</key>
<false/>
<key>deny</key>
<array/>
<key>detect_other_dhcp_server</key>
<false/>
<key>dhcp_enabled</key>
<array>
<string>en0</string>
</array>
<key>old_netboot_enabled</key>
<false/>
<key>relay_enabled</key>
<false/>
<key>relay_ip_list</key>
<array/>
<key>reply_threshold_seconds</key>
<integer>0</integer>
</dict>
</plist>
To configure reservations, use the /etc/bootptab file. This file should have 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
a.pretendco.com 1 00:00:00:aa:bb:cc 172.16.25.25
b.pretendco.com 1 00:00:00:aa:bb:cc 172.16.25.29
Once configured, fire it up using the following command:
sudo /bin/launchctl load -w /System/Library/LaunchDaemons/bootps.plist
And terminate using the following command:
sudo /bin/launchctl unload -w /System/Library/LaunchDaemons/bootps.plist
Once configured, configure the service to start automatically. To do so, open /System/Library/LaunchDaemons/bootps.plist. Here, just change the Disabled key to False, by changing the word True in line 6 to False.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Enabled</key>
<true/>
<key>Label</key>
<string>com.apple.bootpd</string>
<key>ProgramArguments</key>
<array>
<string>/usr/libexec/bootpd</string>
</array>
<key>inetdCompatibility</key>
<dict>
<key>Wait</key>
<true/>
</dict>
<key>Sockets</key>
<dict>
<key>Listeners</key>
<dict>
<key>SockServiceName</key>
<string>bootps</string>
<key>SockType</key>
<string>dgram</string>
<key>SockFamily</key>
<string>IPv4</string>
</dict>
</dict>
</dict>
</plist>
If there are any problems, add options to the booted daemon call. Here, most notably leverage the -v option to obtain more verbose entries in log files.
krypted July 27th, 2012
Posted In: Mac OS X, Mac OS X Server
Pingback: HoT NeWs » шаринг сервер()
Pingback: Stortest: OS X (Mountain Lion) Server | Macpro()
Pingback: hochwald.net - Mobile » Mountain Lion Server nach einigen Tagen()