Configuring DHCP

CHAPTERS

1. DHCP

2. DHCP Relay Configuration

3. DHCP L2 Relay Configuration

4. Configuration Examples

5. Appendix: Default Parameters

This guide applies to:

T1500G-10PS v2 or above, T1500G-8T v2 or above, T1500G-10MPS v2 or above, T1500-28PCT v3 or above, T2500G-10TS v2 or above.

1DHCP

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 Relay and DHCP L2 Relay.

DHCP Relay

DHCP Relay is used to process and forward DHCP packets between different subnets or VLANs.

The DHCP client broadcasts DHCP request packets to require for an IP address. Since the transmission of broadcast packets are always limited in one LAN, so if the DHCP server are not in the same LAN with the client, the client can never obtain an IP address from the DHCP server. Therefore, each LAN should be equipped with a DHCP server, thus increasing the costs of network construction and bringing trouble for central network management.

DHCP Relay solves this problem. The DHCP Relay device acts as a relay agent and forwards DHCP packets between DHCP clients and DHCP servers in different LANs, so that DHCP clients in different LANs can share one DHCP server.

The DHCP Relay feature supports Option 82 and DHCP VLAN Relay.

Option 82

The switch can record the location information of the DHCP client using Option 82. The switch can add Option 82 to the DHCP request packet and then transmit the packet to the DHCP server. The DHCP server which supports Option 82 can set the distribution policy of IP addresses and the other parameters, providing a more flexible address distribution way.

DHCP VLAN Relay

DHCP VLAN Relay allows clients in different VLANs to obtain IP addresses from the DHCP server using a single agent interface IP address.

In DHCP VLAN Relay, you can simply specify VLAN interface 1 (the default management VLAN interface) as default agent interface for all VLANs. The switch will fill the 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. The switch uses IP address of the default agent interface (192.168.0.1/24) to apply 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.0.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-1 Application Scenario of DHCP VLAN Relay

Note:

For T1500 series switches, only the management VLAN interface can be specified as the default relay agent interface.

DHCP L2 Relay

Unlike DHCP relay, DHCP L2 Relay is used in the situation that the DHCP server and client 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 record the location information of the DHCP client using Option 82. The switch can add Option 82 to the DHCP request packet and then transmit the packet to the DHCP server. The DHCP server which supports Option 82 can set the distribution policy of IP addresses and the other parameters, providing a more flexible address distribution way.

Figure 1-2 Application Scenario of DHCP L2 Relay

2DHCP Relay Configuration

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.

2.1Using the GUI

2.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 2-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 the 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 DHCP relay time threshold. The valid value ranges from 0 to 65535 seconds.

DHCP relay time is the time elapsed since client began address acquisition or renewal process. When the time is greater than the value set here, the DHCP packet will be dropped by the switch. 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. By default, it is disabled. Option 82 is used to record the DHCP client’s location, Ethernet port and the VLAN, etc. If you need to record the accurate location of a client, you can enable Option 82 on the relay device which is closest to the client.

Option 82 Policy

Select the operation for the Option 82 field of the DHCP request packets.

Keep: Indicates keeping the Option 82 field of the packets.

Replace: Indicates replacing the Option 82 field of the packets with the switch defined one. By default, the Circuit ID is defined to be the VLAN and the ID of the port which receives the DHCP Request packets. The Remote ID is defined to be the MAC address of the DHCP Relay device which receives the DHCP Request packets.

Drop: Indicates discarding the packets that include the Option 82 field.

Format

Select the format of option 82 sub-option value field.

Normal: Indicates that the format of sub-option value field is TLV (type-length-value).

Private: Indicates that the format of sub-option value field is just value.

Circuit ID Customization

Enable or disable Customization of Option 82. If enabled, you need to configure Option 82 information manually; If disabled, the switch will automatically configure the VLAN ID and the ID of the port that receives the DHCP packets as the circuit ID.

Circuit ID

Enter the customized circuit ID, which contains 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 the switch to define the Option 82 sub-option Remote ID field. If it is enabled, you can manually configure the remote ID; if it is disabled, the switch will automatically configure the switch’s MAC address as the remote ID.

Remote ID

Enter the customized remote ID, which contains up to 64 characters. The remote ID configurations of the switch and the DHCP server should be compatible with each other.

3)Click Apply.

2.1.2Configuring DHCP VLAN Relay

DHCP VLAN Relay is used for the clients in VLANs but do not have a layer 3 interface as the gateway to obtain IP addresses from the DHCP server, which is not in the same subnet as the clients.

Choose the menu L3 FEATURES > DHCP Service > DHCP Relay > DHCP VLAN Relay to load the following page.

Figure 2-2 Specify DHCP Server for VLAN

Follow these steps to specify DHCP Server for the specific VLAN:

1)In the Default Relay Agent Interface section, configure the management VLAN (by default, it is VLAN 1) as the default relay agent interface. The switch will use its IP address to fill in the relay agent IP address field in DHCP packets when applying for IP addresses from the DHCP server. 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.

2)In the DHCP VLAN Relay Config section, click to load the configuration page.

Specify the VLAN that the clients belong to and the IP address of the DHCP server. 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.

2.2Using the CLI

2.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

show ip dhcp relay

Verify the configuration of DHCP Relay.

Step 4

end

Return to Privileged EXEC Mode.

Step 5

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

DHCP relay state: enabled

......

Switch(config)#end

Switch#copy running-config startup-config

2.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 Option 82 field of the DHCP request packets from the Host. The following options are provided:

keep: Indicates keeping the Option 82 field of the packets.

replace: Indicates replacing the Option 82 field of the packets with one defined by switch. By default, the Circuit ID is defined to be the VLAN and the number of the port which receives the DHCP Request packets. The Remote ID is defined to be the MAC address of the DHCP Snooping device which receives the DHCP Request packets.

drop: Indicates discarding the packets that include the Option 82 field.

Step 5

ip dhcp relay information format { normal | private }

Specify the format of option 82 sub-option value field.

normal: Indicates that the format of sub-option value field is TLV (type-length-value).

private: Indicates that the format of sub-option value field is the value you configure for the related sub-option.

Step 6

ip dhcp relay information circuit-id string

Configure the circuit ID. The circuit ID configurations of the switch and the DHCP server should be compatible with each other.

string: Enter the circuit ID, which contains up to 64 characters.

Step 7

ip dhcp relay information remote-id string

Configure 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, which contains 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 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 VLAN 20 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

2.2.3Configuring DHCP VLAN Relay

Follow these steps to configure DHCP VLAN Relay:

Step 1

configure

Enter global configuration mode.

Step 2

Enter VLAN interface configuration mode:

interface vlan vlan-id

vlan-id: Specify a VLAN interface. Only VLAN 1 (the management VLAN) is supported.

Step 3

ip dhcp relay default-interface

Set the management VLAN interface as the default relay agent interface.

Step 4

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 5

exit

Return to global configuration mode.

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 VLAN interface 1 (the management VLAN) as the default relay agent interface and specify the DHCP server by entering the server address as 192.168.1.8 on VLAN 10:

Switch#configure

Switch(config)#interface vlan 1

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

3DHCP L2 Relay Configuration

To complete DHCP L2 Relay configuration, follow these steps:

1)Enable DHCP L2 Relay.

2)Configure Option 82 for ports.

3.1Using the GUI

3.1.1Enabling DHCP L2 Relay

Choose the menu L3 FEATURES > DHCP Service > DHCP L2 Relay > Global Config to load the following page.

Figure 3-1 Enable DHCP L2 Relay

Follow these steps to enable DHCP L2 Relay globally and 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..

3.1.1Configuring Option 82 for Ports

Choose the menu L3 FEATURES > DHCP Service > DHCP L2 Relay > Port Config to load the following page.

Figure 3-1 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. By default, it is disabled. Option 82 is used to record the DHCP client’s location, Ethernet port and the VLAN, etc. If you need to record the accurate location of a client, you can enable Option 82 on the relay device which is closest to the client.

Option 82 Policy

Select the operation for the Option 82 field of the DHCP request packets.

Keep: Indicates keeping the Option 82 field of the packets.

Replace: Indicates replacing the Option 82 field of the packets with the switch defined one. By default, the Circuit ID is defined to be the VLAN and the ID of the port which receives the DHCP Request packets. The Remote ID is defined to be the MAC address of the DHCP Relay device which receives the DHCP Request packets.

Drop: Indicates discarding the packets that include the Option 82 field.

Format

Select the format of option 82 sub-option value field.

Normal: Indicates that the format of sub-option value field is TLV (type-length-value).

Private: Indicates that the format of sub-option value field is just value.

Circuit ID Customization

Enable or disable Customization of Option 82. If enabled, you need to configure Option 82 information manually; If disabled, the switch will automatically configure the VLAN ID and the ID of the port that receives the DHCP packets as the circuit ID.

Circuit ID

Enter the customized circuit ID, which contains 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 the switch to define the Option 82 sub-option Remote ID field. If it is enabled, you can manually configure the remote ID; if it is disabled, the switch will automatically configure the switch’s MAC address as the remote ID.

Remote ID

Enter the customized remote ID, which contains up to 64 characters. The remote ID configurations of the switch and the DHCP server should be compatible with each other.

2)Click Apply

3.2Using the CLI

3.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

3.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 Option 82 field of the DHCP request packets from the Host. The following options are provided:

keep: Indicates keeping the Option 82 field of the packets.

replace: Indicates replacing the Option 82 field of the packets with one defined by switch. By default, the Circuit ID is defined to be the VLAN and the number of the port which receives the DHCP Request packets. The Remote ID is defined to be the MAC address of the DHCP Snooping device which receives the DHCP Request packets.

drop: Indicates discarding the packets that include the Option 82 field.

Step 5

ip dhcp l2relay information format { normal | private }

Specify the format of option 82 sub-option value field.

normal: Indicates that the format of sub-option value field is TLV (type-length-value).

private: Indicates that the format of sub-option value field is the value you configure for the related sub-option.

Step 6

ip dhcp l2relay information circuit-id string

Configure the circuit ID. The circuit ID configurations of the switch and the DHCP server should be compatible with each other.

string: Enter the circuit ID, which contains up to 64 characters.

Step 7

ip dhcp l2relay information remote-id string

Configure 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, which contains 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

4Configuration Examples

4.1Example for DHCP Interface Relay

4.1.1Network Requirements

The administrator deploys one DHCP server on the network, and want 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.

As the network topology shows, the Marketing department and the R&D department respectively belong to VLAN 10 and VLAN 20. The IP address of VLAN interface 10 is 192.168.2.1 and the IP address of VLAN interface 20 is 192.168.3.1. 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 4-1 Network Topology for DHCP Interface Relay

4.1.2Configuration Scheme

In the given situation, the DHCP server and the computers are isolated in different network segments, so the DHCP request from the clients cannot be directly forwarded to the DHCP server. To satisfy the requirement that the two departments are assigned IP addresses in different subnet, 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, one is on 192.168.2.0/24 network segment and the other is on 192.168.3.0/24 network segment. 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 T1700X-16TS. This chapter provides configuration procedures in two ways: using the GUI and using the CLI.

4.1.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 4-2 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 4-3 Configuring DHCP Pool 1 for VLAN 10

Figure 4-4 Configuring DHCP Pool 2 for VLAN 20

1)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 4-5 Creating the Static Routing Entry for VLAN 10

Figure 4-6 Creating the Static Routing Entry for VLAN 20

Configuring the VLANs on the Relay Agent

2)Choose the menu L2 FEATURES > VLAN > 802.1Q VLAN > VLAN Config and click to load the following page. Create VLAN 10 and VLAN 20 for the Marketing department and R&D department respectively. Add port 1/0/1 to VLAN 10 and port 1/0/2 to VLAN 20.

Figure 4-7 Creating VLAN 10

Figure 4-8 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 4-9 Creating VLAN Interface 10

Figure 4-10 Creating VLAN Interface 20

Figure 4-11 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 4-12 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 4-13 Specify DHCP Server for Interface VLAN 10

Figure 4-14 Specify DHCP Server for Interface VLAN 20

3)Click to save the settings.

4.1.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 minute, 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 minute, 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 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

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 ten-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 ten-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 ten-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

...

4.2Example for DHCP VLAN Relay

4.2.1Network Requirements

The Marketing department and the R&D department respectively belong to two VLANs. Both of the VLANs have no Layer 3 gateways. The administrator deploys one DHCP server on the network, and wants the server to assign IP addresses to the two departments.

As the network topology shows, the Marketing department and the R&D department respectively belong to VLAN 10 and VLAN 20. 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 4-15 Network Topology for DHCP VLAN Relay

4.2.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 T1500-28PCT. This chapter provides configuration procedures in two ways: using the GUI and using the CLI.

4.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 4-16 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 4-17 Configuring DHCP Pool 1 for VLAN 10

Configuring the VLANs on the Relay Agent

3)Choose the menu L2 FEATURES > VLAN > 802.1Q VLAN > VLAN Config and click to load the following page. Create VLAN 10 and VLAN 20 for the Marketing department and R&D department respectively. Add port 1/0/1 to VLAN 10 and port 1/0/2 to VLAN 20.

Figure 4-18 Creating VLAN 10

Figure 4-19 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 4-20 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.

Figure 4-21 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 4-22 Specify DHCP Server for Interface VLAN 10

Figure 4-23 Specify DHCP Server for Interface VLAN 20

4)Click to save the settings.

4.2.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 minute, 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 fastEthernet 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 fastEthernet 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

4.3Example for DHCP L2 Relay

4.3.1Network Requirements

As the following figure shows, two groups are connected to Switch A, and Switch A is connected to the DHCP server. All devices on the network are in the default VLAN1. For management convenience, there are the network requirements:

All PCs on the network get dynamic IP addresses from the DHCP server.

For Group1, the DHCP server assigns the IP addresses from 192.168.10.100 to 192.168.10.150.

For Group2, the DHCP server assigns IP addresses from 192.168.10.151 to 192.168.10.200.

Switch A acts as the DHCP Relay to inform the DHCP server of the group information.

Figure 4-1 Network Topology for DHCP L2 Relay

4.3.2Configuration Scheme

First, make sure that the DHCP server supports Option 82. Then 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 different IP address to the PCs in different groups.

The detailed configurations on the DHCP server may be different among different devices. The general configuration is to create two IP address pools for the two groups and configure the server to identify the DHCP packets from different groups through the option 82. You can refer to the related document that is for the DHCP server.

This chapter introduces the configurations on Switch A, which acts as the DHCP Relay. The configuration overview is as follows:

1)Enable DHCP L2 Relay globally and on VLAN1.

2)Configure Option 82 on ports 1/0/1 and 1/0/2.

Demonstrated with T1500-28PCT, this chapter provides configuration procedures in two ways: using the GUI and using the CLI.

4.3.3Using 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 4-2 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, select Option 82 Policy as Replace, enable Circuit ID Customization and specify the Circuit ID as Group1. Click Apply.

Figure 4-3 Configuring Port 1/0/1

3)On the same page, select port 1/0/2, enable Option 82, select Option 82 Policy as Replace, enable Circuit ID Customization and specify the Circuit ID as Group2. Click Apply.

Figure 4-4 Configuring Port 1/0/2

4)Click to save the settings.

4.3.4Using CLI

1)Enable DHCP L2 Relay globally and on VLAN1.

Switch#configure

Switch(config)#ip dhcp l2relay

Switch(config)#iip dhcp l2relay vlan 1

2)On port 1/0/1, enable Option 82, set Option 82 Policy to Replace, 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

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, set Option 82 Policy to Replace, 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 ...

5Appendix: Default Parameters

Default settings of DHCP Relay are listed in the following table.

Table 5-1Default Settings of DHCP Relay

Parameter

Default Setting

DHCP Relay

DHCP Relay

Disable

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

Disable

Circuit ID

None

Remote ID Customization

Disabled

Remote ID

None

Default settings of DHCP L2 Relay are listed in the following table.

Table 5-2Default 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

Disable

Circuit ID

None

Remote ID Customization

Disabled

Remote ID

None