Question : Add Option 125 into dhclient.conf
I download the DHCP client source code from “http://www.isc.org/index.pl?/sw/dhcp/“.
I want to use DHCP Option 125 to get vendor-specific information. ( Device Gateway )
A DHCP request is sent from the Device that contains the Device Identity to the Gateway. So the Gateway can get the Device Identity.
A DHCP response is sent from the Gateway that contains the Gateway Identity to the Device. So the Device can get the Gateway Identity.
I want to get the Gateway Identity and save it into file. So I can read this information at other application. I have already asked this question in DHCP Forum, but I still don’t get the help.
What should I do?
Could anyone give me a sample configuration showing use of options 124/125?
Solution: Add Option 125 into dhclient.conf
> So when execute ‘request local.gw-id;’, it means request dhcop option 101, right???
My above dhclient.conf is incorrect.
> You define a space named ‘local’ and define a option name local.gw-id and its code is 101.
> And this ‘local’ space contains the option name ‘local-encapsulation’ and its code is 124. Right???
No. Option with code 124 encapsulates inside it all options defined in a space ‘local’. In my case the only defined is the option with code 101…
What about using ‘vendor’ option space, I was not correct also. It uses option 43 for encapsulation, but you need 124 and 125.
Also I have no any hardware, that supports option 125 or 124. So I’m using ISC DHCPd and follow generic rfc3925 rules for encapsulating option 125.
That’s my last config, it doesn’t perform correct decapsulation for vendor sub-options, but you may do it yourself in your script. May be dhclient _can_ perform such decapsulation, but I have no much time to deal with it. Even raw values may be used.
/etc/dhcp3/dhclient.conf (only added or modified lines):
option option-124 code 124 = string;
option option-125 code 125 = string;
# Here we encode option 124 with fake vendor id = ff:ff and sub-option number 2 with the value of “Ubuntu” string, read RFC3925 for more info
send option-124 ff:ff:08:02:06:55:62:75:6E:74:75;
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, host-name,
netbios-name-servers, netbios-scope, option-125;
/etc/dhcp3/dhclient-enter-hooks.d/env file (create it):
env > /tmp/variables.txt
now release your dhcp address and obtain it again and see in /tmp/variables.txt
Look for new_ prefixed vars. As for me, I have:
That’s the way I have encapsulated vendor option with vendor if ff:ff suboption numer 1 stringvalue “FreeBSD”.