background image

 

Configuring DHCP relay agent 

Introduction 

The following example describes  the basic  procedure to configure an interface as a  DHCP  relay 
agent. The DHCP relay agent enables clients to obtain IP addresses and configuration parameters 
from a DHCP server on another subnet.

 

Network configuration 

As shown in

 Figure 2

Switch A acts as the core switch and has two VLANs. Host A and Host B are in 

VLAN  5 and  VLAN  6, respectively. The DHCP server and the hosts run on different subnets and 
Switch A is the gateway for these hosts. Configure the network to meet the following requirements: 

 

The DHCP clients run on subnets 192.168.5.0/24 and 192.168.6.0/24, and the DHCP server IP 
address is 192.168.7.100/24. 

 

Switch A acts as the DHCP relay agent for clients, so these clients can obtain IP addresses in 
subnets 192.168.5.0/24 and 192.168.6.0/24, and other network settings from the DHCP server. 

Figure 2 Network diagram 

 

 

Procedure 

1. 

Configure Switch B. 

# Create VLAN 5 and VLAN 6, and then assign GigabitEthernet 1/0/2 and GigabitEthernet 1/0/3 
to VLAN 5 and VLAN 6, respectively. 

<SwitchB> system-view 

[SwitchB] vlan 5 

[SwitchB-vlan5] port gigabitEthernet 1/0/2 

[SwitchB-vlan5] quit 

[SwitchB] vlan 6 

GE1/0/1

Switch B

GE1/0/2

GE1/0/3

DHCP server

Switch A

GE1/0/1

GE1/0/2

VLAN 5

Host A

VLAN 6

Host B

Summary of Contents for DHCP

Page 1: ...oduced or transmitted in any form or by any means without prior written consent of New H3C Technologies Co Ltd Except for the trademarks of New H3C Technologies Co Ltd any trademarks that may be menti...

Page 2: ...nfiguration 5 Procedure 5 Verifying the configuration 7 Configuration files 7 Related documentation 8 Configuring DHCP snooping 9 Introduction 9 Network configuration 9 Procedure 9 Verifying the confi...

Page 3: ...The IP addresses of VLAN interface 5 VLAN interface 6 and VLAN interface 7 on the switch are 192 168 5 254 24 192 168 6 254 24 and 192 168 7 254 24 respectively For the hosts in subnet 192 168 5 0 24...

Page 4: ...cific IP addresses such as DNS server IP addresses from dynamic IP address assignment Switch dhcp server forbidden ip 192 168 5 100 Switch dhcp server forbidden ip 192 168 6 100 Switch dhcp server for...

Page 5: ...2021 Auto C 662e 3030 3033 2d45 7568 6572 1e The output shows that the DHCP server can assign IP addresses and other network settings to the clients on subnets 192 168 5 0 24 192 168 6 0 24 and 192 16...

Page 6: ...igabitEthernet1 0 5 port link mode bridge port access vlan 5 interface GigabitEthernet1 0 6 port link mode bridge port access vlan 6 interface GigabitEthernet1 0 7 port link mode bridge port access vl...

Page 7: ...network to meet the following requirements The DHCP clients run on subnets 192 168 5 0 24 and 192 168 6 0 24 and the DHCP server IP address is 192 168 7 100 24 Switch A acts as the DHCP relay agent f...

Page 8: ...ddress to VLAN 5 VLAN 6 and VLAN 7 respectively SwitchA interface vlan interface 5 SwitchA Vlan interface5 ip address 192 168 5 1 255 255 255 0 SwitchA Vlan interface5 quit SwitchA interface vlan inte...

Page 9: ...rt access vlan 5 interface GigabitEthernet1 0 3 port link mode bridge port access vlan 6 Switch A dhcp enable vlan 5 to 7 interface Vlan interface5 ip address 192 168 5 1 255 255 255 0 dhcp select rel...

Page 10: ...rnet1 0 2 port link mode bridge port access vlan 7 Related documentation DHCP configuration in the Layer 3 IP services configuration guide for the device DHCP commands in the Layer 3 IP services comma...

Page 11: ...erver The DHCP snooping device records clients IP to MAC bindings by reading DHCP ACK messages received from the trusted port and the DHCPREQUEST messages Figure 3 Network diagram Procedure Enable glo...

Page 12: ...k the DHCP snooping entry recorded for the client Configuration files dhcp snooping enable interface GigabitEthernet1 0 1 port link mode bridge dhcp snooping trust interface Ten GigabitEthernet1 0 2 p...

Page 13: ...connectivity Figure 4 Network diagram Procedure 1 Configure Switch A Create VLAN 1 and assign GigabitEthernet 1 0 2 to VLAN 1 SwitchA system view SwitchA vlan 1 SwitchA vlan1 port gigabitethernet 1 0...

Page 14: ...the next hop of the route is 3001 2 SwitchA ipv6 route static 4001 64 3001 2 Save the configuration SwitchA save force 2 Configure Switch B Create VLAN 2 and assign GigabitEthernet 1 0 1 to VLAN 2 Swi...

Page 15: ...n View the IPv6 addresses assigned by the DHCPv6 server on Switch A SwitchA display ipv6 dhcp server ip in use Pool 1 IPv6 address Type Lease expiration 2001 2 Auto C Sep 30 11 45 07 2021 View informa...

Page 16: ...ver apply pool 1 allow hint rapid commit ipv6 address 2001 1 64 ipv6 nd autoconfig managed address flag undo ipv6 nd ra halt interface Vlan interface2 ipv6 address 3001 1 64 interface GigabitEthernet1...

Page 17: ...a halt interface GigabitEthernet1 0 1 port link mode bridge port access vlan 2 interface GigabitEthernet1 0 2 port link mode bridge port access vlan 3 ipv6 route static 2001 64 3001 1 Related document...

Reviews: