## Configuration steps (configure on router) ### (1) # Configure the IP address of the interface. <H3C> system-view [H3C] interface g 0/0 [[H3C-GigabitEthernet0/0]] ip address 192.168.1.254 24 [[H3C-GigabitEthernet0/0]] quit ### (2)# Enable the DHCP service. [H3C] dhcp enable ### (3) # Configure IP addresses that do not participate in automatic allocation. [H3C] dhcp server forbidden-ip 192.168.1.10 [H3C] dhcp server forbidden-ip 192.168.1.254 (4)# Configure DHCP address pool 0, and use dynamic binding to assign IP address. //The assignable network segment is 192.168.1.0/24, the lease is valid for 10 days, and the DNS server address is 192.168.1.10. [H3C] dhcp server ip-pool 0 [H3C-dhcp-pool-0] network 192.168.1.0 mask 255.255.255.0 [H3C-dhcp-pool-0] expired day 10 [H3C-dhcp-pool-0] dns-list 192.168.1.10 [H3C-dhcp-pool-0] gateway-list 192.168.1.254 [H3C-dhcp-pool-0] quit2.DHCP relay
The DHCP server is on the router, while the SWA has three VLAN s, which belong to three different network segments,
DHCP request message is broadcast, so relay must be set on SWA to transmit to router.
Configuration steps (1) # Configure the router. <H3C> system-view [H3C] interface g 0/0 [[H3C-GigabitEthernet0/0]] ip address 10.1.1.2 30 [[H3C-GigabitEthernet0/0]] quit # Enable the DHCP service. [H3C] dhcp enable # Configure DHCP address pool 1 to assign addresses to clients from the 192.168.1.0/24 network segment. [H3C] dhcp server ip-pool 1 [H3C-dhcp-pool-0] network 192.168.10.0 mask 255.255.255.0 [H3C-dhcp-pool-0] dns-list 8.8.8.8 [H3C-dhcp-pool-0] gateway-list 192.168.10.254 [H3C-dhcp-pool-0] quit # Configure DHCP address pool 2 to assign addresses to clients from the 192.168.20.0/24 network segment. [H3C] dhcp server ip-pool 2 [H3C-dhcp-pool-0] network 192.168.20.0 mask 255.255.255.0 [H3C-dhcp-pool-0] dns-list 8.8.8.8 [H3C-dhcp-pool-0] gateway-list 192.168.20.254 [H3C-dhcp-pool-0] quit # Configure DHCP address pool 3 to assign addresses to clients from the 192.168.30.0/24 network segment. [H3C] dhcp server ip-pool 3 [H3C-dhcp-pool-0] network 192.168.30.0 mask 255.255.255.0 [H3C-dhcp-pool-0] dns-list 8.8.8.8 [H3C-dhcp-pool-0] gateway-list 192.168.30.254 [H3C-dhcp-pool-0] quit # Configure static routing to 192.168.0.0/16 network segment [H3C]ip route-static 192.168.0.0 16 10.1.1.1
(2) configure SWA switch.
Establish vlan and configure IP address of each interface.
<H3C> system-view [H3C]vlan 10 [H3C-vlan10]quit [H3C]vlan 20 [H3C-vlan20]quit [H3C]vlan 30 [H3C-vlan30]quit [H3C]inter range g 1/0/1 to g 1/0/5 [H3C-if-range]port link-type access [H3C-if-range]port access vlan 10 [H3C-if-range]quit [H3C]inter range g 1/0/6 to g 1/0/10 [H3C-if-range]port link-type access [H3C-if-range]port access vlan 20 [H3C-if-range]quit [H3C]inter range g 1/0/11 to g 1/0/15 [H3C-if-range]port link-type access [H3C-if-range]port access vlan 30 [H3C-if-range]quit [H3C]inter vlan 10 [H3C-Vlan-interface10]ip add 192.168.10.254 24 [H3C-Vlan-interface10]quit [H3C]inter vlan 20 [H3C-Vlan-interface20]ip add 192.168.20.254 24 [H3C-Vlan-interface20]quit [H3C]inter vlan 30 [H3C-Vlan-interface30]ip add 192.168.30.254 24 [H3C-Vlan-interface30]quit [H3C] [H3C]inter g 1/0/23 [H3C-GigabitEthernet1/0/23]port link-m r [H3C-GigabitEthernet1/0/23]ip add 10.1.1.1 30 [H3C-GigabitEthernet1/0/23]quit
(3) configure DHCP relay (SWA switch)
# Enable the DHCP service. [H3C] dhcp enable # Configure VLAN interface 10 to work in DHCP relay mode. [H3C] interface vlan-interface 10 [H3C-Vlan-interface10] dhcp select relay # Configure the address of the DHCP server. [H3C-Vlan-interface10] dhcp relay server-address 10.1.1.2 [H3C-Vlan-interface10] quit # Configure VLAN interface 20 to work in DHCP relay mode. [H3C] interface vlan-interface 20 [H3C-Vlan-interface20] dhcp select relay [H3C-Vlan-interface20] dhcp relay server-address 10.1.1.2 [H3C-Vlan-interface20] quit # Configure VLAN interface 30 to work in DHCP relay mode. [H3C] interface vlan-interface 30 [H3C-Vlan-interface30] dhcp select relay [H3C-Vlan-interface30] dhcp relay server-address 10.1.1.2 [H3C-Vlan-interface30] quit3.DHCP Snooping
The DHCP server is on the router, while the SWA has three VLAN s, which belong to three different network segments,
DHCP request message is broadcast, so relay must be set on SWA to transmit to router.
The pseudo DHCP Server has been configured and will publish the address pool of 172.22.1.1-99, gateway 172.22.1.254 and DNS 9.9.9.9
Configuration steps
(1) # Configure the router. <H3C> system-view [H3C] interface g 0/0 [[H3C-GigabitEthernet0/0]] ip address 10.1.1.2 30 [[H3C-GigabitEthernet0/0]] quit # Enable the DHCP service. [H3C] dhcp enable # Configure DHCP address pool 1 to assign addresses to clients from the 192.168.1.0/24 network segment. [H3C] dhcp server ip-pool 1 [H3C-dhcp-pool-0] network 192.168.10.0 mask 255.255.255.0 [H3C-dhcp-pool-0] dns-list 8.8.8.8 [H3C-dhcp-pool-0] gateway-list 192.168.10.254 [H3C-dhcp-pool-0] quit # Configure DHCP address pool 2 to assign addresses to clients from the 192.168.20.0/24 network segment. [H3C] dhcp server ip-pool 2 [H3C-dhcp-pool-0] network 192.168.20.0 mask 255.255.255.0 [H3C-dhcp-pool-0] dns-list 8.8.8.8 [H3C-dhcp-pool-0] gateway-list 192.168.20.254 [H3C-dhcp-pool-0] quit # Configure DHCP address pool 3 to assign addresses to clients from the 192.168.30.0/24 network segment. [H3C] dhcp server ip-pool 3 [H3C-dhcp-pool-0] network 192.168.30.0 mask 255.255.255.0 [H3C-dhcp-pool-0] dns-list 8.8.8.8 [H3C-dhcp-pool-0] gateway-list 192.168.30.254 [H3C-dhcp-pool-0] quit # Configure static routing to 192.168.0.0/16 network segment [H3C]ip route-static 192.168.0.0 16 10.1.1.1
(2)# Configure the SWA switch. # Establish vlan and configure IP address of each interface. <H3C> system-view [H3C]vlan 10 [H3C-vlan10]quit [H3C]vlan 20 [H3C-vlan20]quit [H3C]vlan 30 [H3C-vlan30]quit [H3C]inter range g 1/0/1 to g 1/0/5 [H3C-if-range]port link-type access [H3C-if-range]port access vlan 10 [H3C-if-range]quit [H3C]inter range g 1/0/6 to g 1/0/10 [H3C-if-range]port link-type access [H3C-if-range]port access vlan 20 [H3C-if-range]quit [H3C]inter range g 1/0/11 to g 1/0/15 [H3C-if-range]port link-type access [H3C-if-range]port access vlan 30 [H3C-if-range]quit [H3C]inter vlan 10 [H3C-Vlan-interface10]ip add 192.168.10.254 24 [H3C-Vlan-interface10]quit [H3C]inter vlan 20 [H3C-Vlan-interface20]ip add 192.168.20.254 24 [H3C-Vlan-interface20]quit [H3C]inter vlan 30 [H3C-Vlan-interface30]ip add 192.168.30.254 24 [H3C-Vlan-interface30]quit [H3C] [H3C]inter g 1/0/23 [H3C-GigabitEthernet1/0/23]port link-t [H3C-GigabitEthernet1/0/23]ip add 10.1.1.1 30 [H3C-GigabitEthernet1/0/23]quit
(3)#Configure DHCP relay (SWA switch) # Enable the DHCP service. [H3C] dhcp enable # Configure VLAN interface 10 to work in DHCP relay mode. [H3C] interface vlan-interface 10 [H3C-Vlan-interface10] dhcp select relay # Configure the address of the DHCP server. [H3C-Vlan-interface10] dhcp relay server-address 10.1.1.2 [H3C-Vlan-interface10] quit # Configure VLAN interface 20 to work in DHCP relay mode. [H3C] interface vlan-interface 20 [H3C-Vlan-interface20] dhcp select relay [H3C-Vlan-interface20] dhcp relay server-address 10.1.1.2 [H3C-Vlan-interface20] quit # Configure VLAN interface 30 to work in DHCP relay mode. [H3C] interface vlan-interface 30 [H3C-Vlan-interface30] dhcp select relay [H3C-Vlan-interface30] dhcp relay server-address 10.1.1.2 [H3C-Vlan-interface30] quit
(4)#Configure DHCP Snooping (SWB switch) # Enable the DHCP Snooping feature. [H3C] dhcp snooping enable # Set the gigabitethernet 1 / 0 / 21 port as the trust port. [H3C] interface GigabitEthernet 1/0/21 [H3C-GigabitEthernet1/0/21] dhcp snooping trust [H3C-GigabitEthernet1/0/21] quit # Enable the DHCP Snooping table entry feature on gigabitethernet 1 / 0 / 1. [H3C] interface GigabitEthernet 1/0/1 [H3C-GigabitEthernet1/0/1] dhcp snooping binding record [H3C-GigabitEthernet1/0/1] quit