<Huawei> <Huawei>system-view //進入用戶視圖 Enter system view, return user view with Ctrl+Z. [Huawei]sysname R1 //修改路由名稱爲R1 [R1] [R1]int g 0/0/0 //進入g0/0/0接口 [R1-GigabitEthernet0/0/0]ip add 192.168.10.1 24 //配置IP [R1-GigabitEthernet0/0/0]undo shut //開啓 Info: Interface GigabitEthernet0/0/0 is not shutdown. [R1-GigabitEthernet0/0/0]q //返回普通視圖 [R1]int g 0/0/1 [R1-GigabitEthernet0/0/1]ip add 12.0.0.1 30 [R1-GigabitEthernet0/0/1]un sh [R1-GigabitEthernet0/0/1]q [R1]
<Huawei> <Huawei>sys [Huawei]sys R2 [R2] [R2]int g 0/0/0 [R2-GigabitEthernet0/0/0]ip add 12.0.0.2 30 [R2-GigabitEthernet0/0/0]un sh Info: Interface GigabitEthernet0/0/0 is not shutdown. [R2-GigabitEthernet0/0/0]q [R2]int LoopBack 0 //進入迴環網卡lo0中(且迴環網卡不須要undo shut) [R2-LoopBack0]ip add 2.2.2.2 [R2-LoopBack0]q [R2]
此時,雖然兩臺路由均在接口上配置了IP地址,但因爲存在多網段,因此仍須要配置靜態/默認路由。ide
[R1] [R1]ip route-static 0.0.0.0 0.0.0.0 12.0.0.2 //容許全部網段經過 [R1]int g 0/0/1 [R1-GigabitEthernet0/0/1]dis ip routing Route Flags: R - relay, D - download to fib ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 7 Routes : 7 Destination/Mask Proto Pre Cost Flags NextHop Interface 0.0.0.0/0 Static 60 0 RD 12.0.0.2 GigabitEthernet 0/0/1 12.0.0.0/30 Direct 0 0 D 12.0.0.1 GigabitEthernet 0/0/1 12.0.0.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 192.168.10.0/24 Direct 0 0 D 192.168.10.1 GigabitEthernet 0/0/0 192.168.10.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 [R1-GigabitEthernet0/0/1]q [R1]
[R2] [R2]ip route-static 192.168.10.0 24 12.0.0.1 //學習10.0網段 [R2]int g0/0/0 [R2-GigabitEthernet0/0/0]dis ip routing Route Flags: R - relay, D - download to fib ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 6 Routes : 6 Destination/Mask Proto Pre Cost Flags NextHop Interface 2.2.2.2/32 Direct 0 0 D 127.0.0.1 LoopBack0 12.0.0.0/30 Direct 0 0 D 12.0.0.2 GigabitEthernet 0/0/0 12.0.0.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 192.168.10.0/24 Static 60 0 RD 12.0.0.1 GigabitEthernet 0/0/0 [R2-GigabitEthernet0/0/0]q [R2]
PC>ping 192.168.10.20 //聯通另外一臺PC機 Ping 192.168.10.20: 32 data bytes, Press Ctrl_C to break From 192.168.10.20: bytes=32 seq=1 ttl=128 time=47 ms From 192.168.10.20: bytes=32 seq=2 ttl=128 time=31 ms --- 192.168.10.20 ping statistics --- 2 packet(s) transmitted 2 packet(s) received 0.00% packet loss round-trip min/avg/max = 31/39/47 ms PC>ping 2.2.2.2 //嘗試聯通不一樣網段的Lo0迴環網卡 Ping 2.2.2.2: 32 data bytes, Press Ctrl_C to break From 2.2.2.2: bytes=32 seq=1 ttl=254 time=78 ms From 2.2.2.2: bytes=32 seq=2 ttl=254 time=78 ms From 2.2.2.2: bytes=32 seq=3 ttl=254 time=594 ms From 2.2.2.2: bytes=32 seq=4 ttl=254 time=78 ms From 2.2.2.2: bytes=32 seq=5 ttl=254 time=62 ms --- 2.2.2.2 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 62/178/594 ms PC>
R3oop
<Huawei>sy Enter system view, return user view with Ctrl+Z. [Huawei]sys R3 [R3]int g0/0/0 [R3-GigabitEthernet0/0/0]ip add 12.0.0.1 24 [R3-GigabitEthernet0/0/0]un sh Info: Interface GigabitEthernet0/0/0 is not shutdown. [R3-GigabitEthernet0/0/0]q [R3]int g0/0/1 [R3-GigabitEthernet0/0/1]ip add 13.0.0.1 24 [R3-GigabitEthernet0/0/1]un sh Info: Interface GigabitEthernet0/0/1 is not shutdown. [R3-GigabitEthernet0/0/1]q [R3] [R3]int loo 0 [R3-LoopBack0]ip add 1.1.1.1 32 [R3-LoopBack0]q [R3]
R4學習
<Huawei>sy Enter system view, return user view with Ctrl+Z. [Huawei]sys [Huawei]sysname R4 [R4]int g0/0/0 [R4-GigabitEthernet0/0/0]ip add 12.0.0.2 24 [R4-GigabitEthernet0/0/0]un sh Info: Interface GigabitEthernet0/0/0 is not shutdown. [R4-GigabitEthernet0/0/0]q [R4]int g 0/0/1 [R4-GigabitEthernet0/0/1]ip add 23.0.0.2 24 [R4-GigabitEthernet0/0/1]un sh Info: Interface GigabitEthernet0/0/1 is not shutdown. [R4-GigabitEthernet0/0/1]q [R4]int LoopBack 0 [R4-LoopBack0]ip add 2.2.2.2 32 [R4-LoopBack0]q [R4]
R5code
<Huawei>sy Enter system view, return user view with Ctrl+Z. [Huawei]sys R5 [R5]int g 0/0/0 [R5-GigabitEthernet0/0/0]ip add 13.0.0.3 24 [R5-GigabitEthernet0/0/0]un sh Info: Interface GigabitEthernet0/0/0 is not shutdown. [R5-GigabitEthernet0/0/0]q [R5]int g 0/0/1 [R5-GigabitEthernet0/0/1]ip add 23.0.0.3 24 [R5-GigabitEthernet0/0/1]un sh Info: Interface GigabitEthernet0/0/1 is not shutdown. [R5-GigabitEthernet0/0/1]q [R5]int loo 0 [R5-LoopBack0]ip add 3.3.3.3 32 [R5-LoopBack0]q [R5]
R3blog
[R3] [R3]ip route-static 3.3.3.3 32 13.0.0.3 [R3]ip route-static 3.3.3.3 32 12.0.0.2 [R3]ip route-static 2.2.2.2 32 13.0.0.3 [R3]ip route-static 2.2.2.2 32 12.0.0.2 [R3]dis ip routing Route Flags: R - relay, D - download to fib ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 9 Routes : 11 Destination/Mask Proto Pre Cost Flags NextHop Interface 1.1.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0 2.2.2.2/32 Static 60 0 RD 13.0.0.3 GigabitEthernet 0/0/1 Static 60 0 RD 12.0.0.2 GigabitEthernet 0/0/0 3.3.3.3/32 Static 60 0 RD 13.0.0.3 GigabitEthernet 0/0/1 Static 60 0 RD 12.0.0.2 GigabitEthernet 0/0/0 12.0.0.0/24 Direct 0 0 D 12.0.0.1 GigabitEthernet 0/0/0 12.0.0.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 13.0.0.0/24 Direct 0 0 D 13.0.0.1 GigabitEthernet 0/0/1 13.0.0.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 [R3]
R4接口
[R4] [R4]ip route-static 1.1.1.1 32 12.0.0.1 [R4]ip route-static 1.1.1.1 32 23.0.0.3 [R4]ip route-static 3.3.3.3 32 12.0.0.1 [R4]ip route-static 3.3.3.3 32 23.0.0.3 [R4]dis ip routing Route Flags: R - relay, D - download to fib ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 9 Routes : 11 Destination/Mask Proto Pre Cost Flags NextHop Interface 1.1.1.1/32 Static 60 0 RD 12.0.0.1 GigabitEthernet 0/0/0 Static 60 0 RD 23.0.0.3 GigabitEthernet 0/0/1 2.2.2.2/32 Direct 0 0 D 127.0.0.1 LoopBack0 3.3.3.3/32 Static 60 0 RD 12.0.0.1 GigabitEthernet 0/0/0 Static 60 0 RD 23.0.0.3 GigabitEthernet 0/0/1 12.0.0.0/24 Direct 0 0 D 12.0.0.2 GigabitEthernet 0/0/0 12.0.0.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 23.0.0.0/24 Direct 0 0 D 23.0.0.2 GigabitEthernet 0/0/1 23.0.0.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 [R4]
R5ip
[R5] [R5]ip route-static 1.1.1.1 32 13.0.0.1 [R5]ip route-static 1.1.1.1 32 23.0.0.2 [R5]ip route-static 2.2.2.2 32 13.0.0.1 [R5]ip route-static 2.2.2.2 32 23.0.0.2 [R5]dis ip routing Route Flags: R - relay, D - download to fib ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 9 Routes : 11 Destination/Mask Proto Pre Cost Flags NextHop Interface 1.1.1.1/32 Static 60 0 RD 13.0.0.1 GigabitEthernet 0/0/0 Static 60 0 RD 23.0.0.2 GigabitEthernet 0/0/1 2.2.2.2/32 Static 60 0 RD 13.0.0.1 GigabitEthernet 0/0/0 Static 60 0 RD 23.0.0.2 GigabitEthernet 0/0/1 3.3.3.3/32 Direct 0 0 D 127.0.0.1 LoopBack0 13.0.0.0/24 Direct 0 0 D 13.0.0.3 GigabitEthernet 0/0/0 13.0.0.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 23.0.0.0/24 Direct 0 0 D 23.0.0.3 GigabitEthernet 0/0/1 23.0.0.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 [R5]
#R3 [R3]ping 3.3.3.3 PING 3.3.3.3: 56 data bytes, press CTRL_C to break Reply from 3.3.3.3: bytes=56 Sequence=1 ttl=255 time=50 ms Reply from 3.3.3.3: bytes=56 Sequence=2 ttl=255 time=40 ms Reply from 3.3.3.3: bytes=56 Sequence=3 ttl=255 time=20 ms Reply from 3.3.3.3: bytes=56 Sequence=4 ttl=255 time=10 ms Reply from 3.3.3.3: bytes=56 Sequence=5 ttl=255 time=40 ms --- 3.3.3.3 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 10/32/50 ms [R3] #R4 [R4]ping 1.1.1.1 PING 1.1.1.1: 56 data bytes, press CTRL_C to break Reply from 1.1.1.1: bytes=56 Sequence=1 ttl=255 time=80 ms Reply from 1.1.1.1: bytes=56 Sequence=2 ttl=255 time=50 ms Reply from 1.1.1.1: bytes=56 Sequence=3 ttl=255 time=50 ms Reply from 1.1.1.1: bytes=56 Sequence=4 ttl=255 time=30 ms Reply from 1.1.1.1: bytes=56 Sequence=5 ttl=255 time=50 ms --- 1.1.1.1 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 30/52/80 ms [R4] #R5 [R5]ping 1.1.1.1 PING 1.1.1.1: 56 data bytes, press CTRL_C to break Reply from 1.1.1.1: bytes=56 Sequence=1 ttl=255 time=50 ms Reply from 1.1.1.1: bytes=56 Sequence=2 ttl=255 time=50 ms Reply from 1.1.1.1: bytes=56 Sequence=3 ttl=255 time=50 ms Reply from 1.1.1.1: bytes=56 Sequence=4 ttl=255 time=50 ms --- 1.1.1.1 ping statistics --- 4 packet(s) transmitted 4 packet(s) received 0.00% packet loss round-trip min/avg/max = 50/50/50 ms [R5]