Enable DHCP Server on MacOS X Mountain Lion

MacOS X comes with DHCP server out of the box, but it is not enabled by default. The server, which is called bootpd in MacOS X, serves as DHCP server and BOOTP server. However, if you just need to enable DHCP server on your MacOS X, it is very easy.

  1. You need to create bootpd configuration file which is contains DHCP server configuration. The bootpd configurations are stored in /etc/bootpd.plist file and this file is nothing by default. More information about how to write DHCP server configuration on this file, you may see bootpd man page.
    Jacques Fortier has made one bootpd.plist for DHCP server configuration file ready to use on his blog. Use his file, edit to suit your requirements, and save it to /etc folder.
  2. Start the server using the following command:
    sudo /bin/launchctl load -w /System/Library/LaunchDaemons/bootps.plist
  3. Stopping the server is also very similar, just change load with unload like the following command:
    sudo /bin/launchctl unload -w /System/Library/LaunchDaemons/bootps.plist

If you are an expert in shell script, you may put both command in a single executable shell script using some arguments. You do not need to download DHCP server in order to make a DHCP server on MacOS X. It is ready out-of-the-box unloaded, waiting for you to load it.