华为DHCP中继

应用场景:
通常在DHCP分配网段过多的情况下,网关路由器上配置DHCP服务,压力过大,
一般我们用第二路由器,或则第二台DHCP服务器来分担业务
实验环境
准备五台没有IP地址主机我们利用DHCP服务来分配地址
拓扑图如下
在这里插入图片描述实验如下
在lsw设置
在全局模式下设置vlan batch 10 20
e0/0/1接口设置vlan10

sw]vlan batch 10 20
//在全局模式下设置为vlan10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw]
Dec 11 2019 10:15:57-08:00 sw DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 5, the ch
ange loop count is 0, and the maximum number of records is 4095.
[sw]int e0/0/1
//进入接口
[sw-Ethernet0/0/1]p l a
//设置access
[sw-Ethernet0/0/1]
Dec 11 2019 10:16:27-08:00 sw DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 6, the ch
ange loop count is 0, and the maximum number of records is 4095.
[sw-Ethernet0/0/1]p d v 10
//把vlan10 放到接口中

在e0/0/2设置vlan20

[sw-Ethernet0/0/1]int e0/0/2
[sw-Ethernet0/0/2]p l a
[sw-Ethernet0/0/2]p d 
Dec 11 2019 10:17:17-08:00 sw DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 8, the ch
ange loop count is 0, and the maximum number of records is 4095.a
                  ^
Error:Ambiguous command found at '^' position.
[sw-Ethernet0/0/2]p d v 20

在e0/0/3接口设置vlan10

[sw-Ethernet0/0/2]int e0/0/3
[sw-Ethernet0/0/3]p l a
[sw-Ethernet0/0/3]p 
Dec 11 2019 10:18:07-08:00 sw DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 10, the c
hange loop count is 0, and the maximum number of records is 4095.d 
                  ^
Error:Ambiguous command found at '^' position.
[sw-Ethernet0/0/3]p d v 10

在e0/0/4接口设置vlan10

[sw-Ethernet0/0/3]int e0/0/4
[sw-Ethernet0/0/4]p l a
[sw-Ethernet0/0/4]p d v
Dec 11 2019 10:19:28-08:00 sw DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 12, the c
hange loop count is 0, and the maximum number of records is 4095.
                  ^
Error:Ambiguous command found at '^' position.
[sw-Ethernet0/0/4]p d v 20
[sw-Ethernet0/0/4]

lsw设置完毕
设置R1
在全局模式下开启DHCP

R1]dhcp enable 
Info: The operation may take a few seconds. Please wait for a moment.done.
[R1]

进入逻辑子接口g0/0/1.10
在这里插入图片描述

[R1]int g0/0/1.20
[R1-GigabitEthernet0/0/1.20]dot t 
[R1-GigabitEthernet0/0/1.20]dot termination vid 20
[R1-GigabitEthernet0/0/1.20]ip add 192.168.20.1 24
[R1-GigabitEthernet0/0/1.20]a b e
[R1-GigabitEthernet0/0/1.20]dhcp select ra 
[R1-GigabitEthernet0/0/1.20]dhcp select r 
[R1-GigabitEthernet0/0/1.20]dhcp select relay 
[R1-GigabitEthernet0/0/1.20]dhcp relay server-ip 14.0.0.2
[R1-GigabitEthernet0/0/1.20]un do
                            ^
Error:Ambiguous command found at '^' position.
[R1-GigabitEthernet0/0/1.20]nu do
                            ^
Error: Unrecognized command found at '^' position.
[R1-GigabitEthernet0/0/1.20]un sh
Info: Interface GigabitEthernet0/0/1.20 is not shutdown.
[R1-GigabitEthernet0/0/1.20]
R1-GigabitEthernet0/0/1.20]int g0/0/2   //进入g0/0/2设置IP地址
[R1-GigabitEthernet0/0/2]ip add 14.0.0.1 24
[R1-GigabitEthernet0/0/2]un sh
Info: Interface GigabitEthernet0/0/2 is not shutdown.
[R1-GigabitEthernet0/0/2]int g0/0/0  //进入g0/0/0接口设置IP地址
[R1-GigabitEthernet0/0/0]ip add 12.0.0.1 24
[R1-GigabitEthernet0/0/0]un sh
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[R1-GigabitEthernet0/0/0]int g0/0/2
[R1-GigabitEthernet0/0/2]ip 
//在全局模式下设置默认路由下一跳指向12.0.0.2(R2)
1]ip route-stati 
[R1]ip route-static 0.0.0.0 0.0.0.0 12.0.0.2
[R1]

设置R2

[R2]int g0/0/1  //进入接口
[R2-GigabitEthernet0/0/1]ip add 15.0.0.1 24 //设置IP
[R2-GigabitEthernet0/0/1]un sh
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[R2-GigabitEthernet0/0/1]q
[R2]dhcp en 
[R2]dhcp enable  //在全局模式下设置DHCP
Info: The operation may take a few seconds. Please wait for a moment.done.
[R2]int g0/0/1
[R2-GigabitEthernet0/0/1]dhcp select relay   //指向DHCP服务器
[R2-GigabitEthernet0/0/1]dhcp re 
[R2-GigabitEthernet0/0/1]dhcp relay server-ip 14.0.0.2
[R2-GigabitEthernet0/0/1]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 12.0.0.2 24
[R2-GigabitEthernet0/0/0]un sh
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[R2-GigabitEthernet0/0/0]q
[R2]ip rou 
[R2]ip route-st 
[R2]ip route-static 0.0.0.0 0.0.0.0 12.0.0.1  //设置默认路由
[R2]

R3
在这里插入图片描述
pc机
在这里插入图片描述

发布了44 篇原创文章 · 获赞 10 · 访问量 1017

猜你喜欢

转载自blog.csdn.net/weixin_45725244/article/details/103490164