MacOS DHCP with bootpd, static IPs in bootptab not working

I am trying to configure my MacBookPro to server as a DHCP server. I have researched and been able to get bootpd working, however when I try to configure static IP addresses in the /etc/bootptab file it doesn't work.


I have my /etc/bootpd.plist file configured to dynamically assign IPs between 10.0.0.3 and 10.0.0.99 with a IP lease term of 1 month. In my case, the network interface I want DHCP running on is called en11. The file contents are:


<?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>en11</string>
    </array>
    <key>reply_threshold_seconds</key>
    <integer>0</integer>
    <key>Subnets</key>
    <array>
        <dict>
            <key>allocate</key>
            <true/>
            <key>lease_max</key>
            <integer>2592000</integer>
            <key>lease_min</key>
            <integer>2592000</integer>
            <key>name</key>
            <string>10.0.0</string>
            <key>net_address</key>
            <string>10.0.0.0</string>
            <key>net_mask</key>
            <string>255.255.255.0</string>
            <key>net_range</key>
            <array>
                <string>10.0.0.3</string>
                <string>10.0.0.99</string>
            </array>
        </dict>
    </array>
</dict>
</plist>


I am able to start and stop the DHCP server with the following commands:


sudo /bin/launchctl load -w /System/Library/LaunchDaemons/bootps.plist

sudo /bin/launchctl unload -w /System/Library/LaunchDaemons/bootps.plist


All of the above works perfectly. The last piece of the puzzle is having a device with a static IP address. To accomplish that, I created the /etc/bootptab file to map a static IP to a MAC address. My /etc/bootptab file are as follows:


%%
# hostname hwtype hwaddr ipaddr bootfile
kvm-ubuntu 1 00:0c:29:1f:ed:54 10.0.0.128


But whenever I test it, the kvm-ubuntu PC is assigned an IP address of 10.0.0.3 instead of 10.0.0.128.


I have tried looking at (and clearing) /var/db/dhcpd_leases file which hasn't helped. After clearing the file and re-testing the DHCP functionality, the file is re-created by bootpd with the following entry:

{
	name=kvm-ubuntu
	ip_address=10.0.0.3
	hw_address=1,0:c:29:1f:ed:54
	identifier=1,0:c:29:1f:ed:54
	lease=0x61809a32
}


Any ideas for troubleshooting or help configuring a static IP address with bootp DHCP server would be immensely appreciated!

Posted on Oct 2, 2021 6:50 PM

Reply
Question marked as Top-ranking reply

Posted on Oct 4, 2021 10:29 PM

I was able to solve this after a lot of trial and error. Bootpd does not give a lot of log information.


I had two problems.


My first was that the /etc/bootptab file was the wrong file format. I had copied a .plist file and edited the contents, however .plist files are actually a different document type called "property list." I created a new file with TextEdit (making sure not to save as a .txt file) and replaced the /etc/bootptab file with that.


My second issue was that in the /etc/bootptab file, there needs to be a space after the IP address. The bootfile column can be left blank, but it needed the space at the end.


Also, when bootpd does recognize the bootptab file and finds a correct entry that matches a MAC address requesting an IP address, it assigns the static IP but does not write an entry to the /var/db/dhcp_leases file. I actually had it working for a while and was monitoring the dhcp_leases file to confirm/deny if it worked. Because it didn't write the static IP leases into the /var/db/dhcp_leases file, I thought it was not working when it actually was.


My final configurations are:


/etc/bootpd.plist (which is a property list file format):


<?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>en11</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>10.0.0</string>
                <key>net_address</key>
                    <string>10.0.0.0</string>
                <key>net_mask</key>
                    <string>255.255.255.0</string>
                <key>net_range</key>
                    <array>
                        <string>10.0.0.3</string>
                        <string>10.0.0.250</string>
                    </array>
            </dict>
        </array>
    <key>use_server_config_for_dhcp_options</key>
        <true/>
</dict>
</plist>


/etc/bootptab file (which is a document file format)


%%
# machine entries have the following format:
#
# hostname      hwtype  hwaddr              ipaddr          bootfile
hostname001     1       1c:69:7a:a8:94:ba   10.0.0.104 
hostname002     1       00:0c:29:15:7c:6e   10.0.0.120 
hostname003     1       00:0c:29:56:d5:ec   10.0.0.121 
hostname004     1       00:0c:29:66:c0:ec   10.0.0.122 
hostname005     1       00:0c:29:bb:2c:70   10.0.0.123 
hostname006     1       00:0c:29:c5:6c:5f   10.0.0.124 
hostname007     1       00:15:5d:00:cc:06   10.0.0.125 
hostname008     1       00:0c:29:9c:c3:fc   10.0.0.126 
hostname009     1       00:0c:29:5d:8c:b7   10.0.0.127 
hostname010     1       00:0c:29:1f:ed:54   10.0.0.128 	
hostname011     1       52:54:00:40:ef:76   10.0.0.129 
hostname012     1       00:0c:29:d0:68:ae   10.0.0.130 
hostname013     1       00:0c:29:b4:54:7f   10.0.0.131 
hostname001     1       00:0c:29:f6:ad:e9   10.0.0.132 
hostname001     1       00:0c:29:13:07:6c   10.0.0.134 
hostname001     1       00:0c:29:30:c3:4b   10.0.0.135 


To enable and disable the service from running:


sudo /bin/launchctl load -w /System/Library/LaunchDaemons/bootps.plist

