Introduction
This article describes the changes required on Windows CE (DHCP client) side to support Vendor specific DHCP option.
Using the Code
In order to enable Windows CE to pass the vendor class id to the DHCP server and to receive the vendor specific sub options from DHCP server, the following two registry settings need to be added.
* Create the following two registry entries in the Windows CE under [HKEY_LOCAL_MACHINE\Comm\<adapter name>\Parms\TcpIp] (where <adapter name> is the network adaptor name).
- DHCPSendOptions
Create a key with name “DHCPSendOptions
” under [HKEY_LOCAL_MACHINE\Comm\<adapter name>\Parms\TcpIp]
Add a binary value with name “60
” under this key as shown in the below example:
[HKEY_LOCAL_MACHINE\Comm\<adapter name>\Parms\TcpIp\DHCPSendOptions]
"60"=hex:\
3c,04,74,65,73,74
(DHCP Client uses option ‘60
’ to request DHCP server for the vendor specific option with vendor specific class id in the DHCP Discover packet.)
The general format of the above data is:
<Option> <length> <values>
3c, 04, 74,65,73,74
where “60
” is the vendor specific option (used for DHCP client to send the vendor class id to server).
- 3C (Hexadecimal equivalent of 60)– is the option value that needs to be added as a first byte in the data.
- 04 is the length of the vendor class id (test).
- 74,65,73,74 is the vendor class id (‘
test
’ is the vendor class id we used here) – The server should be configured with this vendor class id.
- DHCPOptions
Create a key called “DHCPOptions
” and add the value “43
” under that
as shown in the below example:
[HKEY_LOCAL_MACHINE\Comm\<adapter name>\Parms\TcpIp\DHCPSendOptions]
"43"=hex:\
00,00,00,00
The value “43
” is set to receive the Vendor specific option from DHCP server on DHCP ack packet.
Keep the data field empty.
After making the above registry changes, connect the Ethernet cable to the n/w where DHCP server is connected. If the cable is already connected, then execute “ipconfig / release
” and/or “ipconfig /renew
” commands to request for DHCP again.
After successful receiving DHCP server acknowledgement, the registry entry “43
” will receive the sub option sent by the DHCP server.
The format of the value 43
is:
<Vendor specific option> <length of total data> <suboption1>
<length of subotion1> <data od subotion1> <sub option> <…>
Example value:
HKEY_LOCAL_MACHINE\Comm\<adapter name>\Parms\TcpIp\DhcpOptions]
"43"=hex:\
2b,10,67,04,c0,a8,64,6e,69,04,c0,a8,1e,15,6e,02,00,05
- 2b is the Hexadecimal equivalent for option “
43
” - 10 is the length of the total received data
- 67 (Decimal 103) is the Sub option one name
- 04 is length of the sub option one
- C0, a8, 64, 6e is the value of the sub option one
- 69 ( Decimal 105) sub option two
- 04 is the length of the sub option two
- c0,a8,1e,15 value of the sub option two
- 6e (decimal 110) is the suboption name 3
- 02 is the length of the value
- 00,05 is the value
Configuring DHCP Server to Support Vendor Class Option
Follow the below steps to configure DHCP server for vendor specific options.
- Install DHCP Server.
- Create a scope and activate the scope.
- After the scope is created, right click on the DHCP server, and click on Define Vendor classes.
- Click on Add.
- In the window that comes up, enter Display name let's say “TEST”, enter Description, and then enter an ASCII class Id (example:
test
). - Click on Predefined Options and Values.
- Select the new Option Class Created i.e.
TEST
. - Click on Add to create a New Option.
- Enter Name, and under data type choose IP. Choose a code between 1 and 255. Provide description (we used 103, 105 110).
- Go to server options, right click and choose Configure Options.
- Click on advanced, and choose
TEST
from the drop down, then choose the Option you want to activate.
History
- 5th May, 2009: Initial post
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.