Configuring DHCP Service
CHAPTERS
4. DHCP L2 Relay Configuration
6. Appendix: Default Parameters
This guide applies to: T1600G-18TS v2 or above, T1600G-28TS v3 or above, T1600G-28PS v3 or above, T1600G-52TS v3 or above, T1600G-52PS v3 or above, T1700X-16TS v3 or above, T1700G-28TQ v3 or above, T2600G-18TS v2 or above, T2600G-28TS v3 or above, T2600G-28MPS v3 or above, T2600G-28SQ v1 or above, T2600G-52TS v3 or above. |
1.1Overview
DHCP (Dynamic Host Configuration Protocol) is widely used to automatically assign IP addresses and other network configuration parameters to network devices, enhancing the utilization of IP address.
1.2Supported Features
The supported DHCP features of the switch include DHCP Server, DHCP Relay and DHCP L2 Relay.
DHCP Server
DHCP Server is used to dynamically assign IP addresses, default gateway and other parameters to DHCP clients. As the following figure shows, the switch acts as a DHCP server and assigns IP addresses to the clients.
Figure 1-1 Application Scenario of DHCP Server
DHCP Relay
DHCP Relay is used to process and forward DHCP packets between different subnets or VLANs.
DHCP clients broadcast DHCP request packets to require for IP addresses. Without this function, clients cannot obtain IP addresses from a DHCP server in the different LAN because the broadcast packets can be transmitted only in the same LAN. To equip each LAN with a DHCP server can solve this problem, but the costs of network construction will be increased and the management of central network will become inconvenient.
A device with DHCP Relay function is a better choice. It acts as a relay agent and can forward DHCP packets between DHCP clients and DHCP servers in different LANs. Therefore, DHCP clients in different LANs can share one DHCP server.
DHCP Relay includes three features: Option 82, DHCP Interface Relay and DHCP VLAN Relay.
■Option 82
Option 82 is called the DHCP Relay Agent Information Option. It provides additional security and a more flexible way to allocate network addresses compared with the traditional DHCP.
When enabled, the DHCP relay agent can inform the DHCP server of some specified information of clients by inserting an Option 82 payload to DHCP request packets before forwarding them to the DHCP server, so that the DHCP server can distribute the IP addresses or other parameters to clients based on the payload. In this way, Option 82 prevents DHCP client requests from untrusted sources. Besides, it allows the DHCP server to assign IP addresses of different address pools to clients in different groups.
An Option 82 has two sub-options, namely, the Agent Circuit ID and Agent Remote ID. The information that the two sub-options carry depends on the settings of the DHCP relay agent, and are different among devices from different vendors. To allocate network addresses using Option 82, you need to define the two sub-options on the DHCP relay agent, and create a DHCP class on the DHCP server to identify the Option 82 payload.
TP-Link switches preset a default circuit ID and remote ID in TLV (Type, Length, and Value) format. You can also configure the format to include Value only and customize the Value.
Table 1-1 and Table 1-2 show the packet formats of the Agent Circuit ID and Agent Remote ID, respectively.
Table 1-1Packet Formats of the Agent Circuit ID with Different Option 82 Settings
Option 82 Settings |
*Type (Hex) |
*Length (Hex) |
*Value |
|
*Format |
Circuit ID Customization |
|||
Normal (TLV) |
Disabled |
00 |
04 |
Default circuit ID |
Enabled |
01 |
Length of the customized circuit ID |
Customized circuit ID |
|
Private (Only the value) |
Disabled |
- |
- |
Default circuit ID |
Enabled |
- |
- |
Customized circuit ID |
Table 1-2Packet Formats of the Agent Remote ID with Different Option 82 Settings
Option 82 Settings |
*Type (Hex) |
*Length (Hex) |
*Value |
|
*Format |
Remote ID Customization |
|||
Normal (TLV) |
Disabled |
00 |
06 |
Default remote ID |
Enabled |
01 |
Length of the customized remote ID |
Customized remote ID |
|
Private (Only the value) |
Disabled |
- |
- |
Default remote ID |
Enabled |
- |
- |
Customized remote ID |
*Format
Indicates the packet format of the sub-option field. Two options are available:
■Normal: Indicates the field consists of three parts: Type, Length, and Value (TLV).
■Private: Indicates the field consists of the value only.
*Type
A one-byte field indicating whether the Value field is customized or not. 00 in hexadecimal means the Value field is not customized (uses the default circuit/remote ID) while 01 in hexadecimal means it is customized.
*Length
A one-byte field indicating the length of the Value field. The length of the default circuit ID is 4 bytes and that of default remote ID is 6 bytes. For the customized circuit ID and remote ID, the length is variable, ranging from 1 to 64 bytes.
*Value
Indicates the value of the sub-option. The switch has preset a default circuit ID and remoter ID. You can also customize them with Circuit ID Customization and Remote ID Customization enabled.
■Default circuit ID: A 4-byte value which consists of 2-byte VLAN ID and 2-byte Port ID. The VLAN ID indicates which VLAN the DHCP client belongs to, and the Port ID indicates which port the DHCP client is connected to.
00:02:00:01 in hexadecimal.
For example, if the DHCP client is connected to port 1/0/1 in VLAN 2, this field is■Default remote ID: A 6-byte value which indicates the MAC address of the DHCP relay agent.
■Customized circuit/remote ID: You can configure a string using up to 64 characters. The switch encodes the string using ASCII. When configuring your DHCP server to identify the string, use the correct notation that is used by your DHCP server to represent ASCII strings, or convert it into hexadecimal format if necessary.
Tips:
As shown in Table 1-1 and Table 1-2, by default, the circuit ID records the ports of the DHCP relay agent that are connected to the clients and the VLANs that the clients belong to, and the remote ID records the MAC address of the DHCP relay agent. That is, the two sub-options together record the location of the clients. To record the accruate location of clients, configure Option 82 on the switch which is closest to the clients.
■DHCP Interface Relay
DHCP Interface Relay allows clients to obtain IP addresses from a DHCP server in a different LAN. In DHCP Interface Relay, you can specify a DHCP server for the Layer 3 interface that the clients are connected to. When receiving DHCP packets from clients, the switch fills the corresponding interface’s IP address in the Relay Agent IP Address field of the DHCP packets, and forwards the packets to the DHCP server. Then the DHCP server can assign IP addresses that are in the same subnet with the Relay Agent IP Address to the clients.
The switch supports specifying a DHCP server for multiple Layer 3 interfaces, which makes it possible to assign IP addresses to clients in different subnets from the same DHCP server.
As the following figure shows, the IP address of VLAN 20 is 192.168.2.1/24 and that of the routed port Gi1/0/1 is 192.168.3.1/24. With DHCP Interface VLAN configured, the switch fills in the Relay Agent IP Address field of the DHCP packets with the IP address of VLAN 20 (192.168.2.1/24) when applying for IP addresses for clients in VLAN 20, and fills with the IP address of Gi1/0/1 (192.168.3.1/24) when applying for an IP address for PC 1. As a result, the DHCP server will assign IP addresses in Pool A (the same subnet with the IP address of VLAN 20) to clients in VLAN 20, and assign an IP address in Pool B (the same subnet with the Gi1/0/1) to PC 1.
Figure 1-2 Application Scenario of DHCP Interface Relay
■DHCP VLAN Relay
DHCP VLAN Relay allows clients in different VLANs to obtain IP addresses from the DHCP server using the IP address of a single agent interface.
In DHCP Interface Relay, to achieve this goal, you need to create a Layer 3 interface for each VLAN to ensure the reachability.
In DHCP VLAN Relay, you can simply specify a Layer 3 interface as the default agent interface for all VLANs. The switch fills this default agent interface’s IP address in the Relay Agent IP Address field of the DHCP packets from all VLANs.
As the following figure shows, no IP addresses are assigned to VLAN 10 and VLAN 20, but a default relay agent interface is configured with the IP address 192.168.2.1/24. The switch fills in the Relay Agent IP Address field of the DHCP packets with the IP address of the default agent interface (192.168.2.1/24) when applying for IP addresses for clients in both VLAN 10 and VLAN 20. As a result, the DHCP server will assign IP addresses on 192.168.2.0/24 (the same subnet with the IP address of the default agent interface) to clients in both VLAN 10 and VLAN 20.
Figure 1-3 Application Scenario of DHCP VLAN Relay
Note: ●If the VLAN already has an IP address, the switch will use the IP address of the VLAN as the relay agent IP address. The default relay agent IP address will not take effect. ●DHCP VLAN Relay will not work on routed ports or port channel interfaces, because they are not associated with any particular VLAN. |
DHCP L2 Relay
Unlike DHCP relay, DHCP L2 Relay is used in the situation that the DHCP server and clients are in the same VLAN. In DHCP L2 Relay, in addition to normally assigning IP addresses to clients from the DHCP server, the switch can inform the DHCP server of some specified information, such as the location information, of clients by inserting an Option 82 payload to DHCP request packets before forwarding them to the DHCP server. This allows the DHCP server which supports Option 82 can set the distribution policy of IP addresses and other parameters, providing a more flexible way to distribute IP addresses.
Figure 1-4 Application Scenario of DHCP L2 Relay
To complete DHCP server configuration, follow these steps:
1)Enable the DHCP Server feature on the switch.
2)Configure DHCP Server Pool.
3)(Optional) Manually assign static IP addresses for some clients.
2.1Using the GUI
2.1.1Enabling DHCP Server
Choose the menu L3 FEATURES > DHCP Service > DHCP Server > DHCP Server to load the following page.
Figure 2-1 Configure DHCP Server
Follow these steps to configure DHCP Server:
1)In the Global Config section, enable DHCP Server. Click Apply.
DHCP Server |
Enable DHCP Server. |
Option 60 |
(Optional) Specify the Option 60 for device identification. Mostly it is used for the scenarios that the APs (Access Points) apply for different IP addresses from different servers according to the needs. If an AP requests Option 60, the server will respond a packet containing the Option 60 configured here. And then the AP will compare the received Option 60 with its own. If they are the same, the AP will accept the IP address assigned by the server. Otherwise, the assigned IP address will not be accepted. |
Option 138 |
(Optional) Specify the Option 138, which should be configured as the management IP address of an AC (Access Control) device. If the APs in the local network request this option, the server will respond a packet containing this option to inform the APs of the AC’s IP address. |
2)In the Ping Time Config section, configure Ping Packets and Ping Timeout for ping tests. Click Apply.
Ping Packets |
Enter the number of ping packets the server can broadcast to test whether the IP address is occupied. The valid values are from 1 to 10, and the default is 1. When the switch is configured as a DHCP server to dynamically assign IP addresses to clients, the switch will deploy ping tests to avoid IP address conflicts resulted from assigning IP addresses repeatedly. |
Ping Timeout |
Specify the timeout period for ping tests in milliseconds. It ranges from 100 to 10000 ms, and the default is 100 ms. The DHCP server broadcasts an ICMP Echo Request (ping packet) to test whether an IP address is occupied or not. If there is no response within the timeout period, the server will broadcast the ping packet again. If the number of ping packets reaches the specified number without response, the server will assign the IP address. Otherwise, the server will record the IP address as a conflicted one and assign another IP address to the client. |
3)In the Excluded IP Address Config section, click to load the following page to specify the IP addresses that should not be assigned to the clients.
Figure 2-2 Configure Excluded IP Address
Enter the Starting IP Address and Ending IP Address to specify the range of reserved IP addresses. Click Create.
Starting IP Address/ Ending IP Address |
Specify the starting IP address and ending IP address of the excluded IP address range. If the starting IP address and ending IP address are the same, the server excludes only one IP address. When configuring DHCP Server, you need to reserve certain IP addresses for each subnet, such as the default gateway address, broadcast address and DNS server address. |
2.1.2Configuring DHCP Server Pool
DHCP Server Pool defines the parameters that will be assigned to DHCP clients.
Choose the menu L3 FEATURES > DHCP Service >DHCP Server > Pool Setting and click to load the following page.
Figure 2-3 Pool Setting
Configure the parameters for DHCP Server Pool. Then click Create.
Pool Name |
Specify a pool name for identification. |
Network Address / Subnet Mask |
Configure the network address and subnet mask of the DHCP server pool. The network address and subnet mask decide the range of the DHCP server pool. On the same subnet, all addresses can be assigned except the excluded addresses and addresses for special uses. |
Lease Time |
Specify how long the client can use the IP address assigned from this address pool. It ranges from 1 to 2880 minutes, and the default is 120 minutes. |
Default Gateway |
(Optional) Configure the default gateway of the DHCP server pool. You can create up to 8 default gateways for each DHCP server pool. If you leave this field blank, the DHCP server will not assign this parameter to clients. In general, you can configure the IP address of the VLAN interface as the default gateway address. |
DNS Server |
(Optional) Specify the DNS server of the DHCP server pool. You can specify up to 8 DNS servers for each DHCP server pool. If you leave this field blank, the DHCP server will not assign this parameter to clients. In general, you can configure the IP address of the VLAN interface as the DNS server address. |
NetBIOS Server |
(Optional) Specify the NetBIOS name server. You can specify up to 8 NetBIOS servers for each DHCP server pool. If you leave this field blank, the DHCP server will not assign this parameter to clients. When a DHCP client uses the Network NetBIOS (Basic Input Output System) protocol for communication, the host name must be mapped to IP address. NetBIOS name server can resolve host names to IP addresses. |
NetBIOS Node Type |
(Optional) Specify the NetBIOS type for clients, which is the way of inquiring IP address resolution. If you leave this field blank, the DHCP server will not assign this parameter to clients. The following options are provided: b-node Broadcast: The client sends query messages via broadcast. p-node Peer-to-Peer: The client sends query messages via unicast. m-node Mixed: The client sends query messages via broadcast first. If it fails, the client will try again via unicast. h-node Hybrid: The client sends query messages via unicast first. If it fails, the client will try again via broadcast. |
Next Server Address |
(Optional) Specify the IP address of a TFTP server for clients. If needed, clients can get the configuration file from the TFTP server for auto installation. If you leave this field blank, the DHCP server will not assign this parameter to clients. |
Domain Name |
(Optional) Specify the domain name that clients should use when resolving host names via DNS. If you leave this field blank, the DHCP server will not assign this parameter to clients. |
Bootfile |
(Optional) Specify the name of the bootfile. If needed, clients can get the bootfile from the TFTP server for auto installation. If you leave this field blank, the DHCP server will not assign this parameter to clients. |
2.1.3Configuring Manual Binding
Some devices like web servers require static IP addresses. To meet this requirement, you can manually bind the MAC address or client ID of the device to an IP address, and the DHCP server will reserve the bound IP address to this device at all times.
Choose the menu L3 FEATURES > DHCP Service >DHCP Server > Manual Binding and click to load the following page.
Figure 2-4 Manual Binding
Select a pool name and enter the IP address to be bound. Select a binding mode and finish the configuration accordingly. Click Create.
Pool Name |
Select a DHCP server pool from the drop-down list. |
IP Address |
Enter the IP address to be bound to the client. |
Binding Mode |
Select the binding mode: Client ID: Bind the IP address to the client ID of the client. Client ID in ASCII: Bind the IP address to the client ID in ASCII format. Hardware Address: Bind the IP address to the MAC address of the client. |
Client ID |
If you select Client ID as the binding mode, enter the client ID in this field. |
Hardware Address |
If you select Hardware Address as the binding mode, enter the MAC address in this field. |
Hardware Type |
If you select Hardware Address as the binding mode, select a hardware type. The hardware type includes Ethernet and IEEE802. |
2.2Using the CLI
2.2.1Enabling DHCP Server
Follow these steps to enable DHCP Server and to configure ping packets and ping timeout.
Step 1 |
configure Enter Global Configuration Mode. |
Step 2 |
service dhcp server Enable DHCP Server. |
Step 3 |
ip dhcp server extend-option vendor-class-id vendor (Optional) Specify the Option 60 for server identification. If a client requests Option 60, the server will respond a packet containing the Option 60 configured here. And then the client will compare the received Option 60 with its own. If they are the same, the client will accept the IP address assigned by the server. Otherwise, the assigned IP address will not be accepted. vendor: Specify the Option 60 with 1 to 64 characters. |
Step 4 |
ip dhcp server extend-option capwap-ac-ip ip-address (Optional) Specify the Option 138, which should be configured as the management IP address of an AC (Access Control) device. If the APs (Access Points) in the local network request this option, the server will respond a packet containing this option to inform the APs of the AC’s IP address. ip-address: Specify the IP address of the AC device that controls the APs. |
Step 5 |
ip dhcp server ping timeout value Specify the timeout period for ping tests. The DHCP server broadcasts an ICMP Echo Request (ping packet) to test whether an IP address is occupied or not. If there is no response within the timeout period, the server will broadcast the ping packet again. If the number of ping packets reaches the specified number without response, the server will assign the IP address. Otherwise, the server will record the IP address as a conflicted IP address and assign another IP address to the client. value: Specify the timeout period for ping tests in milliseconds. It ranges from 100 to 10000 ms, and the default is 100 ms. |
Step 6 |
ip dhcp server ping packets num Specify the number of ping packets the server can broadcast to test whether the IP address is occupied. When the switch is configured as a DHCP server to dynamically assign IP addresses to clients, the switch will deploy ping tests to avoid IP address conflicts resulted from assigning IP addresses repeatedly. num: Enter the number of ping packets. The valid values are from 1 to 10, and the default is 1. |
Step 7 |
ip dhcp server exclude-address start-ip-address end-ip-address Specify the starting IP address and ending IP address of the excluded IP address range. If the starting IP address and the ending IP address are the same, the server excludes only one IP address. When configuring DHCP Server, you need to reserve certain IP addresses for each subnet, such as default gateway address, broadcast address and DNS server address. start-ip-address/end-ip-address: Specify the starting IP address and ending IP address. |
Step 8 |
show ip dhcp server status Verify the DHCP status, including whether it is enabled and the configuration of ping packet number and ping packet timeout. |
Step 9 |
show ip dhcp server extend-option Verify the configuration of the extended options. |
Step 10 |
show ip dhcp server excluded-address Verify the configuration of the excluded IP address. |
Step 11 |
end Return to Privileged EXEC Mode. |
Step 12 |
copy running-config startup-config Save the settings in the configuration file. |
The following example shows how to enable DHCP Server globally on the switch, configure the number of ping packets as 2 and configure the timeout period for ping tests as 200 ms:
Switch#configure
Switch(config)#service dhcp server
Switch(config)#ip dhcp server ping packets 2
Switch(config)#ip dhcp server ping timeout 200
Switch(config)#show ip dhcp server status
DHCP server is enable.
Ping packet number: 2.
Ping packet timeout: 200 milliseconds.
Switch(config)#end
Switch#copy running-config startup-config
The following example shows how to configure the Option 60 as abc and Option 138 as 192.168.0.155:
Switch#configure
Switch(config)#ip dhcp server extend-option vendor-class-id abc
Switch(config)#ip dhcp server extend-option capwap-ac-ip 192.168.0.155
Switch(config)#show ip dhcp server extend-option
Option 60: abc
Option 138: 192.168.0.155
Switch(config)#end
Switch#copy running-config startup-config
The following example shows how to configure the 192.168.1.1 as the default gateway address and excluded IP address:
Switch#configure
Switch(config)#ip dhcp server excluded-address 192.168.1.1 192.168.1.1
Switch(config)#show ip dhcp server excluded-address
No. Start IP Address End IP Address
--- ------------- --------------
1 192.168.1.1 192.168.1.1
Switch(config)#end
Switch#copy running-config startup-config
2.2.2Configuring DHCP Server Pool
Follow these steps to configure DHCP server pool:
Step 1 |
configure Enter Global Configuration Mode. |
Step 2 |
ip dhcp server pool pool-name Configure a name for the DHCP server pool for identification. pool-name: Specify a pool name with 1 to 8 characters. |
Step 3 |
network network-address subnet-mask Configure the network address and subnet mask of the DHCP server pool. The network address and subnet mask decide the range of the DHCP server pool. On the same subnet, all addresses can be assigned except the excluded addresses and addresses for special uses. network-address: Configure the network address of the DHCP server pool. subnet-mask: Configure the subnet mask of the DHCP server pool. |
Step 4 |
lease lease-time Specify how long the client can use the IP address assigned from this address pool. lease-time: Enter the value of lease-time. It ranges from 1 to 2880 minutes, and the default is 120 minutes. |
Step 5 |
default-gateway gateway-list (Optional) Configure the default gateway of the DHCP server pool. In general, you can configure the IP address of the VLAN interface as the default gateway address. gateway-list: Specify the IP address of the default gateway. You can create up to 8 default gateways for each DHCP server pool. |
Step 6 |
dns-server dns-server-list (Optional) Specify the DNS server of the DHCP server pool. In general, you can configure the IP address of the VLAN interface as the DNS server address. dns-server-list: Specify the IP address of the DNS server. You can specify up to 8 DNS servers for each DHCP server pool. |
Step 7 |
netbios-name-server NBNS-list (Optional) Specify the NetBIOS name server. You can specify up to 8 NetBIOS servers for each DHCP server pool. When a DHCP client uses the Network NetBIOS (Basic Input Output System) protocol for communication, the host name must be mapped to IP address. NetBIOS name server can resolve host names to IP addresses. NBNS-list: Specify the IP address of the NetBIOS server. You can specify up to 8 NetBIOS servers for each DHCP server pool. |
Step 8 |
netbios-node-type type (Optional) Specify the NetBIOS type for the clients, which is the way of inquiring IP address resolution. type: Specify the NetBIOS type. The following options are provided: b-node: The client sends query messages via broadcast. p-node: The client sends query messages via unicast. m-node: The client sends query messages via broadcast first. If it fails, the client will try again via unicast. h-node: The client sends query messages via unicast first. If it fails, the client will try again via broadcast. |
Step 9 |
next-server ip-address (Optional) Specify the IP address of a TFTP server for the clients. If needed, the clients can get the configuration file from the TFTP server for auto installation. ip-address: Specify the IP address of the TFTP server. |
Step 10 |
domain-name domainname (Optional) Specify the domain name that the clients should use when resolving host names via DNS. domainname: Specify the domain name with up to 200 characters. |
Step 11 |
bootfile file-name (Optional) Specify the name of the bootfile. If needed, the clients can get the bootfile from the TFTP server for auto installation. file-name: Specify the bootfile name with up to 128 characters. |
Step 12 |
show ip dhcp server pool Verify the configuration of the DHCP server pool. |
Step 13 |
end Return to Privileged EXEC Mode. |
Step 14 |
copy running-config startup-config Save the settings in the configuration file. |
The following example shows how to create a DHCP server pool with the parameters shown in Table 2-1.
Table 2-1Parameters for the DHCP Server Pool
Parameter |
Value |
Pool Name |
pool 1 |
Network Address |
192.168.1.0 |
Subnet Mask |
255.255.255.0 |
Lease Time |
180 minutes |
Default Gateway |
192.168.1.1 |
DNS Server |
192.168.1.4 |
NetBIOS Server |
192.168.1.19 |
NetBIOS Node Type |
B-node (Broadcast) |
TFTP server |
192.168.1.30 |
Domain Name |
com |
Bootfile |
bootfile |
Switch#configure
Switch(config)#ip dhcp server pool pool1
Switch(dhcp-config)#network 192.168.1.0 255.255.255.0
Switch(dhcp-config)#lease 180
Switch(dhcp-config)#default-gateway 192.168.1.1
Switch(dhcp-config)#dns-server 192.168.1.4
Switch(dhcp-config)#netbios-name-server 192.168.1.19
Switch(dhcp-config)#netbios-node-type b-node
Switch(dhcp-config)#next server 192.168.1.30
Switch(dhcp-config)#domain-name com
Switch(dhcp-config)#bootfile bootfile
Switch(dhcp-config)#show ip dhcp server pool
Pool Name: pool1
Network Address: 192.168.1.0
Subenet Mask: 255.255.255.0
Lease Time: 180
Default Gateway: 192.168.1.1
DNS Server: 192.168.1.4
Netbios Server: 192.168.1.19
Netbios Node Type: b-node
Next Server Address: 192.168.1.30
Domain Name: com
Bootfile Name: bootfile
Switch(dhcp-config)#end
Switch#copy running-config startup-config
2.2.3Configuring Manual Binding
Some hosts, WWW server for example, requires a static IP address. To satisfy this requirement, you can manually bind the MAC address or client ID of the host to an IP address, and the DHCP server will reserve the bound IP address to this host at all times.
Follow these steps to configure Manual Binding:
Step 1 |
configure Enter Global Configuration Mode. |
Step 2 |
ip dhcp server pool name Create a DHCP server pool and enter DHCP Configuration Mode. |
Step 3 |
Bind an IP address to a client: address ip-address client-identifier client-id Bind the specified IP address to the client with a specific hexadecimal client ID. ip-address: Specify the IP address to be bound. client-id: Specify the client ID in hexadecimal format. address ip-address client-identifier client-id ascii Bind the specified IP address to the client with a specific ASCII client ID. ip-address: Specify the IP address to be bound. client-id: Specify the client ID with ASCII characters. address ip-address hardware-address hardware-address hardware-type { ethernet | ieee802 } Bind the specified IP address to the client with a specific MAC address. ip-address: Specify the IP address to be bound. hardware-address: Enter the MAC address of the client. ethernet | ieee802: Specify a hardware type for the client, either Ethernet or IEEE802. |
Step 4 |
show ip dhcp server manual-binding Verify the manual binding configuration. |
Step 5 |
end Return to Privileged EXEC Mode. |
Step 6 |
copy running-config startup-config Save the settings in the configuration file. |
The following example shows how to bind the IP address 192.168.1.33 in pool1 (on the subnet of 192.168.1.0) to the host with the MAC address 74:D4:68:22:3F:34:
Switch#configure
Switch(config)#ip dhcp server pool pool1
Switch(dhcp-config)#address 192.168.1.33 hardware-address 74:d4:68:22:3f:34 hardware-type ethernet
Switch(dhcp-config)#show ip dhcp server manual-binding
Pool Name Client Id/Hardware Address IP Address Hardware Type Bind Mode
------- ------------------- --------- ----------- --------
pool1 74:d4:68:22:3f:34 192.168.1.33 Ethernet MAC Address
Switch(dhcp-config)#end
Switch#copy running-config startup-config
To complete DHCP Relay configuration, follow these steps:
1)Enable DHCP Relay. Configure Option 82 if needed.
2)Specify DHCP server for the Interface or VLAN.
3.1.1Enabling DHCP Relay and Configuring Option 82
Choose the menu L3 FEATURES > DHCP Service > DHCP Relay > DHCP Relay Config to load the following page.
Figure 3-1 Enable DHCP Relay and Configure Option 82
Follow these steps to enable DHCP Relay and configure Option 82:
1)In the Global Config section, enable DHCP Relay globally and configure the relay hops and time threshold. Click Apply.
DHCP Relay |
Enable DHCP Relay globally. |
DHCP Relay Hops |
Specify the DHCP relay hops. DHCP Relay Hops defines the maximum number of hops (DHCP Relay agent) that the DHCP packets can be relayed. If a packet’s hop count is more than the value you set here, the packet will be dropped. |
DHCP Relay Time Threshold |
Specify the threshold of the DHCP relay time. The valid values are from 0 to 65535 seconds. DHCP relay time is the time elapsed since the client began address acquisition or renewal process. There is a field in DHCP packets which specially records this time, and the switch will drop the packets if the value of this field is greater than the threshold. Value 0 means the switch will not examine this field of the DHCP packets. |
2)(Optional) In the Option 82 Config section, configure Option 82.
Option 82 Support |
Select whether to enable Option 82 or not. Enable it if you want to prevent DHCP client requests from untrusted sources, or assign different IP addresses to clients in different groups from the same DHCP server. |
Option 82 Policy |
Select the operation for the switch to take when receiving DHCP packets that include the Option 82 field. Keep: The switch keeps the Option 82 field of the packets. Replace: The switch replaces the Option 82 field of the packets with a new one. The switch presets a default circuit ID and remote ID in TLV (Type, Length, and Value) format. You can also configure the format to include Value only and customize the Value. Drop: The switch discards the packets that include the Option 82 field. |
Format |
Specify the packet format for the sub-option fields of Option 82. Normal: Indicates the fields consist of three parts: Type, Length, and Value (TLV). Private: Indicates the fields consist of the value only. |
Circuit ID Customization |
Enable or disable Circuit ID Customization. Enable it if you want to manually configure the circuit ID. Otherwise, the switch uses the default one when inserting Option 82 to DHCP packets. The default circuit ID is a 4-byte value which consists of 2-byte VLAN ID and 2-byte Port ID. The VLAN ID indicates which VLAN the DHCP client belongs to, and the Port ID indicates which port the DHCP client is connected to. For example, if the DHCP client is connected to port 1/0/1 in VLAN 2, this field is 00:02:00:01 in hexadecimal. |
Circuit ID |
Enter the customized circuit ID with up to 64 characters. The circuit ID configurations of the switch and the DHCP server should be compatible with each other. |
Remote ID Customization |
Enable or disable Remote ID Customization. Enable it if you want to manually configure the remote ID. Otherwise, the switch uses its own MAC address as the remote ID. |
Remote ID |
Enter the customized remote ID with up to 64 characters. The remote ID configurations of the switch and the DHCP server should be compatible with each other. |
3)Click Apply.
3.1.2Configuring DHCP Interface Relay
DHCP Interface Relay allows clients to obtain IP addresses from a DHCP server in a different subnet.
Choose the menu L3 FEATURES > DHCP Service > DHCP Relay > DHCP Interface Relay and click to load the following page.
Figure 3-2 Configuring DHCP Interface Relay
Select the interface type and enter the interface ID, then enter the IP address of the DHCP server. Click Create.
Interface ID |
Specify the type and ID of the interface. It is the Layer 3 interface which is connecting to the DHCP clients. The interface should be an existing Layer 3 interface. |
Server Address |
Enter the IP address of the DHCP server. |
3.1.3Configuring DHCP VLAN Relay
DHCP VLAN Relay allows clients in different VLANs to obtain IP addresses from a DHCP server using the IP address of a single agent interface. It is often used when the relay switch does not support configuring multiple Layer 3 interfaces.
Choose the menu L3 FEATURES > DHCP Service > DHCP Relay > DHCP VLAN Relay to load the following page.
Figure 3-3 Configure DHCP VLAN Relay
Follow these steps to specify DHCP Server for the specific VLAN:
1)In the Default Relay Agent Interface section, specify a Layer 3 interface as the default relay agent interface. Then click Apply.
Interface ID |
Specify the type and ID of the interface that needs to be configured as the default relay agent interface. You can configure any existing Layer 3 interface as the default relay-agent interface. The DHCP server will assign IP addresses in the same subnet with this relay agent interface to the clients who use this relay-agent interface to apply for IP addresses. |
IP Address |
Displays the IP address of this interface. |
Note: ●If the VLAN the clients belong to already has an IP address, the switch will use the client’s own VLAN interface as the relay-agent interface. The manually specified default relay agent will not take effect. ●DHCP VLAN Relay will not work on routed ports or port channel interfaces, because they are not associated with any particular VLAN. |
2)In the DHCP VLAN Relay Config section, click to load the configuration page.
Figure 3-4 Specify a DHCP server for the VLAN
Specify the VLAN the clients belong to and the server address. Click Create.
VLAN ID |
Specify the VLAN in which the clients can get IP addresses from the DHCP server. |
Server Address |
Enter the IP address of the DHCP server. |
3.2.1Enabling DHCP Relay
Follow these steps to enable DHCP Relay and configure the corresponding parameters:
Step 1 |
configure Enter Global Configuration Mode. |
Step 2 |
service dhcp relay Enable DHCP Relay. |
Step 3 |
ip dhcp relay hops hops Specify the maximum hops (DHCP relay agent) that the DHCP packets can be relayed. If a packet’s hop count is more than the value you set here, the packet will be dropped. hops: Specify the maximum hops for DHCP packets. Valid values are from the 1 to 16, and the default value is 4. |
Step 4 |
ip dhcp relay time time Specify the threshold for the DHCP relay time. DHCP relay time is the time elapsed since the client began address acquisition or renewal process. There is a field in DHCP packets which specially records this time, and the switch will drop the packets if the value of this field is greater than the threshold. Value 0 means the switch will not examine this field of the DHCP packets. time: Specify the threshold for the DHCP relay time. Valid values are from 1 to 65535. By default, the value is 0, which means the switch will not examine this field of the DHCP packets. |
Step 5 |
show ip dhcp relay Verify the configuration of DHCP Relay. |
Step 6 |
end Return to Privileged EXEC Mode. |
Step 7 |
copy running-config startup-config Save the settings in the configuration file. |
The following example shows how to enable DHCP Relay, configure the relay hops as 5 and configure the relay time as 10 seconds :
Switch#configure
Switch(config)#service dhcp relay
Switch(config)#show ip dhcp relay
Switch(config)#ip dhcp relay hops 5
Switch(config)#ip dhcp relay time 10
DHCP relay state: enabled
DHCP relay hops: 5
DHCP relay Time Threshold: 10 seconds
...
Switch(config)#end
Switch#copy running-config startup-config
3.2.2(Optional) Configuring Option 82
Follow these steps to configure Option 82:
Step 1 |
configure Enter Global Configuration Mode. |
Step 2 |
interface { fastEthernet port | range fastEthernet port-list | gigabitEthernet port | range gigabitEthernet port-list | ten-gigabitEthernet port | range ten-gigabitEthernet port-list } Enter Interface Configuration Mode. |
Step 3 |
ip dhcp relay information option Enable the Option 82 feature on the port. |
Step 4 |
ip dhcp relay information strategy { keep | replace | drop } Specify the operation for the switch to take when receiving DHCP packets that include the Option 82 field. keep: The switch keeps the Option 82 field of the packets. replace: The switch replaces the Option 82 field of the packets with a new one. The switch presets a default circuit ID and remote ID in TLV (Type, Length, and Value) format. You can also configure the format to include Value only and customize the Value. drop: The switch discards the packets that include the Option 82 field. |
Step 5 |
ip dhcp relay information format { normal | private } Specify the packet format for the sub-option fields of Option 82. normal: Indicates the fields consist of three parts: Type, Length, and Value (TLV). private: Indicates the fields consist of the value only. |
Step 6 |
ip dhcp relay information circuit-id string (Optional) A default circuit ID is preset on the switch, and you can also run this command to customize the circuit ID. The circuit ID configurations of the switch and the DHCP server should be compatible with each other. The default circuit ID is a 4-byte value which consists of 2-byte VLAN ID and 2-byte Port ID. The VLAN ID indicates which VLAN the DHCP client belongs to, and the Port ID indicates which port the DHCP client is connected to. For example, if the DHCP client is connected to port 1/0/1 in VLAN 2, this field is 00:02:00:01 in hexadecimal. string: Enter the customized circuit ID with up to 64 characters. |
Step 7 |
ip dhcp relay information remote-id string (Optional) The switch uses its own MAC address as the default remote ID, and you can also run this command to customize the remote ID. The remote ID configurations of the switch and the DHCP server should be compatible with each other. string: Enter the remote ID with up to 64 characters. |
Step 8 |
show ip dhcp relay information interface { fastEthernet port | gigabitEthernet port | ten-gigabitEthernet port | port-channel port-channel-id } Verify the Option 82 configurations of the port. |
Step 9 |
end Return to Privileged EXEC Mode. |
Step 10 |
copy running-config startup-config Save the settings in the configuration file. |
The following example shows how to enable Option 82 on port 1/0/7 and configure the strategy as replace, the format as normal, the circuit-id as VLAN20 and the remote-id as Host1:
Switch#configure
Switch(config)#interface gigabitEthernet 1/0/7
Switch(config-if)#ip dhcp relay information option
Switch(config-if)#ip dhcp relay information strategy replace
Switch(config-if)#ip dhcp relay information format normal
Switch(config-if)#ip dhcp relay information circut-id VLAN20
Switch(config-if)#ip dhcp relay information remote-id Host1
Switch(config-if)#show ip dhcp relay information interface gigabitEthernet 1/0/7
Interface Option 82 Status Operation Strategy Format Circuit ID Remote ID LAG
--------- ---------------- ------------------ ------- --------- -------- -----
Gi1/0/7 Enable Replace Normal VLAN20 Host1 N/A
Switch(config-if)#end
Switch#copy running-config startup-config
3.2.3Configuring DHCP Interface Relay
You can specify a DHCP server for a Layer 3 interface or for a VLAN. The following introduces how to configure DHCP Interface Relay and DHCP VLAN Relay, respectively.
Follow these steps to DHCP Interface Relay:
Step 1 |
configure Enter Global Configuration Mode. |
Step 2 |
Enter Layer 3 Interface Configuration Mode: Enter VLAN Interface Configuration Mode: interface vlan vlan-id vlan-id: Specify an IEEE 802.1Q VLAN ID that already exists, ranging from 1 to 4094. Enter Routed Port Configuration Mode: interface { fastEthernet port | gigabitEthernet port | ten-gigabitEthernet port } Enter Interface Configuration Mode. port: Specify the Ethernet port number, for example, 1/0/1. no switchport Switch the Layer 2 port into the Layer 3 routed port. Enter Port-channel Interface Configuration Mode: interface { port-cahnnel port-channel } Enter Interface Configuration Mode. port-channel: Specify the port channel. Valid values are from 1 to 14. no switchport Switch the port channel to a Layer 3 port channel interface. |
Step 3 |
ip helper-address ip-addr Specify DHCP server for the Layer 3 interface. ip-addr: Enter the IP address of the DHCP server. |
Step 4 |
show ip dhcp relay Verify the configuration of DHCP Relay. |
Step 5 |
end Return to Privileged EXEC Mode. |
Step 6 |
copy running-config startup-config Save the settings in the configuration file. |
The following example shows how to configure the DHCP server address as 192.168.1.7 on VLAN interface 66:
Switch#configure
Switch(config)#interface vlan 66
Switch(config-if)#ip helper-address 192.168.1.7
Switch(config-if)#show ip dhcp relay
...
DHCP relay helper address is configured on the following interfaces:
Interface Helper address
---------- --------------
VLAN 66 192.168.1.7
Switch(config-if)#end
Switch#copy running-config startup-config
3.2.4Configuring DHCP VLAN Relay
Follow these steps to configure DHCP VLAN Relay:
Step 1 |
configure Enter Global Configuration Mode. |
Step 2 |
Enter Layer 3 Interface Configuration Mode: Enter VLAN Interface Configuration Mode: interface vlan vlan-id vlan-id: Specify an IEEE 802.1Q VLAN ID that already exists, ranging from 1 to 4094. Enter Routed Port Configuration Mode: interface { fastEthernet port | gigabitEthernet port | ten-gigabitEthernet port } Enter Interface Configuration Mode. port: Specify the Ethernet port number, for example, 1/0/1. no switchport Switch the Layer 2 port into the Layer 3 routed port. Enter Port-channel Interface Configuration Mode: interface { port-cahnnel port-channel } Enter Interface Configuration Mode. port-channel: Specify the port channel. Valid values are from 1 to 14. no switchport Switch the port channel to a Layer 3 port channel interface. |
Step 3 |
ip dhcp relay default-interface Set the interface as the default relay-agent interface. If the VLAN that the clients belong to does not have an IP address, the switch will use the IP address of this interface to fill in the Relay Agent IP Address field of DHCP packets from the DHCP clients. |
Step 4 |
exit Return to Global Configuration Mode. |
Step 5 |
ip dhcp relay vlan vid helper-address ip-address Specify the VLAN ID and the DHCP server. vid: Enter the ID of the VLAN, in which the hosts can dynamically get the IP addresses from the DHCP server. ip-address: Enter the IP address of the DHCP server. |
Step 6 |
show ip dhcp relay Verify the configuration of DHCP Relay. |
Step 7 |
end Return to Privileged EXEC Mode. |
Step 8 |
copy running-config startup-config Save the settings in the configuration file. |
The following example shows how to set the routed port 1/0/2 as the default relay agent interface and configure the DHCP server address as 192.168.1.8 on VLAN 10:
Switch#configure
Switch(config)#interface gigabitEthernet 1/0/2
Switch(config-if)#no switchport
Switch(config-if)# ip dhcp relay default-interface
Switch(config-if)#exit
Switch(config)#ip dhcp relay vlan 10 helper-address 192.168.1.8
Switch(config)#show ip dhcp relay
...
DHCP VLAN relay helper address is configured on the following vlan:
vlan Helper address
---------- --------------
VLAN 10 192.168.1.8
Switch(config)#end
Switch#copy running-config startup-config
To complete DHCP L2 Relay configuration, follow these steps:
1)Enable DHCP L2 Relay.
2)Configure Option 82 for ports.
4.1.1Enabling DHCP L2 Relay
Choose the menu L3 FEATURES > DHCP Service > DHCP L2 Relay > Global Config to load the following page.
Figure 4-1 Enable DHCP L2 Relay
Follow these steps to enable DHCP L2 Relay globally for the specified VLAN:
1)In the Global Config section, enable DHCP L2 Relay globally. Click Apply.
DHCP L2 Relay |
Enable DHCP Relay globally. |
2)In the VLAN Config section, enable DHCP L2 Relay for the specified VLAN. Click Apply.
VLAN |
Displays the VLAN ID. |
Status |
Enable DHCP L2 Relay for the specified VLAN. |
4.1.2Configuring Option 82 for Ports
Choose the menu L3 FEATURES > DHCP Service > DHCP L2 Relay > Port Config to load the following page.
Figure 4-2 Configure Option 82 for Ports
Follow these steps to enable DHCP Relay and configure Option 82:
1)Select one or more ports to configure Option 82.
Option 82 Support |
Select whether to enable Option 82 or not. Enable it if you want to prevent DHCP client requests from untrusted sources, or assign different IP addresses to clients in different groups from the same DHCP server. |
Option 82 Policy |
Select the operation for the switch to take when receiving DHCP packets that include the Option 82 field. Keep: The switch keeps the Option 82 field of the packets. Replace: The switch replaces the Option 82 field of the packets with a new one. The switch presets a default circuit ID and remote ID in TLV (Type, Length, and Value) format. You can also configure the format to include Value only and customize the Value. Drop: The switch discards the packets that include the Option 82 field. |
Format |
Specify the packet format for the sub-option fields of Option 82. Normal: Indicates the fields consist of three parts: Type, Length, and Value (TLV). Private: Indicates the fields consist of the value only. |
Circuit ID Customization |
Enable or disable Circuit ID Customization. Enable it if you want to manually configure the circuit ID. Otherwise, the switch uses the default one when inserting Option 82 to DHCP packets. The default circuit ID is a 4-byte value which consists of 2-byte VLAN ID and 2-byte Port ID. The VLAN ID indicates which VLAN the DHCP client belongs to, and the Port ID indicates which port the DHCP client is connected to. For example, if the DHCP client is connected to port 1/0/1 in VLAN 2, this field is 00:02:00:01 in hexadecimal. |
Circuit ID |
Enter the customized circuit ID with up to 64 characters. The circuit ID configurations of the switch and the DHCP server should be compatible with each other. |
Remote ID Customization |
Enable or disable Remote ID Customization. Enable it if you want to manually configure the remote ID. Otherwise, the switch uses its own MAC address as the remote ID. |
Remote ID |
Enter the customized remote ID with up to 64 characters. The remote ID configurations of the switch and the DHCP server should be compatible with each other. |
2)Click Apply.
4.2.1Enabling DHCP L2 Relay
Follow these steps to enable DHCP L2 Relay:
Step 1 |
configure Enter Global Configuration Mode. |
Step 2 |
ip dhcp l2relay Enable DHCP L2 Relay. |
Step 3 |
ip dhcp l2relay vlan valn-list Enable DHCP L2 Relay for specified VLANs. vlan-list: Specify the vlan to be enabled with DHCP L2 relay. |
Step 5 |
show ip dhcp l2relay Verify the configuration of DHCP Relay. |
Step 6 |
end Return to Privileged EXEC Mode. |
Step 7 |
copy running-config startup-config Save the settings in the configuration file. |
The following example shows how to enable DHCP L2 Relay globally and for VLAN 2:
Switch#configure
Switch(config)#ip dhcp l2relay
Switch(config)#ip dhcp l2relay vlan 2
Switch(config)#show ip dhcp l2relay
Global Status: Enable
VLAN ID: 2
Switch(config)#end
Switch#copy running-config startup-config
4.2.2Configuring Option 82 for Ports
Follow these steps to configure Option 82:
Step 1 |
configure Enter Global Configuration Mode. |
Step 2 |
interface { fastEthernet port | range fastEthernet port-list | gigabitEthernet port | range gigabitEthernet port-list | ten-gigabitEthernet port | range ten-gigabitEthernet port-list } Enter Interface Configuration Mode. |
Step 3 |
ip dhcp l2relay information option Enable the Option 82 feature on the port. |
Step 4 |
ip dhcp l2relay information strategy { keep | replace | drop } Specify the operation for the switch to take when receiving DHCP packets that include the Option 82 field. keep: The switch keeps the Option 82 field of the packets. replace: The switch replaces the Option 82 field of the packets with a new one. The switch presets a default circuit ID and remote ID in TLV (Type, Length, and Value) format. You can also configure the format to include Value only and customize the Value. drop: The switch discards the packets that include the Option 82 field. |
Step 5 |
ip dhcp l2relay information format { normal | private } Specify the packet format for the sub-option fields of Option 82. normal: Indicates the fields consist of three parts: Type, Length, and Value (TLV). private: Indicates the fields consist of the value only. |
Step 6 |
ip dhcp l2relay information circuit-id string (Optional) A default circuit ID is preset on the switch, and you can also run this command to customize the circuit ID. The circuit ID configurations of the switch and the DHCP server should be compatible with each other. The default circuit ID is a 4-byte value which consists of 2-byte VLAN ID and 2-byte Port ID. The VLAN ID indicates which VLAN the DHCP client belongs to, and the Port ID indicates which port the DHCP client is connected to. For example, if the DHCP client is connected to port 1/0/1 in VLAN 2, this field is 00:02:00:01 in hexadecimal. string: Enter the customized circuit ID with up to 64 characters. |
Step 7 |
ip dhcp l2relay information remote-id string (Optional) The switch uses its own MAC address as the default remote ID, and you can also run this command to customize the remote ID. The remote ID configurations of the switch and the DHCP server should be compatible with each other. string: Enter the remote ID with up to 64 characters. |
Step 8 |
show ip dhcp l2relay information interface { fastEthernet port | gigabitEthernet port | port-channel port-channel-id } Verify the Option 82 configuration of the port. |
Step 9 |
end Return to Privileged EXEC Mode. |
Step 10 |
copy running-config startup-config Save the settings in the configuration file. |
The following example shows how to enable Option 82 on port 1/0/7 and configure the strategy as replace, the format as normal, the circuit-id as VLAN20 and the remote-id as Host1:
Switch#configure
Switch(config)#interface gigabitEthernet 1/0/7
Switch(config-if)#ip dhcp l2relay information option
Switch(config-if)#ip dhcp l2relay information strategy replace
Switch(config-if)#ip dhcp l2relay information format normal
Switch(config-if)#ip dhcp l2relay information circut-id VLAN20
Switch(config-if)#ip dhcp l2relay information remote-id Host1
Switch(config-if)#show ip dhcp l2relay information interface gigabitEthernet 1/0/7
Interface Option 82 Status Operation Strategy Format Circuit ID Remote ID LAG
--------- ---------------- ------------------ ------- --------- -------- -----
Gi1/0/7 Enable Replace Normal VLAN20 Host1 N/A
Switch(config-if)#end
Switch#copy running-config startup-config
5.1Example for DHCP Server
5.1.1Network Requirements
As the network topology shows, the administrator uses the switch as the DHCP server to assign IP addresses to all the connected devices. The office computers need to obtain IP addresses dynamically, while the FTP server needs a fixed IP address.
Figure 5-1 Network Topology for DHCP Server
5.1.2Configuration Scheme
You can enable the DHCP Server service on the switch and create a DHCP IP pool for all the connected devices. Then manually bind the MAC address of the FTP server to an IP address specified for the FTP server.
Demonstrated with T2600G-52TS, the following sections provide configuration procedures in two ways: using the GUI and using the CLI.
5.1.3Using the GUI
1)Choose the menu L3 FEATURES > DHCP Service > DHCP Server > DHCP Server to load the following page. In the Global Config section, enable DHCP Server and click Apply.
Figure 5-2 Configuring DHCP Server
2)Choose the menu L3 FEATURES > DHCP Service > DHCP Server > Pool Setting and click to load the following page. Specify the Pool Name, Network Address, Subnet Mask, Lease Time, Default Gateway and DNS Server as shown below. Click Create.
Figure 5-3 Configuring DHCP Server Pool
3)Choose the menu L3 FEATURES > DHCP Service > DHCP Server > Manual Binding and click to load the following page. Select the DHCP server pool you just created, and enter the IP address of the FTP server in the IP Address field. Select Hardware Address as the binding mode, and enter the MAC address of the FTP server in the Hardware Address field. Select Ethernet as the Hardware Type. Click Create.
Figure 5-4 Configuring Manual Binding
4)Click to save the settings.
5.1.4Using the CLI
1)Enable DHCP Server.
Switch#configure
Switch(config)#service dhcp server
2)Specify the Pool Name, Network Address, Subnet Mask and Lease Time.
Switch(config)#ip dhcp server pool pool
Switch(dhcp-config)#network 192.168.0.0 255.255.255.0
Switch(dhcp-config)#lease 120
Switch(dhcp-config)#exit
3)Bind the specified IP address to the MAC address of the FTP server.
Switch(config)# ip dhcp server pool pool
Switch(dhcp-config)# address 192.168.0.8 hardware-address FC-AA-14-59-E9-4A hardware-type ethernet
Switch(dhcp-config)#end
Switch#copy running-config startup-config
Verify the Configuration
Switch#show ip dhcp server binding
IP Address Client id/Hardware Address Type Lease Time Left
---------- -------------------------- --------- ---------------
192.168.0.2 01-d43d-7ebf-615f Automatic 01:57:27
192.168.0.8 01-fcaa-1459-e94a Manual Infinite
5.2Example for DHCP Interface Relay
5.2.1Network Requirements
The administrator deploys one DHCP server on the network, and wants the server to assign IP addresses to the computers in the Marketing department and the R&D department. It is required that computers in the same department should be on the same subnet, while computers in different departments should be on different subnets.
After adding the DHCP server, the network topology will be as shown in Figure 5-5.The Marketing department and the R&D department belong to VLAN 10 and VLAN 20, respectively. The IP address of VLAN interface 10 is 192.168.2.1/24, and the IP address of VLAN interface 20 is 192.168.3.1/24. The DHCP server is connected to the routed port of the switch. The Marketing department is connected to port 1/0/1 of the relay agent, and the R&D department is connected to port 1/0/2 of the relay agent.
Figure 5-5 Network Topology for DHCP Interface Relay
5.2.2Configuration Scheme
In the given situation, the DHCP server and the computers are isolated in different network segments, so the DHCP requests from the clients cannot be directly forwarded to the DHCP server. To assign IP addresses in two different subnets to two departments respectively, we recommend you to configure DHCP Interface Relay to satisfy the requirement.
The overview of the configurations are as follows:
1)Before configuring DHCP Interface Relay, create two DHCP IP pools on the DHCP server for the two departments, respectively. Then create static routes or enable dynamic routing protocol like RIP on the DHCP server to make sure the DHCP server can reach the clients in the two VLANs.
2)Configure 802.1Q VLAN on the DHCP relay agent. Add all computers in the marketing department to VLAN 10, and add all computers in the R&D department to VLAN 20.
3)Create VLAN interfaces for VLAN 10 and VLAN 20 on the DHCP relay agent.
4)Configure DHCP Interface Relay on the DHCP relay agent. Enable DHCP Relay globally, and specify the DHCP server address for each VLAN.
In this example, the DHCP server is demonstrated with T2600G-52TS and the DHCP relay agent is demonstrated with T2600G-28TS. This section provides configuration procedures in two ways: using the GUI and using the CLI.
5.2.3Using the GUI
■Configuring the DHCP Server
1)Choose the menu L3 FEATURES > DHCP Service > DHCP Server > DHCP Server to load the following page. In the Global Config section, enable DHCP Server globally.
Figure 5-6 Configuring DHCP Server
2)Choose the menu L3 FEATURES > DHCP Service > DHCP Server > Pool Setting and click to load the following page. Create pool 1 for VLAN 10 and pool 2 for VLAN 20. Configure the corresponding parameters as the following pictures show.
Figure 5-7 Configuring DHCP Pool 1 for VLAN 10
Figure 5-8 Configuring DHCP Pool 2 for VLAN 20
3)Choose the menu L3 FEATURES > Static Routing > IPv4 Static Routing and click to load the following page. Create two static routing entries for the DHCP server to make sure that the DHCP server can reach the clients in the two VLANs.
Figure 5-9 Creating the Static Routing Entry for VLAN 10
Figure 5-10 Creating the Static Routing Entry for VLAN 20
■Configuring the VLANs on the Relay Agent
1)Choose the menu L2 FEATURES > VLAN > 802.1Q VLAN > VLAN Config and click to load the following page. Create VLAN 10 for the Marketing department and add port 1/0/1 as an untagged port to the VLAN.
Figure 5-11 Creating VLAN 10
2)On the same page, click again to create VLAN 20 for the R&D department and add port 1/0/2 as an untagged port to the VLAN.
Figure 5-12 Creating VLAN 20
■Configuring the VLAN Interface and Routed Port on the Relay Agent
1)Choose the menu L3 FEATURES > Interface and click to load the following page. Create VLAN interface 10 and VLAN interface 20. Configure port 1/0/5 as the routed port.
Figure 5-13 Creating VLAN Interface 10
Figure 5-14 Creating VLAN Interface 20
2)On the same page, click again to configure port 1/0/5 as the routed port.
Figure 5-15 Configuring the Routed Port
■Configuring DHCP Interface Relay on the Relay Agent
1)Choose the menu L3 FEATURES > DHCP Service > DHCP Relay > DHCP Relay Config to load the following page. In the Global Config section, enable DHCP Relay, and click Apply.
Figure 5-16 Enable DHCP Relay
2)Choose the menu L3 FEATURES > DHCP Service > DHCP Relay > DHCP Interface Relay and click to load the following page. Specify the DHCP server for the clients in VLAN 10 and VLAN 20.
Figure 5-17 Specify DHCP Server for Interface VLAN 10
Figure 5-18 Specify DHCP Server for Interface VLAN 20
3)Click to save the settings.
5.2.4Using the CLI
■Configurting the DHCP Server
1)Enable DHCP service globally.
Switch#configure
Switch(config)#service dhcp server
2)Create DHCP pool 1 and configure its network address as 192.168.2.0, subnet mask as 255.255.255.0, lease time as 120 minutes, default gateway as 192.168.2.1; Create DHCP pool 2 and configure its network address as 192.168.3.0, subnet mask as 255.255.255.0, lease time as 120 minutes, default gateway as 192.168.3.1.
Switch(config)#ip dhcp server pool pool1
Switch(dhcp-config)#network 192.168.2.0 255.255.255.0
Switch(dhcp-config)#lease 120
Switch(dhcp-config)#default-gateway 192.168.2.1
Switch(dhcp-config)#exit
Switch(config)#ip dhcp server pool pool2
Switch(dhcp-config)#network 192.168.2.0 255.255.255.0
Switch(dhcp-config)#lease 120
Switch(dhcp-config)#default-gateway 192.168.3.1
Switch(dhcp-config)#exit
3)Create two static routing entries to make sure that the DHCP server can reach the clients in the two VLANs.
Switch(config)# ip route 192.168.2.0 255.255.255.0 192.168.0.1
Switch(config)# ip route 192.168.3.0 255.255.255.0 192.168.0.1
Switch(config)#end
Switch#copy running-config startup-config
■Configuring the VLAN on the Relay Agent
Switch(config)# vlan 10
Switch(config-vlan)#name Marketing
Switch(config-vlan)#exit
Switch(config)#interface gigabitEthernet 1/0/1
Switch(config-if)#switchport general allowed vlan 10 untagged
Switch(config-if)#exit
Switch(config)# vlan 20
Switch(config-vlan)#name RD
Switch(config-vlan)#exit
Switch(config)#interface gigabitEthernet 1/0/2
Switch(config-if)#switchport general allowed vlan 20 untagged
Switch(config-if)#exit
■Configuring the VLAN Interfaces Routed Port on the Relay Agent
Switch(config)#interface vlan 10
Switch(config-if)#ip address 192.168.2.1 255.255.255.0
Switch(config-if)#exit
Switch(config)#interface vlan 20
Switch(config-if)#ip address 192.168.3.1 255.255.255.0
Switch(config-if)#exit
Switch(config)#interface gigabitEthernet 1/0/5
Switch(config-if)#ip address 192.168.0.1 255.255.255.0
Switch(config-if)#exit
■Configuring DHCP Interface Relay on the Relay Agent
1)Enable DHCP Relay.
Switch#configure
Switch(config)#service dhcp relay
2)Specify the DHCP server for the interface VLAN 10.
Switch(config)#interface vlan 10
Switch(config-if)#ip helper-address 192.168.0.59
Switch(config-if)#exit
3)Specify the DHCP server for interface VLAN 20
Switch(config)#interface vlan 20
Switch(config-if)#ip helper-address 192.168.0.59
Switch(config-if)#end
Switch#copy running-config startup-config
Verify the Configurations of the DHCP Relay Agent
Switch#show ip dhcp relay
DHCP relay is enabled
...
DHCP relay helper address is configured on the following interfaces:
Interface Helper address
--------------------- -------------------------
VLAN10 192.168.0.59
VLAN20 192.168.0.59
...
5.3Example for DHCP VLAN Relay
5.3.1Network Requirements
The administrator needs to deploy the office network for the Marketing department and the R&D department. The detailed requirements are listed below:
■The Marketing department and the R&D department belong to VLAN 10 and VLAN 20, respectively. Both of the VLANs have no Layer 3 gateways.
■Computers in the two departments need to obtain IP addresses from the same DHCP server.
The network topology designed by the administrator is shown below.
Figure 5-19 Network Topology for DHCP VLAN Relay
5.3.2Configuration Scheme
In the given situation, the DHCP server and the computers are isolated by VLANs, so the DHCP request from the clients cannot be directly forwarded to the DHCP server. Considering that the two VLANs have no Layer 3 gateways, we recommend you to configure DHCP VLAN Relay to satisfy the requirement.
The overview of the configurations are as follows:
1)Create one DHCP IP pool on the DHCP server, which is on 192.168.0.0/24 network segment.
2)Configure 802.1Q VLAN on the DHCP relay agent. Add all computers in the marketing department to VLAN 10, and add all computers in the R&D department to VLAN 20.
3)Configure DHCP VLAN Relay on the DHCP relay agent. Enable DHCP Relay globally, choose the VLAN interface 1 (the default management VLAN interface) as the default relay agent interface, and specify the DHCP server address for VLAN 10 and VLAN 20.
In this example, the DHCP server is demonstrated with T2600G-28TS and the DHCP relay agent is demonstrated with T2600G-52TS. The following sections provide configuration procedures in two ways: using the GUI and using the CLI.
5.3.3Using the GUI
■Configuring the DHCP Server
1)Choose the menu L3 FEATURES > DHCP Service > DHCP Server > DHCP Server to load the following page. In the Global Config section, enable DHCP Server globally.
Figure 5-20 Configuring DHCP Server
2)Choose the menu L3 FEATURES > DHCP Service > DHCP Server > Pool Setting and click to load the following page. Create a DHCP pool for the clients. Configure the corresponding parameters as the following picture shows.
Figure 5-21 Configuring DHCP Pool 1 for VLAN 10
■Configuring the VLANs on the Relay Agent
1)Choose the menu L2 FEATURES > VLAN > 802.1Q VLAN > VLAN Config and click to load the following page. Create VLAN 10 for the Marketing department and add port 1/0/1 as untagged port to the VLAN.
Figure 5-22 Creating VLAN 10
2)On the same page, click again to create VLAN 20 for the R&D department and add port 1/0/2 as untagged port to the VLAN.
Figure 5-23 Creating VLAN 20
■Configuring DHCP VLAN Relay on the Relay Agent
1)Choose the menu L3 FEATURES > DHCP Service > DHCP Relay > DHCP Relay Config to load the following page. In the Global Config section, enable DHCP Relay, and click Apply.
Figure 5-24 Enable DHCP Relay
2)Choose the menu L3 FEATURES > DHCP Service > DHCP Relay > DHCP VLAN Relay to load the following page. In the Default Relay Agent Interface section, specify VLAN interface 1 (the default management VLAN interface) as the default relay-agent interface. Click Apply.
Figure 5-25 Specify the Default Relay Agent Interface
3)Choose the menu L3 FEATURES > DHCP Service > DHCP Relay > DHCP VLAN Relay and click to load the following page. Specify the DHCP server address for the clients in VLAN 10 and VLAN 20.
Figure 5-26 Specify DHCP Server for Interface VLAN 10
Figure 5-27 Specify DHCP Server for Interface VLAN 20
4)Click to save the settings.
5.3.4Using the CLI
■Configurting the DHCP Server
1)Enable DHCP service globally.
Switch#configure
Switch(config)#service dhcp server
2)Create a DHCP pool and name it as “pool” and configure its network address as 192.168.0.0, subnet mask as 255.255.255.0, lease time as 120 minutes, default gateway as 192.168.0.1.
Switch(config)#ip dhcp server pool pool
Switch(dhcp-config)#network 192.168.0.0 255.255.255.0
Switch(dhcp-config)#lease 120
Switch(dhcp-config)#default-gateway 192.168.0.1
Switch(dhcp-config)#dns-server 192.168.0.2
Switch(dhcp-config)#end
Switch#copy running-config startup-config
■Configuring the VLAN on the Relay Agent
Switch#configure
Switch(config)# vlan 10
Switch(config-vlan)#name Marketing
Switch(config-vlan)#exit
Switch(config)#interface gigabitEthernet 1/0/1
Switch(config-if)#switchport general allowed vlan 10 untagged
Switch(config-if)#exit
Switch(config)# vlan 20
Switch(config-vlan)#name RD
Switch(config-vlan)#exit
Switch(config)#interface gigabitEthernet 1/0/2
Switch(config-if)#switchport general allowed vlan 20 untagged
Switch(config-if)#exit
■Configuring DHCP VLAN Relay on the Relay Agent
1)Enable DHCP Relay.
Switch(config)#service dhcp relay
2)Specify the routed port 1/0/5 as the default relay agent interface.
Switch(config)#interface vlan 1
Switch(config-if)#ip dhcp relay default-interface
Switch(config-if)#exit
3)Specify the DHCP server for VLAN 10 and VLAN 20
Switch(config)#ip dhcp relay vlan 10 helper-address 192.168.0.59
Switch(config)#ip dhcp relay vlan 20 helper-address 192.168.0.59
Switch(config)#exit
Verify the Configurations of the DHCP Relay Agent
Switch#show ip dhcp relay
Switch#show ip dhcp relay
DHCP relay state: enabled
...
DHCP relay default relay agent interface:
Interface: VLAN 1
IP address: 192.168.0.1
DHCP vlan relay helper address is configured on the following vlan:
vlan Helper address
--------------------- -------------------------
VLAN 10 192.168.0.59
VLAN 20 192.168.0.59
5.4Example for Option 82 in DHCP Relay
5.4.1Network Requirements
As the following figure shows, there are two groups of computers. Group 1 is connected to Switch A via port 1/0/1, and Group 2 is connected via port 1/0/2. All computers are in the same VLAN, but the computers and the DHCP server are in different subnets. For management convenience, the administrator wants to allocate separate address spaces for the two groups of computers.
Figure 5-28 Network Topology for Option 82 in DHCP Relay
5.4.2Configuration Scheme
To meet the requirements, you can configure Option 82 in DHCP Relay on Switch A. With DHCP Relay enabled, the switch can forward DHCP requests and replies between clients and the server. With Option 82 enabled, Switch A informs the DHCP server of the group information of each computer, so that the DHCP server can assign IP addresses of different address pools to the computers in different groups.
The overview of the configurations are as follows:
1)Configuring Switch A
a.Configure 802.1Q VLAN. Add all computers to VLAN 2. For details, refer to Configuring 802.1Q VLAN.
b.Configure the interface address of VLAN 2. For details, refer to Configuring Layer 3 Interfaces.
c.Configure DHCP relay and enable Option 82 in DHCP Relay. In this example, both DHCP Interface Relay and DHCP VLAN Relay can implement the requirements. Demonstrated with T2600G-28TS, 5.4.3 Configuring the DHCP Relay Switch provides configuration procedures to configure DHCP Interface Relay in two ways: using the GUI and using the CLI.
2)Configuring the DHCP Server
The detailed configurations on the DHCP server may be different among different devices. You can refer to the related document that is for the DHCP server you use. Demonstrated with a Linux ISC DHCP Server, 5.4.4 Configuring the DHCP Server provides information about how to set its DHCP configuration file.
5.4.3Configuring the DHCP Relay Switch
Using the GUI
Follow these steps to configure DHCP relay and enable Option 82 in DHCP Relay on Switch A:
1)Choose the menu L3 FEATURES > DHCP Service > DHCP Relay > DHCP Relay Config to load the following page. In the Global Config section, enable DHCP Relay, and click Apply.
Figure 5-29 Enable DHCP Relay
2)In the Option 82 Config section, select port 1/0/1 and port 1/0/2, enable Option 82 Support and set Option 82 Policy as Replace. You can configure other parameters according to your needs. In this example, the Format is set as Normal, and Circuit ID Customization and Remote ID Customization as Disabled. Click Apply.
Figure 5-30 Configure Option 82
3)Choose the menu L3 FEATURES > DHCP Service > DHCP Relay > DHCP Interface Relay and click to load the following page. Specify the DHCP server address to assign IP addresses for clients in VLAN 2. Click Create.
Figure 5-31 Specify DHCP Server for Interface VLAN 2
4)Click to save the settings.
Using the CLI
Follow these steps to configure DHCP relay and enable Option 82 in DHCP Relay on Switch A:
1)Enable DHCP Relay.
Switch#configure
Switch(config)#service dhcp relay
2)Enable Option 82 for port 1/0/1 and port 1/0/2. Set Option 82 policy as Replace. You can configure other parameters according to your needs. In this example, the Format is set as Normal, and Circuit ID Customization and Remote ID Customization as Disabled.
Switch#(config)#interface range gigabitEthernet 1/0/1-2
Switch(config-if)#ip dhcp relay information option
Switch(config-if)#ip dhcp relay information strategy replace
Switch(config-if)#ip dhcp relay information format normal
Switch(config-if)#exit
3)Specify the DHCP server for the interface VLAN 2.
Switch(config)#interface vlan 2
Switch(config-if)#ip helper-address 192.168.0.59
Switch(config-if)#end
Switch#copy running-config startup-config
4)Verify the Configurations
View global settings:
Switch#show ip dhcp relay
DHCP relay state: enabled
...
DHCP relay helper address is configured on the following interfaces:
Interface Helper address
------------ -------------------
VLAN2 192.168.0.59
...
View port settings:
Switch#show ip dhcp relay information interface
Interface Option 82 Status Operation Strategy Format Circuit ID ...
--------- ---------------- ------------------ ------- --------- ...
Gi1/0/1 Enable Replace Normal Default:VLAN-PORT ...
Gi1/0/2 Enable Replace Normal Default:VLAN-PORT ...
...
5.4.4Configuring the DHCP Server
Note: ●Make sure the DHCP server supports Option 82 and more than one DHCP address pool. ●To make sure the DHCP server can reach the computers, you can create static routes or enable dynamic routing protocol like RIP on the DHCP server. ●In this section, we use different notations to distinguish ASCII strings from hexadecimal numbers. An ASCII string is enclosed with quotation marks, such as “123”, while a hexadecimal number is divided by colon into parts of two digits, such as 31:32:33. |
On the DHCP server, you need to create two DHCP classes to identify the Option 82 payloads of DHCP request packets from Group 1 and Group 2, respectively.
In this example, the DHCP relay agent uses the default circuit ID and remote ID in TLV format. According to packet formats described in Table 1-1 and Table 1-2, the sub-options of the two groups are as shown in the following table.
Table 5-1Sub-options of Group1 and Group 2
Group |
Sub-option |
Type (Hex) |
Length (Hex) |
Value (Hex) |
1 |
Circuit ID |
00 |
04 |
00:02:00:01 |
Remote ID |
00 |
06 |
00:00:FF:FF:27:12 |
|
2 |
Circuit ID |
00 |
04 |
00:02:00:02 |
Remote ID |
00 |
06 |
00:00:FF:FF:27:12 |
The configuration file /etc/dhcpd.conf of the Linux ISC DHCP Server is:
ddns-update-style interim;
ignore client-updates;
# Create two classes to match the pattern of Option 82 in DHCP request packets from
# Group 1 and Group 2, respectively.
# The agent circuit ID inserted by the DHCP relay switch is 6 bytes long in TLV format, one
# byte for Type, one byte for Length, and 4 bytes for Value. Therefore, the offset is 2 and the length is 4.
# Similarly, the offset of the agent remote ID is 2 and the length is 6.
class “VLAN2Port1“ {
match if substring (option agent.circuit-id, 2, 4) = 00:02:00:01
and substring (option agent.remote-id, 2, 6) = 00:00:ff:ff:27:12;
}
class “VLAN2Port2“ {
match if substring (option agent.circuit-id, 2, 4) = 00:02:00:02
and substring (option agent.remote-id, 2, 6) = 00:00:ff:ff:27:12;
}
# Create two IP Address pools in the same subnet.
# Assign different IP addresses to the DHCP clients in different groups.
subnet 192.168.2.0 netmask 255.255.255.0 {
option routers 192.168.2.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.0.59;
option domain-name “example.com“;
default-lease-time 600;
max-lease-time 7200;
authoritative;
pool {
range 192.168.2.50 192.168.2.100;
allow members of “VLAN2Port1“;
}
pool {
range 192.168.2.150 192.168.2.200;
allow members of “VLAN2Port2“;
}
5.5Example for DHCP L2 Relay
5.5.1Network Requirements
As the following figure shows, two groups of computers are connected to Switch A, and Switch A is connected to the DHCP server. All devices on the network are in the default VLAN 1. All computers get dynamic IP addresses from the DHCP server. For management convenience, the administrator wants to allocate separate address spaces for the two groups of computers.
Figure 5-32 Network Topology for DHCP L2 Relay
5.5.2Configuration Scheme
To meet the requirements, you can configure DHCP L2 Relay on Switch A to inform the DHCP server of the group information of each PC, so that the DHCP server can assign IP addresses of different address pools to the PCs in different groups.
The overview of the configurations are as follows:
1)Configuring Switch A
a.Enable DHCP L2 Relay globally and on VLAN 1.
b.Configure Option 82 on ports 1/0/1 and 1/0/2.
Demonstrated with T2600G-28TS, 5.5.3 Configuring the DHCP Relay Switch provides configuration procedures in two ways: using the GUI and using the CLI.
2)Configuring the DHCP Server
The detailed configurations on the DHCP server may be different among different devices. You can refer to the related document that is for the DHCP server you use. Demonstrated with a Linux ISC DHCP Server, 5.5.4 Configuring the DHCP Server provides information about how to set its DHCP configuration file.
5.5.3Configuring the DHCP Relay Switch
Using the GUI
1)Choose the menu L3 FEATURES > DHCP Service > DHCP L2 Relay > Global Config to load the following page. In the Global Config section, enable DHCP L2 Relay globally and click Apply. Enable DHCP L2 Relay on VLAN 1 and click Apply.
Figure 5-33 Enabling DHCP L2 Relay
2)Choose the menu L3 FEATURES > DHCP Service > DHCP L2 Relay > Port Config to load the following page. Select port 1/0/1, enable Option 82 Support and select Option 82 Policy as Replace. You can configure other parameters according to your needs. In this example, keep Format as Normal and Remote ID Customization as Disabled. Enable Circuit ID Customization and specify the Circuit ID as Group1. Click Apply.
Figure 5-34 Configuring Port 1/0/1
3)On the same page, select port 1/0/2, enable Option 82 Support and select Option 82 Policy as Replace. You can configure other parameters according to your needs. In this example, keep Format as Normal and Remote ID Customization as Disabled. Enable Circuit ID Customization and specify the Circuit ID as Group2. Click Apply.
Figure 5-35 Configuring Port 1/0/2
4)Click to save the settings.
Using the CLI
1)Enable DHCP L2 Relay globally and on VLAN1.
Switch#configure
Switch(config)#ip dhcp l2relay
Switch(config)#ip dhcp l2relay vlan 1
2)On port 1/0/1, enable Option 82 and select Option 82 Policy as Replace. You can configure other parameters according to your needs. In this example, keep Format as Normal and Remote ID Customization as Disabled. Enable Circuit ID Customization and specify the Circuit ID as Group1.
Switch(config)#interface gigabitEthernet 1/0/1
Switch(config-if)#ip dhcp l2relay information option
Switch(config-if)#ip dhcp l2relay information strategy replace
Switch(config-if)#ip dhcp l2relay information circuit-id Group1
Switch(config-if)#exit
3)On port 1/0/2, enable Option 82 and select Option 82 Policy as Replace. You can configure other parameters according to your needs. In this example, keep Format as Normal and Remote ID Customization as Disabled. Enable Circuit ID Customization and specify the Circuit ID as Group2.
Switch(config)#interface gigabitEthernet 1/0/2
Switch(config-if)#ip dhcp l2relay information
Switch(config-if)#ip dhcp l2relay information strategy replace
Switch(config-if)#ip dhcp l2relay information circuit-id Group2
Switch(config-if)#end
Switch#copy running-config startup-config
Verify the Configurations
View global settings:
Switch#show ip dhcp l2relay
Global Status: Enable
VLAN ID: 1
View port settings:
Switch#show ip dhcp l2relay information interface gigabitEthernet 1/0/1
Interface Option 82 Status Operation Strategy Format Circuit ID ...
--------- ---------------- ------------------ ------- --------- ...
Gi1/0/1 Enable Replace Normal Group1 ...
Switch#show ip dhcp l2relay information interface gigabitEthernet 1/0/1
Interface Option 82 Status Operation Strategy Format Circuit ID ...
--------- ---------------- ------------------ ------- --------- ...
Gi1/0/2 Enable Replace Normal Group2 ...
5.5.4Configuring the DHCP Server
Note: ●Make sure the DHCP server supports Option 82 and more than one DHCP address pool. ●To make sure the DHCP server can reach the computers, you can create static routes or enable dynamic routing protocol like RIP on the DHCP server. ●In this section, we use different notations to distinguish ASCII strings from hexadecimal numbers. An ASCII string is enclosed with quotation marks, such as “123”, while a hexadecimal number is divided by colon into parts of two digits, such as 31:32:33. |
On the DHCP server, you need to create two DHCP classes to identify the Option 82 payloads of DHCP request packets from Group 1 and Group 2, respectively.
In this example, the DHCP relay agent uses the customized circuit ID and default remote ID in TLV format. According to packet format described in Table 1-1 and Table 1-2, the sub-options of the two groups are as shown in the following table.
Table 5-2Sub-options of Group1 and Group 2
Group |
Sub-option |
Type (Hex) |
Length (Hex) |
Value |
1 |
Circuit ID |
00 |
06 |
“Group1” as an ASCII string (or 47:72:6F:75:70:31 in hexadecimal) |
Remote ID |
00 |
06 |
00:00:FF:FF:27:12 |
|
2 |
Circuit ID |
00 |
06 |
“Group2” as an ASCII string (or 47:72:6F:75:70:32 in hexadecimal) |
Remote ID |
00 |
06 |
00:00:FF:FF:27:12 |
The configuration file /etc/dhcpd.conf of the Linux ISC DHCP Server is:
ddns-update-style interim;
ignore client-updates;
# Create two classes to match the pattern of Option 82 in DHCP request packets from
# Group 1 and Group 2, respectively.
# The agent circuit ID inserted by the DHCP relay switch is 8 byte long in TLV format, one
# byte for Type, one byte for Length, and 6 bytes for Value. Therefore, the offset is 2 and the length is 6.
# Similarly, the offset of the agent remote ID is 2 and the length is 6.
class “Group1“ {
match if substring (option agent.circuit-id, 2, 6) = “Group1”
and substring (option agent.remote-id, 2, 6) = 00:00:ff:ff:27:12;
}
class “Group2“ {
match if substring (option agent.circuit-id, 2, 6) = “Group2”
and substring (option agent.remote-id, 2, 6) = 00:00:ff:ff:27:12;
}
# Create two IP Address pools in the same subnet.
# Assign different IP addresses to the DHCP clients in different groups.
subnet 192.168.10.0 netmask 255.255.255.0 {
option routers 192.168.10.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.10.1;
option domain-name “example.com“;
default-lease-time 600;
max-lease-time 7200;
authoritative;
pool {
range 192.168.10.100 192.168.10.150;
allow members of “Group1“;
}
pool {
range 192.168.10.151 192.168.10.200;
allow members of “Group2“;
}
Default settings of DHCP Server are listed in the following table.
Table 6-1Default Settings of DHCP Server
Parameter |
Default Setting |
Global Config |
|
DHCP Server |
Disabled |
Option 60 |
None |
Option 138 |
None |
Ping Time Config |
|
Ping Packets |
1 |
Ping Timeout |
100 ms |
Excluded IP Address |
|
Start IP Address |
None |
End IP Address |
None |
Pool Setting |
|
Pool Name |
None |
Network Address |
None |
Subnet Mask |
None |
Lease Time |
120 min |
Default Gateway |
None |
DNS Server |
None |
NetBIOS Server |
None |
NetBIOS Node Type |
None |
Next Server Address |
None |
Domain Name |
None |
Bootfile |
None |
Manual Binding |
|
Pool Name |
None |
IP Address |
None |
Binding Mode |
Client ID |
Client Id |
None |
Hardware Address |
None |
Hardware Type |
Ethernet |
Default settings of DHCP Relay are listed in the following table.
Table 6-2Default Settings of DHCP Relay
Parameter |
Default Setting |
DHCP Relay |
|
DHCP Relay |
Disabled |
DHCP Relay Hops |
4 |
DHCP Relay Time Threshold |
0 |
Option 82 Configuration |
|
Option 82 Support |
Disabled |
Option 82 Policy |
Keep |
Format |
Normal |
Circuit ID Customization |
Disabled |
Circuit ID |
None |
Remote ID Customization |
Disabled |
Remote ID |
None |
DHCP Interface Relay |
|
Interface ID |
None |
Server Address |
None |
DHCP VLAN Relay |
|
Interface ID |
None |
VLAN ID |
None |
Server Address |
None |
Default settings of DHCP L2 Relay are listed in the following table.
Table 6-3Default Settings of DHCP L2 Relay
Parameter |
Default Setting |
Global Config |
|
DHCP Relay |
Disabled |
VLAN Status |
Disabled |
Port Config |
|
Option 82 Support |
Disabled |
Option 82 Policy |
Keep |
Format |
Normal |
Circuit ID Customization |
Disabled |
Circuit ID |
None |
Remote ID Customization |
Disabled |
Remote ID |
None |