要求:1.全网可达;2.PC5和PC2需要动态路由配置DHCP,3.客服端可以接受到服务端的信息,4.R5和R1有换回路由5.R6,R5,R6互相之间不能设置下一跳直连(练习是我自己编的,使用使用指定路由网段,后面会修改)
首先配置路由器(R1,R4,R5,R6):
//R1SYS Enter system view, return user view with Ctrl+Z. [Huawei]SYSN R1 [R1]interface g0/0/1 [R1-GigabitEthernet0/0/1]ip address 4.0.0.2 24 Nov 12 2021 12:29:17-08:00 R1 %%01IFNET/4/link_STATE(l)[3]:The line protocol IP on the interface GigabitEthernet0/0/1 has entered the UP state. [R1-GigabitEthernet0/0/1]int g0/0/2 [R1-GigabitEthernet0/0/2]ip address 1.0.0.2 24 Nov 12 2021 12:30:07-08:00 R1 %%01IFNET/4/link_STATE(l)[4]:The line protocol IP on the interface GigabitEthernet0/0/2 has entered the UP state. [R1-GigabitEthernet0/0/2]int g0/0/0 [R1-GigabitEthernet0/0/0]ip add [R1-GigabitEthernet0/0/0]ip address 2.0.0.2 24 Nov 12 2021 12:30:37-08:00 R1 %%01IFNET/4/link_STATE(l)[5]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state. [R1-GigabitEthernet0/0/0]q //R4 SYS Enter system view, return user view with Ctrl+Z. [Huawei]SYSN R4 [R4]inter [R4]interface g0/0/0 [R4-GigabitEthernet0/0/0]ip address 4.0.0.1 24 //R6 SYS Enter system view, return user view with Ctrl+Z. [Huawei]SYSN R6 [R6]interface g0/0/0 [R6-GigabitEthernet0/0/0]ip address 2.0.0.1 24 [R6]interface g0/0/1 [R6-GigabitEthernet0/0/1]ip address 3.0.0.1 24 //R5 system-view Enter system view, return user view with Ctrl+Z. [Huawei]SYSN R5 [R5]interface g0/0/1 [R5-GigabitEthernet0/0/1]ip address 5.0.0.1 24 Nov 12 2021 12:27:47-08:00 R5 %%01IFNET/4/link_STATE(l)[1]:The line protocol IP on the interface GigabitEthernet0/0/1 has entered the UP state. [R5-GigabitEthernet0/0/1]int g0/0/0 [R5-GigabitEthernet0/0/0]ip address 1.0.0.1 24 Nov 12 2021 12:28:06-08:00 R5 %%01IFNET/4/link_STATE(l)[2]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state. [R5-GigabitEthernet0/0/0]q
然后开始配置DHCP: (DHCP的四个过程见前文)
//R4 [R4-GigabitEthernet0/0/1]ip address 192.168.3.1 24 Nov 12 2021 14:00:58-08:00 R4 %%01IFNET/4/link_STATE(l)[1]:The line protocol IP on the interface GigabitEthernet0/0/1 has entered the UP state. //我这里出了问题,没有先配置网络接口就先设置了HCDP(顺序已改正) [R4]dhcp enable Info: The operation may take a few seconds. Please wait for a moment.done. [R4]ip pool daibi Info: It's successful to create an IP address pool. [R4-ip-pool-daibi]network 192.168.3.0 ? mask MaskPlease press ENTER to execute command [R4-ip-pool-daibi]network 192.168.3.0 mask 24 [R4-ip-pool-daibi]gateway-list 192.168.3.1 [R4-ip-pool-daibi]dns-list 144.144.144.144 8.8.8.8 [R4-ip-pool-daibi]q [R4]inter [R4]interface g0/0/1 [R4-GigabitEthernet0/0/1]dhcp select global [R4-GigabitEthernet0/0/1]q //R6 [R6-GigabitEthernet0/0/1]ip address 192.168.5.1 24 Nov 12 2021 14:00:58-08:00 R4 %%01IFNET/4/link_STATE(l)[1]:The line protocol IP on the interface GigabitEthernet0/0/1 has entered the UP state. [R6]dhcp enable Info: The operation may take a few seconds. Please wait for a moment.done. [R6]ip pool shabi Info: It's successful to create an IP address pool. [R6-ip-pool-shabi]network 192.168.5.0 mask 24 [R6-ip-pool-shabi]gateway-list 192.168.5.1 [R6-ip-pool-shabi]dns-list 144.144.144.144 [R6-ip-pool-shabi]q [R6]interface g0/0/2 [R6-GigabitEthernet0/0/2]dhcp select global [R6-GigabitEthernet0/0/2]q
然后开始配置(R1,R5)环回路由:
//R5 [R5]interface LoopBack 0 [R5-LoopBack0]ip address 192.168.9.0 24 Error: The specified IP address is invalid. //这里有配置环路路由设置错误(设置成广播地址) [R5-LoopBack0]ip address 192.168.9.1 24 //R1 [R1]interface LoopBack 0 [R1-LoopBack0]ip add [R1-LoopBack0]ip address 192.168.1.1 24
然后配置缺省路由:
//R4(R1的G0/0/1口) [R4]ip route-static 0.0.0.0 0 4.0.0.2 //R5(R1的G0/0/2口) [R5]ip route-static 0.0.0.0 0 1.0.0.2 //R6(R1的G0/0/0口) [R6]ip route-static 0.0.0.0 0 2.0.0.2
在R1设置下一跳配置:
[R1]ip route-static 192.168.3.0 24 4.0.0.1 [R1]ip route-static 3.0.0.0 24 2.0.0.1 [R1]ip route-static 192.168.5.0 24 2.0.0.1 [R1]ip route-static 5.0.0.0 24 1.0.0.1 [R1]ip route-static 192.168.9.0 24 1.0.0.1
现在已经做到全网联通,开始设置客户端和服务端



