DHCP option 121/249 please help.(provide static routes via DHCP to win clients)
it would be absolutely great if someone could help me out on this.
I'd like to supply windows clients in the lan with a static route via dhcp.
In my case a certain public ip should be accessed via a different router on the lan subnet.
This should be done by using custom dhcp option 121. Windows Clients prior to Server 2008 ignore option 121 and so you are supposed to use option 249 with same parameters.
However I have no clue as to how to formulate the parameter in pfsense.
Let's say 192.168.0.30 was the router and 192.168.126.34 was the ip that should be reachable by this router.
I already tried the following:
None of those worked and everytime the testmachine went offline (so it actually had some if undesired effect :D )
Thank you very much if you could help me out on this one!!
danswartz last edited by
Search the forum - someone else asked almost the identical question. You can put this in under 2.0 in the dhcp server setting, but it wasn't clear how to specific the entry.
Yes I can put it there and that's what I did, but as you say I don't know how to format the data.
The search I did was unsuccessful.
Does anyone of the developers know how to do that?
wallabybob last edited by
You are using pfSense 2.0BETA? If not, how are you specifying the DHCP option?
The encoding for DHCP option 121 is given in http://tools.ietf.org/html/rfc3442
The information you gave about your static routes was incomplete - you also need to provide a network mask.
Yes using 2.0
No, I also supplied a net mask
I wanted to know how pfsense's dhcpd expects those data.
Using dnsmasq as dhcp it would be like that:
Trying 220.127.116.11.34,192.168.0.30 doesn't work.
Should it be encoded in hex?
I tried with 20:c0:a8:6f:1:c0:a8:0:1e and with FF:FF:FF:FF:c0:a8:6f:1:c0:a8:0:1e but no luck :( the dhcp client on a win server 2008 testmachine just gives and error about malformed data..
Update: the first option actually doesn't produce any error, but it doesn't have any effect at all either..
Ok, because I don't need a subnet, I tried it with option 33
This did not work either.
This time I took a look into dhcpd.conf.
The entry looked like:
option custom-lan-0 code 33 = text;
option custom-lan-0 "192.168.111.1 192.168.0.30";
However I edited dhcpd.conf to use the option "static-routes" instead of the option code which did work!
dhcp-option static-routes 192.168.111.1 192.168.0.30;
I tried it again with using the option code and using hex. This time without the colons.
This did something, but I get completely wrong results :D
Something to watch out for when converting to hex in this case?
192.168.112.1 -> C0A87001
192.168.0.30 -> C0A8001E
I entered it like this: C0A87001C0A8001E
..but got: 18.104.22.168 255.255.255.255 22.214.171.124
Does anyone know what's my mistake?
Thanks very much!
It does work if the option type is set to string instead of text… I wonder how I should format the data if its set to text though..
Hi mxx, I'm running into the same issue. Did you ever figure this out? I couldn't get it to work in pfSense 2.0 beta 5. I now switched to Windows 2008 R2 DHCP in which it does work using option 121. Check the attachted screenshot.
This is a few months back now and I only remember very vague.
For me it did work when I set option type to string in dhcpd.conf. But before I tried that I switched to option type 33, 'cause it's a less complex expression and I didn't need classless routing anyway. But I guess it should work for 121 too.
Never looked into it again since I went a different route for my setup.
I don't know for sure but didn't pfsense 2 got an option in the meanwhile where you can define the option data type yourself?
Good luck to you!
Thanks for sharing your thoughts. I've tried many different things. Both via the webinterface as well as hacking directly into the config files. It kept giving me invalid DHCP data errors on my Windows 7 client. I didn't understand from your postings what you did to get it to work finally. You clearly tried a lot of different things as well and from your postings I can not distinguish exactly what you did when it worked. The Windows DHCP option suits me well for now.
If somebody else reading this topic has dealt with this before, please do reply as I am still curious in how to get it to work.
for option 33 to work I had to set the data type to string. Previously it wasn't possible to do this via the gui. But now I see it's finally possible..
After that it worked. Just needed to figure out the correct format for the option. Once I figured out that I needed type string I had already abandoned the idea to use option 121, since I only needed a static host route.
So I only tried it with option 33.. this worked for any winxp host..
Good luck to you!
Interesting. Can you recall what you put in as a string? Was it in hexadecimals? With or without the : separators?
I'm sorry for the late reply.
I just tested it again. This time it worked perfectly straight through the web interface (selecting type string, which wasn't possible back then).
I entered in the following: number: 33, type: string, value: C0:A8:70:01:C0:A8:00:1E
This resulted in the following host route: dst:192.168.112.1 mask:255.255.255.255 gw:192.168.0.30
Did you already succeed with your option 121 issue?