Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

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

DHCP, 'wpad' option 252

Hi

Has anyone successfully managed to do this? Looking at "serveradmin settings dhcp" it's not there as an option. Any thoughts/advice warmly received.

Tony

iBook G3 (10.4.11)

Posted on Jan 23, 2010 1:56 AM

Reply
Question marked as Best reply

Posted on Jan 26, 2010 3:57 AM

Antonio Rocco wrote:
Hi

Has anyone successfully managed to do this? Looking at "serveradmin settings dhcp" it's not there as an option. Any thoughts/advice warmly received.


It is possible to define additional DHCP option codes and 'serve' them using Mac OS X Server's DHCP server. However the information needs to be encoded in 'data' format and not like standard DHCP fields as explicit text, integer, or IP address.

Unfortunately, Apple do not provide an easy method for generating the data format equivalent. It is mostly but not completely a BASE64 encoded version.

If you let me know what contents you want in this DHCP option code I might be able to generate the value for you. For example if you wanted it to contain "http://xxxxxx.xxxx.xx/yyy".

By the way, regrettably Mac OS X as a client does not support using WPAD (Web Proxy Auto Discovery). I wish it did.

Other readers might want to look at http://en.wikipedia.org/wiki/WebProxy_AutodiscoveryProtocol
12 replies
Question marked as Best reply

Jan 26, 2010 3:57 AM in response to Antonio Rocco

Antonio Rocco wrote:
Hi

Has anyone successfully managed to do this? Looking at "serveradmin settings dhcp" it's not there as an option. Any thoughts/advice warmly received.


It is possible to define additional DHCP option codes and 'serve' them using Mac OS X Server's DHCP server. However the information needs to be encoded in 'data' format and not like standard DHCP fields as explicit text, integer, or IP address.

Unfortunately, Apple do not provide an easy method for generating the data format equivalent. It is mostly but not completely a BASE64 encoded version.

If you let me know what contents you want in this DHCP option code I might be able to generate the value for you. For example if you wanted it to contain "http://xxxxxx.xxxx.xx/yyy".

By the way, regrettably Mac OS X as a client does not support using WPAD (Web Proxy Auto Discovery). I wish it did.

Other readers might want to look at http://en.wikipedia.org/wiki/WebProxy_AutodiscoveryProtocol

Jan 26, 2010 12:00 PM in response to John Lockwood

Hi John

Thanks for getting back to me. I remember reading one of your posts a while back talking about BASE64 Something to do with a particular Phone model I think?

The url is simple as you would expect:

http://192.168.197.99/wpad.dat

I knew about the lack of support for wpad in Safari etc. I read it in one of your previous posts! Most ad-hoc users will probably be using PCs anyway so not such an issue. For the rare ad-hoc mac I can always send a "networksetup" command via ARD.

I'll be testing this on Thursday and if it works I'll mark it as solved. You could earn yourself extra brownie points if you wish John? I cross-posted over on the Unix Forum. If you reply there I'll mark it Helpful and if a success Solved as well as here.

Tony

Jan 27, 2010 8:18 AM in response to Antonio Rocco

Antonio Rocco wrote:
Hi John

Thanks for getting back to me. I remember reading one of your posts a while back talking about BASE64 Something to do with a particular Phone model I think?

The url is simple as you would expect:

http://192.168.197.99/wpad.dat

I knew about the lack of support for wpad in Safari etc. I read it in one of your previous posts! Most ad-hoc users will probably be using PCs anyway so not such an issue. For the rare ad-hoc mac I can always send a "networksetup" command via ARD.

I'll be testing this on Thursday and if it works I'll mark it as solved. You could earn yourself extra brownie points if you wish John? I cross-posted over on the Unix Forum. If you reply there I'll mark it Helpful and if a success Solved as well as here.

Tony


For a URL like above, it is going to need to be an equivalent to a string. I therefore believe you will need the following

<key>dhcp option252</key>
<data>
aHR0cDovLzE5Mi4xNjguMTk3Ljk5L3dwYWQuZGF0
</data>

Which Unix forum are you referring to?

Feb 25, 2010 6:51 AM in response to goulv1

goulv1 wrote:
Hi,

could you please help me? I am trying to add :
<data>192.168.1.25</data>

Best regards!


Data fields cannot contain human-readable values. They have to be 'encoded' in to Data format.

You need to tell me

i. What DHCP option field it is supposed to be
ii. What value (human version) it is supposed to be, presumable from the above you are trying to define a DHCP option field containing a TCP/IP address.

As an example the following would be correct, and would contain your above IP address

<key>dhcp option128</key>
<data>
wKgBGQ==
</data>

Feb 26, 2010 2:28 AM in response to goulv1

goulv1 wrote:
Thx for your answer :

I would like to add :

<key>dhcp option66</key>
<data>192.168.1.25</data>

<key>dhcp option120</key>
<data>192.168.1.25</data>


For sending the above as IP addresses the values you need are

<key>dhcp option66</key>
<data>
wKgBGQ==
</data>

<key>dhcp option120</key>
<data>
wKgBGQ==
</data>

For sending as 'strings' the values would be

<key>dhcp option66</key>
<data>
MTkyLjE2OC4xLjI1
</data>

<key>dhcp option120</key>
<data>
MTkyLjE2OC4xLjI1
</data>

Feb 26, 2010 3:02 AM in response to foilpan

foilpan wrote:
for all these, do the following to get the encoded version:


echo "192.168.1.25" | openssl enc -base64


pipe the string you want encoded to openssl, and you're done.


Thanks for the above. It is not the method I have been using but I can see the above works for converting strings. For the benefit of others to decode it would be

echo "MTkyLjE2OC4xLjI1Cg==" | openssl enc -d -base64

The method I use, does pad out IP, and integer values, but does not seem to pad strings. Having tested decoding a string with and without padding, both produce the same decoded results, so either it does not matter, or openssl is clever enough to cope anyway. Openssl always pads strings when encoding.

For the benefit of others again, IP addresses and Integers are not normally sent as strings. They are sent as encoded numbers as these use less space. Hence why the IP address of 192.168.1.25 would normally be encoded as wKgBGQ== rather than MTkyLjE2OC4xLjI1Cg==

DHCP, 'wpad' option 252

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