Tuesday, September 23, 2014

Setting up Mac OS 10.9 Mavericks as a DHCP server.

As part of our iPhone Xamarin project, we are setting up a disconnected network.  I had a linksys switch but needed to get DHCP going on our internal network.  Fortunately, this has already been done.

How to
1.)  Enable root user on Mavericks
  • Launch The System Preference Application
  • Open Users & Groups preferences, click Login Options, then click the lock icon to unlock it. If necessary, type your password, then click Unlock.
  • In the Network Account Server section, click Join or Edit.
  • Click Open Directory Utility.
  • Click the lock icon to unlock it, then enter your administrator name and password.
  • Choose Edit > Enable Root User, then enter a root user password in the Password and Verify fields.
  • Close the Directory Utility Application.
2.) Configure bootpd on Mavericks.  The post by Jacques Fortier does a great job explaining each step.
  • To start, you need to create a configuration file for the server. The file should be stored in /etc/bootpd.plist.
Sample:
<?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>en0</string>
    </array>
    <key>reply_threshold_seconds</key>
    <integer>0</integer>
    <key>Subnets</key>
    <array>
        <dict>
            <key>allocate</key>
            <true/>
            <key>lease_max</key>
            <integer>86400</integer>
            <key>lease_min</key>
            <integer>86400</integer>
            <key>name</key>
            <string>192.168.33</string>
            <key>net_address</key>
            <string>192.168.33.0</string>
            <key>net_mask</key>
            <string>255.255.255.0</string>
            <key>net_range</key>
            <array>
                <string>192.168.33.2</string>
                <string>192.168.33.254</string>
            </array>
        </dict>
    </array>
</dict>
</plist>
  • To start the server, run the following command:
    sudo /bin/launchctl load -w /System/Library/LaunchDaemons/bootps.plist
  • Stopping the server is very similar:
    sudo /bin/launchctl unload -w /System/Library/LaunchDaemons/bootps.plist


Source:

No comments:

Post a Comment