To run OS X's built-in DHCP server - bootpd
1. Create and open the config file for the server.
sudo vim /etc/bootpd.plist
2. Use this base configuration.
<?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>bootp_enabled</key>
<false/>
<key>detect_other_dhcp_server</key>
<integer>1</integer>
<key>dhcp_enabled</key>
<array>
<string>en12</string>
</array>
<key>reply_threshold_seconds</key>
<integer>0</integer>
<key>Subnets</key>
<array>
<dict>
<key>allocate</key>
<true/>
<key>dhcp_router</key>
<string>172.16.15.1</string>
<key>lease_max</key>
<integer>86400</integer>
<key>lease_min</key>
<integer>86400</integer>
<key>name</key>
<string>172.16.15</string>
<key>net_address</key>
<string>172.16.15.0</string>
<key>net_mask</key>
<string>255.255.255.0</string>
<key>net_range</key>
<array>
<string>172.16.15.2</string>
<string>172.16.15.254</string>
</array>
</dict>
</array>
</dict>
</plist>
This config defines the following:
en12
- Change to the interface you are using.Check out the man page for bootpd for more info on editing this config.
3. Start/stop the server.
To start the server:
sudo /bin/launchctl load -w /System/Library/LaunchDaemons/bootps.plist
To stop the server:
sudo /bin/launchctl unload -w /System/Library/LaunchDaemons/bootps.plist
To view the DHCP leases. To remove all leases, delete the file.
less /var/db/dhcpd_leases