sudo /bin/launchctl unload -w /System/Library/LaunchDaemons/bootps.plist


Troubleshooting tips for others:


1 - Bootpd doesn't give a lot of log information, but you can get some logs by typing this into Terminal:


sudo log stream --process bootpd --info --debug


2 - Know that bootpd only writes to /var/db/dhcp_leases when it assigns from a dynamic range. It does not write anything to that file if it uses a static IP listed in the /etc/bootptab file.


3 - I ran Wireshark on the interface and filtered for dhcp traffic which was helpful. That is how I realized the DHCP offers were actually working despite /var/db/dhcp_leases being empty.


4 - Include a space at the end of each entry in the /etc/bootptab file.


5 - the reply_threshold_seconds is best left at 0. I had increased it to 1 during troubleshooting. That caused an issue for 1 client for some reason - that client would issue a dhcp discovery broadcast and my Mac would not respond to it, I'm not sure why. Changing it back to 0 solved the issue for that client.


6 - You can type the following commands into Terminal to get a lot of technical information on bootpd and bootptab, however it took a while to digest many of the settings and how to manipulate them.


man bootpd

man bootptab
1 reply
Question marked as Top-ranking reply

Oct 4, 2021 10:29 PM in response to Junto26

I was able to solve this after a lot of trial and error. Bootpd does not give a lot of log information.


I had two problems.


My first was that the /etc/bootptab file was the wrong file format. I had copied a .plist file and edited the contents, however .plist files are actually a different document type called "property list." I created a new file with TextEdit (making sure not to save as a .txt file) and replaced the /etc/bootptab file with that.


My second issue was that in the /etc/bootptab file, there needs to be a space after the IP address. The bootfile column can be left blank, but it needed the space at the end.


Also, when bootpd does recognize the bootptab file and finds a correct entry that matches a MAC address requesting an IP address, it assigns the static IP but does not write an entry to the /var/db/dhcp_leases file. I actually had it working for a while and was monitoring the dhcp_leases file to confirm/deny if it worked. Because it didn't write the static IP leases into the /var/db/dhcp_leases file, I thought it was not working when it actually was.


My final configurations are:


/etc/bootpd.plist (which is a property list file format):


<?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>en11</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>10.0.0</string>
                <key>net_address</key>
                    <string>10.0.0.0</string>
                <key>net_mask</key>
                    <string>255.255.255.0</string>
                <key>net_range</key>
                    <array>
                        <string>10.0.0.3</string>
                        <string>10.0.0.250</string>
                    </array>
            </dict>
        </array>
    <key>use_server_config_for_dhcp_options</key>
        <true/>
</dict>
</plist>


/etc/bootptab file (which is a document file format)


%%
# machine entries have the following format:
#
# hostname      hwtype  hwaddr              ipaddr          bootfile
hostname001     1       1c:69:7a:a8:94:ba   10.0.0.104 
hostname002     1       00:0c:29:15:7c:6e   10.0.0.120 
hostname003     1       00:0c:29:56:d5:ec   10.0.0.121 
hostname004     1       00:0c:29:66:c0:ec   10.0.0.122 
hostname005     1       00:0c:29:bb:2c:70   10.0.0.123 
hostname006     1       00:0c:29:c5:6c:5f   10.0.0.124 
hostname007     1       00:15:5d:00:cc:06   10.0.0.125 
hostname008     1       00:0c:29:9c:c3:fc   10.0.0.126 
hostname009     1       00:0c:29:5d:8c:b7   10.0.0.127 
hostname010     1       00:0c:29:1f:ed:54   10.0.0.128 	
hostname011     1       52:54:00:40:ef:76   10.0.0.129 
hostname012     1       00:0c:29:d0:68:ae   10.0.0.130 
hostname013     1       00:0c:29:b4:54:7f   10.0.0.131 
hostname001     1       00:0c:29:f6:ad:e9   10.0.0.132 
hostname001     1       00:0c:29:13:07:6c   10.0.0.134 
hostname001     1       00:0c:29:30:c3:4b   10.0.0.135 


To enable and disable the service from running:


sudo /bin/launchctl load -w /System/Library/LaunchDaemons/bootps.plist

sudo /bin/launchctl unload -w /System/Library/LaunchDaemons/bootps.plist


Troubleshooting tips for others:


1 - Bootpd doesn't give a lot of log information, but you can get some logs by typing this into Terminal:


sudo log stream --process bootpd --info --debug


2 - Know that bootpd only writes to /var/db/dhcp_leases when it assigns from a dynamic range. It does not write anything to that file if it uses a static IP listed in the /etc/bootptab file.


3 - I ran Wireshark on the interface and filtered for dhcp traffic which was helpful. That is how I realized the DHCP offers were actually working despite /var/db/dhcp_leases being empty.


4 - Include a space at the end of each entry in the /etc/bootptab file.


5 - the reply_threshold_seconds is best left at 0. I had increased it to 1 during troubleshooting. That caused an issue for 1 client for some reason - that client would issue a dhcp discovery broadcast and my Mac would not respond to it, I'm not sure why. Changing it back to 0 solved the issue for that client.


6 - You can type the following commands into Terminal to get a lot of technical information on bootpd and bootptab, however it took a while to digest many of the settings and how to manipulate them.


man bootpd

man bootptab

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

MacOS DHCP with bootpd, static IPs in bootptab not working

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.