Knowledge Base

How to configure Option 82 aware DHCP Server

Scenario

The following topology shows a typical DHCP Relay deployment. The administrator intends to assign IP addresses to the clients in 3 different subnets.

 

Topology Description:

1. MES-3728 is used as DHCP Relay Agent in the network.
2. SW department client will obtain IP address 192.168.10.0/24
3. HW department client will obtain IP address 192.168.20.0/24
4. CSO department client will obtain IP address 192.168.30.0/24

We need to use DHCP relay option 82 in this deployment for the addressing scheme. Here's a configuration example about the DHCP server.

Step

1. Configuring DHCP Relay on Relay Agent. This example is made on the third MES-3728.

MES-3728(config)# dhcp relay 30 helper-address 192.168.1.200 option information.

2. Option 82 in the DHCP packet

 

We can see Option 82 in this DHCP packet. Our switch support sub-option 1 (Agent Circuit ID). Agent Circuit ID consists of Slot ID, Port ID, VLAN ID and Additional Info.

Slot ID 0x00 = 0
Port ID 0x02 = 2
VLAN ID 0x001E = 30
Additional Information: 0x4D45532D33373238 = MES-3728

 In this example, we will assign IP addresses to clients based on the VLAN IDs in the DHCP packets.

 

3. Configuring DHCP Server that support Option 82

In this demonstration, dhcp-4.1.1-9 Linux platform is used as the DHCP Server. Here we will show how to configure the DHCP Server to make it assign IP addresses base on the VIDs in the DHCP packets.

The DHCP Server's function is controlled by the dhcpd.conf. This configuration file is configured to use various methods to assign IP addresses.

1) Before editing dhcpd.conf, we need to know some DHCP expressions supported by this server:

substring(option agent.circuit-id,2,2)   The OFFSET is 2 bytes, and the Length is 2 bytes. This expression specifies VID part of the Agent Circuit ID.

binary-to-ascii(10,16,"",substring(option agent.circuit-id,2,2))   10 means decimal and 16 means the bit width. So the result of this expression is the VID in decimal.

 

2) Editing dhcpd.conf file. Save the configuration file after finishing editing.

# vim /etc/dhcp/dhcpd.conf

########################################################
ddns-update-style interim;
log-facility local7;

subnet 192.168.1.0 netmask 255.255.255.0 {
}

class "VLAN10" {
        match if binary-to-ascii(10,16,"",substring(option agent.circuit-id,2,2)) = "10";
} # VLAN10

class "VLAN20" {
        match if binary-to-ascii(10,16,"",substring(option agent.circuit-id,2,2)) = "20";
} # VLAN20

class "VLAN30" {
        match if binary-to-ascii(10,16,"",substring(option agent.circuit-id,2,2)) = "30";
} # VLAN30


subnet 192.168.10.0 netmask 255.255.255.0 {
        pool {
                allow members of                "VLAN10";
                default-lease-time               600;
                max-lease-time                    7200;
                range                           192.168.10.1 192.168.10.199;
                option routers                  192.168.10.254;
                option broadcast-address        192.168.10.255;
                option subnet-mask              255.255.255.0;
                option domain-name-servers      4.2.2.2;
}
}

subnet 192.168.20.0 netmask 255.255.255.0 {
        pool {
        allow members of                "VLAN20";
        default-lease-time              600;
        max-lease-time                  7200;
        range                           192.168.20.1 192.168.20.199;
        option routers                  192.168.20.254;
        option broadcast-address        192.168.20.255;
        option subnet-mask              255.255.255.0;
        option domain-name-servers      4.2.2.2;

}
}

subnet 192.168.30.0 netmask 255.255.255.0 {
        pool {
                allow members of                "VLAN30";
                default-lease-time              600;
                max-lease-time                  7200;
                range                           192.168.30.1 192.168.30.199;
                option routers                  192.168.30.254;
                option broadcast-address        192.168.30.255;
                option subnet-mask              255.255.255.0;
                option domain-name-servers      4.2.2.2;
}
}
########################################################

 

3) Start DHCP Service on the DHCP Server and it will be ready to assign IP addresses.

Verification

After starting DHCP service on the server, the clients connected to CSO MES-3728 can obtain IP addresses in 192.168.30.0/24 subnet.



YES NO

Please leave your comment:

SUBMIT

Question Profile

LANGUAGE:
ARTICLE ID:009391
TYPE:Application / Configuration Example
FIRMWARE:3.80;3.90; 4.0
VIEWS:6075
VOTES:6
TECHNOLOGY:
MODEL:XGS-4728F,XGS4700-48F,ES3500-24 (view more model name)

Still have trouble with your device? Contact Zyxel technology support team directly!

Contact Zyxel Support