You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Configure DHCP Options 66 and 67

I need to configure OS X Server BOOTP to provide DHCP options 66 and 67 to provide PXE booting for PCs on the net work. I have tried following the bootpd MAN pages, but they are not specific enough. I have read conflicting informaiton on the net, but nothing definitive for Mountain Lion DHCP.


from bootpd man page:

bootpd has a built-in type conversion table for many more options, mostly those specified in RFC 2132, and will try to convert from whatever type the option appears in the property list to the binary, packet format. For example, if bootpd knows that the type of the option is an IP address or list of IP addresses, it converts from the string form of the IP address to the binary, network byte order numeric value.


If the type of the option is a numeric value, it converts from string, integer, or boolean, to the proper sized, network byte-order numeric value.


Regardless of whether bootpd knows the type of the option or not, you can always specify the DHCP option using the data property list type e.g.:

<key>dhcp_option_128</key>

<data>

AAqV1Tzo

</data>


My TFTP server is 172.16.152.20 and the bootfile is pxelinux.0


I have edited /etc/bootpd.plist and added the following to the subnet dict:


<key>dhcp_option_66</key>

<data>

LW4gLWUgrBCYFAo=

</data>

<key>dhcp_option_67</key>

<data>

LW4gLWUgcHhlbGludXguMAo=

</data>



According to the man page, the data elements are supposed to be Base64 encoded, but no matter what I try, I cannot get PXE clients to boot.


I have tried encoding 172.16.152.20 and pxelinux.0 using vaious methods:



Has anyone got this working?


Regards,

Paul Adams.

Posted on Dec 1, 2012 3:01 PM

Reply
22 replies

Dec 3, 2012 7:55 AM in response to Paul B. Adams

I'm the author of DHCP Option Code Utility 🙂


Normally you would define IP addresses as type IP Address and this gets stored as four bytes, 255 would equal FF in hex. You would not normally define an IP address as type string as this would be a much longer value where each character is one byte.


A string would be defined as type string of course.


It would appear therefore that you have used the wrong choice for defining the IP address.

Dec 3, 2012 4:30 PM in response to John Lockwood

Hi John,


Thanks for the response. I have recreated the following using your utility:


<key>dhcp_option_66</key>

<data>

LW4gLWUgrBCYFAo=

</data>

<key>dhcp_option_67</key>

<data>

LW4gLWUgcHhlbGludXguMAo=

</data>


66 is the IP address 172.16.152.20 IP address format (not string), 67 is "pxelinux.0" as a string. When I add these to my subnet dictionary in the /etc/bootpd.plist and restart my DHCP service, I still cannot get the PXE boot images to connect to the PXE server, it times out.


When I pass LW4gLWUgrBCYFAo= through a Base64 decode I get: -n -e � �

When I pass LW4gLWUgcHhlbGludXguMAo= through a Base64 decode I get: -n -e pxelinux.0


Is that correct? Should each value be prefixed with "-n-e "?


Any pointers to a solution will be greatly appreciated 🙂


Regards,

Paul.

Dec 3, 2012 5:03 PM in response to Paul B. Adams

The correct values should be


<key>dhcp_option_66</key>

<data>

rBCYFA==

</data>



<key>dhcp_option_67</key>

<data>

cHhlbGludXguMA==

</data>


It does not appear to be your fault. I just tried my utility on Snow Leopard, and then on Mountain Lion and on Mountain Lion it is giving the wrong results - the ones you got. For everyone's benefit, there seems to be a simple workaround which is to delete LW4gLWUg from the front of each generated value on Mountain Lion.

Dec 4, 2012 5:18 AM in response to John Lockwood

Hi John, I really appreciate your help with this.


In your post you state "delete LW4gLWUg from the front of each generated value."


My generated values are "LW4gLWUgrBCYFAo=" and "LW4gLWUgcHhlbGludXguMAo=" but in your eaxample above you use "rBCYFA==" and "cHhlbGludXguMA=="


The ending characters differ: "==" in your examples and "o=" in my generated versions.


Using your examples in my bootpd.plist still does not work with PXE boot -- the TFTP server is not found.


Here is my bootpd.plist file using your example. Is there another error in the file? Do I have the options in the correct locaiton within the plist?


<?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>NetBoot</key>

<dict/>

<key>Subnets</key>

<array>

<dict>

<key>allocate</key>

<true/>

<key>dhcp_domain_name</key>

<string>no-dns-available.example.com</string>

<key>dhcp_domain_name_server</key>

<array>

<string>172.16.152.10</string>

<string>172.16.152.2</string>

</array>

<key>dhcp_domain_search</key>

<array/>

<key>dhcp_option_66</key>

<data>

rBCYFA==

</data>

<key>dhcp_option_67</key>

<data>

cHhlbGludXguMA==

</data>

<key>dhcp_router</key>

<string>172.16.152.2</string>

<key>lease_max</key>

<integer>3600</integer>

<key>name</key>

<string>172.16.152.0 Ethernet</string>

<key>net_address</key>

<string>172.16.152.0</string>

<key>net_mask</key>

<string>255.255.255.0</string>

<key>net_range</key>

<array>

<string>172.16.152.2</string>

<string>172.16.152.253</string>

</array>

<key>selected_port_name</key>

