Skip to main content

User Manual

Configuring DHCP options

KeeneticOS allows you to configure DHCP options. This setting is only available through the router's command-line interface (CLI). It enables you to configure the following options:

  • 2 (Time Offset),

  • 4 (Time Server),

  • 26 (MTU),

  • 42 (NTP Servers),

  • 43 (Vendor Specific Information),

  • 44 (NetBIOS Servers),

  • 60/66 (TFTP Server Name),

  • 67 (Bootfile-Name),

  • 72 (World Wide Web Server),

  • 121 (Classless Static Routes),

  • 249 (MS Routes).

Configuration for the whole DHCP server:

(config)> ip dhcp pool {name} option

Usage template:
 option ({2..254} hex {data}) | ({2..254} ascii {data}) | (4 {address[,address]*}) | (6 {address[,address]*}) | (42 {address[,address]*}) | (44 {address[,address]*}) | (26 {mtu}) | (121 {address/{0..32},gateway},*) | (249 {address/{0..32},gateway},*)

Configuration for a specific class id:

(config)> ip dhcp pool _WEBADMIN class test
(config-dhcp-pool-class)> option

Usage template:
 option ({2..254} hex {data}) | ({2..254} ascii {data}) | (4 {address[,address]*}) | (6 {address[,address]*}) | (42 {address[,address]*}) | (44 {address[,address]*}) | (26 {mtu}) | (121 {address/{0..32},gateway},*) | (249 {address/{0..32},gateway},*)

Let's demonstrate how DHCP options work using option 121 (distributing static routes via DHCP) as an example. To do this, we will configure route distribution on the 192.168.0.0/24 and 192.168.10.0/24 subnets via the 192.168.222.2 gateway for all DHCP clients, and on the 192.168.1.0/24 and 192.168.11.0/24 subnets via the 192.168.222.3 gateway for DHCP clients with с class id test.

The configuration will look like this:

(config)> ip dhcp pool _WEBADMIN_HOME option 121 ascii 192.168.0.0/24,192.168.222.2,192.168.10.0/24,192.168.222.2
(config)> ip dhcp class test 
(config-dhcp-class)> option 60 ascii "MSFT 5.0"
(config-dhcp-class)> exit
(config)> ip dhcp pool _WEBADMIN_HOME class test 
(config-dhcp-pool-class)> option 121 ascii 192.168.1.0/24,192.168.222.3,192.168.11.0/24,192.168.222.3
(config-dhcp-pool-class)> exit
(config)> system configuration save

Now we can connect a client that does not have a class id specified and see what routes it will receive. After receiving the IP address, run the route print command in the Windows OS command line:

dhcp-options-01-en.png

Also, in the network packet dump during communication between the DHCP client and the DHCP server, it can be seen that the server transmits this information in the option field:

dhcp-options-02-en.png

Next, let's assign a class id to the client and see what it gets. For Windows, the class id is set using the ipconfig command:

ipconfig /setclassid "wlan" test

where wlan is the name of the network connection.

dhcp-options-03-en.png

The current class id of the DHCP client is stored in the Windows registry in plain text and is located at the following path: Computer\HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters\Interfaces for each interface. The parameter you are looking for is called DhcpClassId и тип REG_SZ.

dhcp-options-04-en.png

After getting the IP address, run the route print command in the Windows command prompt:

dhcp-options-05-en.png

Also, in the network packet dump during communication between the DHCP client and the DHCP server, it can be seen that the server transmits this information in the option field:

dhcp-options-06-en.png

You can delete a class using the command:

(config)> no ip dhcp class test

All options for this class in the settings of all DHCP servers will also be deleted.

A specific option in the class can also be deleted:

(config)> ip dhcp pool _WEBADMIN_HOME class test
(config-dhcp-pool-class)> no option 121 ascii 192.168.1.0/24,192.168.222.3,192.168.11.0/24,192.168.222.3

You can delete all options for a specific class within a single DHCP server:

(config)> ip dhcp pool _WEBADMIN_HOME no class test

A general option (not for a class) can be deleted as follows:

ip dhcp pool _WEBADMIN_HOME no option 121 ascii 192.168.0.0/24,192.168.222.2,192.168.10.0/24,192.168.222.2

Additional information on configuring DHCP option 15 (DNS Domain Name) is provided in the article Configuring DHCP Option 15.