DHCP中继实验

DHCP中继实验
DHCP中继原理:在连接不同网段的设备上开启DHCP中继功能,将DHCP这种特殊的广播信息在VLAN之间转发,让其他VLAN的客户机也能从DHCP服务器那里获得IP地址。
DHCP应用场景:
通常在DHCP分配网段过多的情况下,网关路由器上配置DHCP服务,压力过大,
一般我们用第二路由器,或则第二台DHCP服务器来分担业务
交换机以及路由器的配置命令如下:
LSW1:
u t m
Info: Current terminal monitor is off.
sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname sw1
[sw1]v b 10 20
Info: This operation may take a few seconds. Please wait for a moment…done.
[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
Info: Interface Ethernet0/0/1 is not shutdown.
[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
Info: Interface Ethernet0/0/2 is not shutdown.
[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
Info: Interface Ethernet0/0/3 is not shutdown.
[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
Info: Interface Ethernet0/0/4 is not shutdown.
[sw1-Ethernet0/0/4]int g0/0/1
[sw1-GigabitEthernet0/0/1]p l t
[sw1-GigabitEthernet0/0/1]p t a v 10 20
[sw1-GigabitEthernet0/0/1]un sh
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[sw1-GigabitEthernet0/0/1]q

R1:
u t m
Info: Current terminal monitor is off.
sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R1
[R1]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]un sh
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[R1]int g0/0/1.10
[R1-GigabitEthernet0/0/1.10]ip add 192.168.10.1 24
[R1-GigabitEthernet0/0/1.10]dot1q termination vid 10
[R1-GigabitEthernet0/0/1.10]arp broadcast enable
[R1-GigabitEthernet0/0/1.10]dhcp select relay
[R1-GigabitEthernet0/0/1.10]dhcp relay server-ip 14.0.0.2
[R1-GigabitEthernet0/0/1.10]q
[R1]int g0/0/1.20
[R1-GigabitEthernet0/0/1.20]ip add 192.168.20.1 24
[R1-GigabitEthernet0/0/1.20]dot1q termination vid 20
[R1-GigabitEthernet0/0/1.20]arp broadcast enable
[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]q
[R1]int g0/0/0
[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 add 14.0.0.1 24
[R1-GigabitEthernet0/0/2]un sh
Info: Interface GigabitEthernet0/0/2 is not shutdown.
[R1-GigabitEthernet0/0/2]q
[R1]

Please check whether system data has been changed, and save data in time

Configuration console time out, please press any key to log on

sys
Enter system view, return user view with Ctrl+Z.
[R1]ip route-static 15.0.0.0 24 12.0.0.2

R2:
u t m
Info: Current terminal monitor is off.
sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R2
[R2]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[R2]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]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 15.0.0.1 24
[R2-GigabitEthernet0/0/1]un sh
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[R2-GigabitEthernet0/0/1]dhcp select relay
[R2-GigabitEthernet0/0/1]dhcp relay server-ip 14.0.0.2
[R2-GigabitEthernet0/0/1]q
[R2]

Please check whether system data has been changed, and save data in time

Configuration console time out, please press any key to log on

sys
Enter system view, return user view with Ctrl+Z.
[R2]ip route-static 0.0.0.0 0.0.0.0 12.0.0.1

R3:
u t m
Info: Current terminal monitor is off.
sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R3
[R3]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]dhcp select global
[R3-GigabitEthernet0/0/0]ip add 14.0.0.2 24
[R3-GigabitEthernet0/0/0]un sh
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[R3-GigabitEthernet0/0/0]q
[R3]ip pool DHCP15.0.0.0
Info: It’s successful to create an IP address pool.
[R3-ip-pool-DHCP15.0.0.0]network 15.0.0.0 mask 24
[R3-ip-pool-DHCP15.0.0.0]gateway-list 15.0.0.1
[R3-ip-pool-DHCP15.0.0.0]dns-list 8.8.8.8 2.2.2.2
[R3-ip-pool-DHCP15.0.0.0]q
[R3]ip pool DHCPvlan10
Info: It’s successful to create an IP address pool.
[R3-ip-pool-DHCPvlan10]network 192.168.10.0 mask 24
[R3-ip-pool-DHCPvlan10]gateway-list 192.168.10.1
[R3-ip-pool-DHCPvlan10]dns-list 8.8.8.8 2.2.2.2
[R3-ip-pool-DHCPvlan10]q
[R3]ip pool DHCPvlan20
Info: It’s successful to create an IP address pool.
[R3-ip-pool-DHCPvlan20]network 192.168.20.0 mask 24
[R3-ip-pool-DHCPvlan20]gateway-list 192.168.20.1
[R3-ip-pool-DHCPvlan20]dns-list 8.8.8.8 2.2.2.2
[R3-ip-pool-DHCPvlan20]int g0/0/0
[R3-GigabitEthernet0/0/0]dhcp select global
[R3-GigabitEthernet0/0/0]q
[R3]ip route-static 0.0.0.0 0.0.0.0 14.0.0.1

各个PC机均需要设置为DHCP自动获取IP地址,设置完成后一定要点“应用”。进入PC机的命令行,输入“ipconfig”获取IP地址,如果获取不到地址,输入“ipconfig /release”释放一下,再输入“ipconfig /renew”重新获取IP地址。最终实现各个PC之间的互通。
DHCP中继实验
DHCP中继实验

注:
命令中简写字母全名如下:
sys(system-view)
p l a (port link-type access)
p d v (port default vlan)
P l t (port link-type trunk)
P t a v (port trunk allow-pass vlan)
u t m (undo terminal monitor)
un sh(undo shutdown)

若配置完成后,发现某些PC机之间或者PC与路由器之间ping不通的问题,这时就需要对线路进行排障!
关于业务排障的注意事项总结以下几个问题:
1.必须了解服务端业务相关的协议、端口(数据流)
2.必须了解服务端和客户端数据交互的流程(报文协议、三次握手、四次挥手)
3.必须了解网络拓扑图架构,相关的数据流是否放通(协议、端口、网段)
4.必须了解排障的相关的工具和命令