<string>en0</string>

<key>uuid</key>

<string>65C124B4-E3FD-4805-9A4D-23059026E365</string>

</dict>

</array>

<key>allow</key>

<array/>

<key>bootp_enabled</key>

<false/>

<key>deny</key>

<array/>

<key>detect_other_dhcp_server</key>

<false/>

<key>dhcp_enabled</key>

<array>

<string>en0</string>

</array>

<key>netboot_disabled</key>

<array>

<string>en0</string>

</array>

<key>old_netboot_enabled</key>

<false/>

<key>relay_enabled</key>

<false/>

<key>relay_ip_list</key>

<array/>

<key>timeServiceStarted</key>

<string>2012-12-04 13:05:13 +0000</string>

</dict>

</plist>

Dec 4, 2012 11:55 AM in response to Paul B. Adams

I believe you have them in the right place, here is a working bootpd.plist file


<?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>NetBoot</key>
        <dict/>
        <key>Subnets</key>
        <array>
                <dict>
                        <key>allocate</key>
                        <true/>
                        <key>dhcp_domain_name</key>
                        <string>example.com</string>
                        <key>dhcp_domain_name_server</key>
                        <array>
                                <string>192.168.168.10</string>
                                <string>192.168.168.11</string>
                        </array>
                        <key>dhcp_domain_search</key>
                        <array>
                                <string>example.com</string>
                        </array>
                        <key>dhcp_ldap_url</key>
                        <array>
                                <string>ldap://server.example.com/dc=server,dc=example,dc=com</string>
                        </array>
                        <key>dhcp_nb_over_tcpip_name_server</key>
                        <array>
                                <string>192.168.168.10</string>
                        </array>
                        <key>dhcp_router</key>
                        <string>192.168.168.1</string>
                        <key>lease_max</key>
                        <integer>3600</integer>
                        <key>lease_min</key>
                        <integer>3600</integer>
                        <key>name</key>
                        <string>File Server LAN</string>
                        <key>net_address</key>
                        <string>192.168.168.0</string>
                        <key>net_mask</key>
                        <string>255.255.255.0</string>
                        <key>net_range</key>
                        <array>
                                <string>192.168.168.150</string>
                                <string>192.168.168.240</string>
                        </array>
                        <key>selected_port_name</key>
                        <string>en0</string>
                        <key>uuid</key>
                        <string>8C5D9377-595C-48A5-844C-EC83EFC4BF5B</string>
                </dict>
        </array>
        <key>dhcp_enabled</key>
        <array>
                <string>en0</string>
        </array>
        <key>timeDatabaseUpdated</key>
        <string>2009-07-21 15:19:30 +0100</string>
        <key>timeServiceStarted</key>
        <string>2010-06-19 11:44:26 +0100</string>
</dict>
</plist>

Some of your arrays are listed but empty and I am worried this may be confusing things since they don't have balanced <array> <array/> pairs unlike the working example above.

Dec 14, 2012 11:45 AM in response to Paul B. Adams

Paul, see this thread https://discussions.apple.com/thread/4590329


It turns out that the pxelinux.0 string needs to be null terminated. You need to convert pxelinux.0 to hex values and then add 00 to the end and then enter that in my utiltiy chosing the hex option. I believe the right result should therefore be as follows.


<key>dhcp_option_67</key>

<data>

cHhlbGludXguMAA=

</data>

Jan 4, 2013 9:50 AM in response to John Lockwood

John,


I've been on the road for several weeks and only just got to test this out.


It WORKS! I am now PXE booting VMs from OS X Server 2.2 DHCP with the following entries in my bootpd.plist:


<key>dhcp_option_66</key>

<data>

rBCYFAo=

</data>

<key>dhcp_option_67</key>

<data>

cHhlbGludXguMAA=

</data>


Kudos, and thanks you for your help.


Regards,

Paul Adams.

Vancouver BC, Canada.

May 15, 2013 9:31 PM in response to John Lockwood

Not a substitute for a graphical interface, but here is a way to encode the string for option 67 in Terminal:


$ printf %s00 `echo -n pxelinux.0 | xxd -p` | xxd -r -p | openssl base64


It echoes the string "pxelinux.0" through xxd to convert to hex, uses printf to add a "00", then pipes through xxd again to convert back from hex, then pipes to openssl to encode in base64. Note the backticks (not single quotation marks). The output is


cHhlbGludXguMAA=




Also, for option 66:


$ echo 10.2.1.11 | awk -F . '{ printf "%.2x%.2x%.2x%.2x", $1, $2, $3, $4 }' | xxd -r -p | openssl base64


This one echoes the IP address string through an awk program to convert to hex (the result is "0a02010b"), then pipes through xxd to convert back to binary, then openssl to encode in base64. The output is


CgIBCw==




Regards,

edxley

Jun 18, 2013 5:49 AM in response to edxley

For anyone still interested in DHCP Option Codes using Apple's DHCP server, I have finally got round to writing a new version of my utility. It now works properly in Mountain Lion as well as previous OS versions. I have also added explicit support for defining null-terminated strings as needed for PXE boot purposes amongst others.


See http://jelockwood.blogspot.co.uk/2013/06/dhcp-server-on-os-x-server.html

Configure DHCP Options 66 and 67

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