华为DHCP中继实战

mac2026-04-20  7

DHCP中继

实验拓扑图为

二层交换机sw1的配置为:

<Huawei>system-view [Huawei]sysname sw1 [sw1]v b 10 20 [sw1]int e0/0/1 [sw1-Ethernet0/0/1]p l a [sw1-Ethernet0/0/1]p d v 10 [sw1-Ethernet0/0/1]un sh [sw1-Ethernet0/0/1]int e0/0/2 [sw1-Ethernet0/0/2]p l a [sw1-Ethernet0/0/2]p d v 20 [sw1-Ethernet0/0/2]un sh [sw1-Ethernet0/0/2]int e0/0/3 [sw1-Ethernet0/0/3]p l a [sw1-Ethernet0/0/3]p d v 10 [sw1-Ethernet0/0/3]un sh [sw1-Ethernet0/0/3]int e0/0/4 [sw1-Ethernet0/0/4]p l a [sw1-Ethernet0/0/4]p d v 20 [sw1-Ethernet0/0/4]un sh [sw1-Ethernet0/0/4]int g0/0/1 [sw1-GigabitEthernet0/0/1]p l t [sw1-GigabitEthernet0/0/1]p t a v a [sw1-GigabitEthernet0/0/1]un sh

路由器R1的配置

<Huawei>system-view [Huawei]sysname R1 [R1]dhcp enable [R1]int g0/0/0 [R1-GigabitEthernet0/0/0]ip add 14.0.0.2 24 [R1-GigabitEthernet0/0/0]dhcp select global [R1-GigabitEthernet0/0/0]un sh [R1-GigabitEthernet0/0/0]q [R1]ip route-static 0.0.0.0 0.0.0.0 14.0.0.1 [R1]ip pool dhcp15 [R1-ip-pool-dhcp15]network 15.0.0.1 mask 24 [R1-ip-pool-dhcp15]gateway-list 15.0.0.1 [R1-ip-pool-dhcp15]dns-list 8.8.8.8 2.2.2.2 [R1-ip-pool-dhcp15]q [R1]ip pool dhcpvlan10 [R1-ip-pool-dhcpvlan10]network 192.168.10.0 mask 24 [R1-ip-pool-dhcpvlan10]gateway-list 192.168.10.1 [R1-ip-pool-dhcpvlan10]dns-list 8.8.8.8 2.2.2.2 [R1-ip-pool-dhcpvlan10]q [R1]ip pool dhcpvlan20 [R1-ip-pool-dhcpvlan20]network 192.168.20.0 mask 24 [R1-ip-pool-dhcpvlan20]gateway-list 192.168.20.1 [R1-ip-pool-dhcpvlan20]dns-list 8.8.8.8 2.2.2.2 [R1-ip-pool-dhcpvlan20]q

路由器R2的配置

<Huawei>system-view [Huawei]sysname R2 [R2]dhcp enable [R2]int g0/0/1.10 [R2-GigabitEthernet0/0/1.10]d t v 10 [R2-GigabitEthernet0/0/1.10]ip add 192.168.10.1 24 [R2-GigabitEthernet0/0/1.10]a b en [R2-GigabitEthernet0/0/1.10]dhcp select relay [R2-GigabitEthernet0/0/1.10]dhcp relay server-ip 14.0.0.2 [R2-GigabitEthernet0/0/1.10]q [R2]int g0/0/1.20 [R2-GigabitEthernet0/0/1.20]d t v 20 [R2-GigabitEthernet0/0/1.20]ip add 192.168.20.1 24 [R2-GigabitEthernet0/0/1.20]a b en [R2-GigabitEthernet0/0/1.20]dhcp select relay [R2-GigabitEthernet0/0/1.20]dhcp relay server-ip 14.0.0.2 [R2-GigabitEthernet0/0/1.20]q [R2]int g0/0/2 [R2-GigabitEthernet0/0/2]ip add 14.0.0.1 24 [R2-GigabitEthernet0/0/2]un sh [R2-GigabitEthernet0/0/2]int g0/0/0 [R2-GigabitEthernet0/0/0]ip add 12.0.0.1 24 [R2-GigabitEthernet0/0/0]un sh [R2-GigabitEthernet0/0/0]q [R2]ip route-static 15.0.0.0 24 12.0.0.2

R3路由器的配置

<Huawei>system-view [Huawei]sysname R3 [R3]int g0/0/0 [R3-GigabitEthernet0/0/0]ip add 12.0.0.2 24 [R3-GigabitEthernet0/0/0]un sh [R3-GigabitEthernet0/0/0]q [R3]dhcp enable [R3]int g0/0/1 [R3-GigabitEthernet0/0/1]ip add 15.0.0.1 24 [R3-GigabitEthernet0/0/1]dhcp select relay [R3-GigabitEthernet0/0/1]dhcp relay server-ip 14.0.0.2 [R3-GigabitEthernet0/0/1]q [R3]ip route-static 0.0.0.0 0.0.0.0 12.0.0.1

在R3上进行全网互通测试

[R3]ping 12.0.0.1 PING 12.0.0.1: 56 data bytes, press CTRL_C to break Reply from 12.0.0.1: bytes=56 Sequence=1 ttl=255 time=80 ms Reply from 12.0.0.1: bytes=56 Sequence=2 ttl=255 time=50 ms Reply from 12.0.0.1: bytes=56 Sequence=3 ttl=255 time=50 ms Reply from 12.0.0.1: bytes=56 Sequence=4 ttl=255 time=40 ms Reply from 12.0.0.1: bytes=56 Sequence=5 ttl=255 time=30 ms --- 12.0.0.1 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 30/50/80 ms [R3]ping 14.0.0.1 PING 14.0.0.1: 56 data bytes, press CTRL_C to break Reply from 14.0.0.1: bytes=56 Sequence=1 ttl=255 time=40 ms Reply from 14.0.0.1: bytes=56 Sequence=2 ttl=255 time=1 ms Reply from 14.0.0.1: bytes=56 Sequence=3 ttl=255 time=20 ms Reply from 14.0.0.1: bytes=56 Sequence=4 ttl=255 time=40 ms Reply from 14.0.0.1: bytes=56 Sequence=5 ttl=255 time=50 ms --- 14.0.0.1 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 1/30/50 ms [R3]ping 14.0.0.2 PING 14.0.0.2: 56 data bytes, press CTRL_C to break Reply from 14.0.0.2: bytes=56 Sequence=1 ttl=254 time=90 ms Reply from 14.0.0.2: bytes=56 Sequence=2 ttl=254 time=40 ms Reply from 14.0.0.2: bytes=56 Sequence=3 ttl=254 time=60 ms Reply from 14.0.0.2: bytes=56 Sequence=4 ttl=254 time=60 ms Reply from 14.0.0.2: bytes=56 Sequence=5 ttl=254 time=60 ms --- 14.0.0.2 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 40/62/90 ms
最新回复(0)