OS X bootpd as dhcp server not giving out ip addresses

bootpdhcp-servermac-osxosx-snow-leopardpxe-boot

I'm experimenting with PXE lan-boot on my Mac OS 10.6;

After some prolonged trouble shooting, I've gotten to the point where LaunchD is nicely running bootpd with the following options:

<?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>detect_other_dhcp_server</key>
    <false/>
    <key>bootp_enabled</key>
    <false/>
    <key>dhcp_enabled</key>
    <true/>
    <key>old_netboot_enabled</key>
    <false/>
    <key>netboot_enabled</key>
    <false/>
    <!--
    <key>relay_enabled</key>
    <false/>
    <key>allow</key>
    <array/>
    <key>deny</key>
    <array/>
    <key>relay_ip_list</key>
    <array/>
    -->
    <key>reply_threshold_seconds</key>
    <integer>0</integer>
    <!--
    <key>use_open_directory</key>
    <false/>
    -->
    <!--
    <key>NetBoot</key>
    <dict>
        <key>shadow_size_meg</key>
        <integer>0</integer>
        <key>afp_users_max</key>
        <integer>0</integer>
        <key>age_time_seconds</key>
        <integer>0</integer>
        <key>afp_uid_start</key>
        <integer>0</integer>
    </dict>
    -->
    <key>Subnets</key>
    <array>
        <dict>
            <key>name</key>
            <string>192.168.1</string>
            <key>net_address</key>
            <string>192.168.1.1</string>
            <key>net_mask</key>
            <string>255.255.255.0</string>
            <key>net_range</key>
            <array>
                <string>192.168.1.2</string>
                <string>192.168.1.254</string>
            </array>
            <!--
            <key>supernet</key>
            <string></string>
            -->
            <key>allocate</key>
            <true/>
            <key>lease_max</key>
            <integer>86400</integer>
            <key>lease_min</key>
            <integer>86400</integer>
            <!--
                OTHER OPTIONS FORMAT:
            <key>dhcp_*</key>
            <string></string>
            -->

            <!-- DHCP PXE BINDINGS -->
            <key>dhcp_option_150</key>
            <string>pxe server</string>
            <key>dhcp_option_67</key>
            <string>boot folder</string>
        </dict>
    </array>
</dict>
</plist>

The physical setup is:

     Router (DHCP off)
        |
        |------- Mac (DHCP Server)
        |
        |------- Thin Client
        |
        |------- mobile device

When testing with a mobile device over the router's wifi I get:

bootpd[1244]: DHCP DISCOVER [en0]: <MAC ADDRESS>
bootpd[1244]: service time 0.000725 seconds

but the device never receives an IP address.

Is there an option I'm missing that it needs to give out addresses?

Best Answer

Well after quite I few changes I have it working, I'll try to remember what I did to correct it:

Firstly I did not notice the other error that was appearing in the startup output:

subnets: create failed, 'net_range' start not within subnet

The problem here is that with a mask of 255.255.255.0, the net_address should end in .0:

<key>name</key>
<string>192.168.1</string>
<key>net_address</key>
<string>192.168.1.0</string>
<key>net_mask</key>
<string>255.255.255.0</string>
<key>net_range</key>
<array>
    <string>192.168.1.2</string>
    <string>192.168.1.254</string>
</array>

With your server address still 192.168.1.1 <-- you may need to set this manually

Secondly, dhcp_option_150 is not understood by bootpd use dhcp_option_66 (66 not 150 precedes 67, who would have thought.

The final flaw I can find at this point is that:

<key>dhcp_enabled</key>
<true/>

should be:

<key>dhcp_enabled</key>
<array>
    <string>en0</string>
</array>

with the interface to use as a string of an array; although in practice it seems that specifying -i en0 is also required in the launch arguments. This is in bootps.plist at /System/Library/LaunchDaemons/bootps.plist as:

<key>ProgramArguments</key>
<array>
    <string>/usr/libexec/bootpd</string>
    <string>-i</string>
    <string>en0</string>
</array>

If you have any other trouble I would recommend running bootpd manually with the arguments: -dv this makes it run foreground (-d) and verbose (-v).

Hope this helps anyone else struggling through this problem!