华为DHCP中继实战

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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值