background image

 

Configuring dynamic IPv4 address 
assignment 

Introduction 

The following example describes the basic procedure to configure an interface as a DHCP server for 
dynamic IPv4 address assignment.

 

Network configuration 

As shown in 

Figure 1

the core switch has three VLANs. Host A, Host B, and Host C are in VLAN 5, 

VLAN 6, and VLAN 7, respectively. Configure the core switch as a DHCP server to meet the following 
requirements: 

 

The clients on subnets 192.168.5.0/24, 192.168.6.0/24, and 192.168.7.0/24 can obtain IP 
addresses through DHCP. 

 

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, the DNS server IP address is 192.168.5.100 and the 
gateway IP address is 192.168.5.254/24. 

 

For the hosts in subnet 192.168.6.0/24, the DNS server IP address is 192.168.6.100 and the 
gateway IP address is 192.168.6.254/24. 

 

For the hosts in subnet 192.168.7.0/24, the DNS server IP address is 192.168.7.100 and the 
gateway IP address is 192.168.7.254/24. 

Figure 1 Network diagram 

 

 

Procedure 

# Enable DHCP on the switch. 

<Switch> system-view 

[Switch] dhcp enable 

Switch

GE1/0/5

VLAN 5

Host A

VLAN 6

Host B

VLAN 7

Host C

GE1/0/7

GE1/0/6

Содержание DHCP

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Отзывы: