1.需要在三臺路由器上配置靜態路由,以實現各網段之間的互通
2.若要實現全網互通,必須明確如下兩個問題數據包被路由器轉發或丟棄,取決于是否能夠在路由表中找到數據包的目標地址所對應的條目路由器可以自動生成所有直連網段的路由條目,對于那些非直連網段就需要通過靜態路由指定了
3.因此,要想實現全網互通,就必須為每臺路由器指定所有非直連網段的路由條目
三臺路由器R1、R2、 R3兩兩互連,每臺路由器上都配置了Loopback地址模擬網絡環境
<Huawei>system-v //從用戶視圖進入系統視圖
[Huawei]sysname R1 //設置路由器名稱
[R1]int g0/0/0 //進入端口
[R1-GigabitEthernet0/0/0]ip add 12.0.0.1 24
[R1-GigabitEthernet0/0/0]q //從系統視圖返回到用戶視圖
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 13.0.0.1 24
[R1-GigabitEthernet0/0/1]q
[R1]int loo 0 //進入回環網卡接口
[R1-LoopBack0]ip add 1.1.1.1 32
[R1-LoopBack0]q
[R1]dis ip int b //查看接口狀態
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 12.0.0.1/24 up up
GigabitEthernet0/0/1 13.0.0.1/24 up up
LoopBack0 1.1.1.1/32 up up(s)
[R1]ip route-static 3.3.3.3 32 13.0.0.3
[R1]ip route-static 3.3.3.3 32 12.0.0.2
[R1]ip route-static 2.2.2.2 32 13.0.0.3
[R1]ip route-static 2.2.2.2 32 12.0.0.2
//配置路由靜態路由
[R1]display ip routing-table //查看路由表
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
<Huawei>system-v
[Huawei]sysname R2
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 12.0.0.2 24
[R2-GigabitEthernet0/0/0]q
[R2]int g0/0/2
[R2-GigabitEthernet0/0/2]ip add 23.0.0.2 24
[R2-GigabitEthernet0/0/2]q
[R2]int loo 0
[R2-LoopBack0]ip add 2.2.2.2 32
[R2-LoopBack0]q
[R2]ip route-static 1.1.1.1 32 12.0.0.1
[R2]ip route-static 1.1.1.1 32 23.0.0.3
[R2]ip route-static 3.3.3.3 32 12.0.0.1
[R2]ip route-static 3.3.3.3 32 23.0.0.3
[R2]dis ip int b
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 12.0.0.2/24 up up
GigabitEthernet0/0/2 23.0.0.2/24 up up
LoopBack0 2.2.2.2/32 up up(s)
[R2]display ip routing-table
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/2
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/2
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/2
23.0.0.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
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
<Huawei>system-v
[Huawei]sysname R3
[R3]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 13.0.0.3 24
[R3-GigabitEthernet0/0/1]q
[R3]int g0/0/2
[R3-GigabitEthernet0/0/2]ip add 23.0.0.3 24
[R3-GigabitEthernet0/0/2]q
[R3]int loo 0
[R3-LoopBack0]ip add 3.3.3.3 32
[R3-LoopBack0]q
[R3]dis ip int b
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/1 13.0.0.3/24 up up
GigabitEthernet0/0/2 23.0.0.3/24 up up
LoopBack0 3.3.3.3/32 up up(s)
[R3]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 7 Routes : 7
Destination/Mask Proto Pre Cost Flags NextHop Interface
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/1
13.0.0.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
23.0.0.0/24 Direct 0 0 D 23.0.0.3 GigabitEthernet
0/0/2
23.0.0.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
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
1.測試R2與R1的互聯互通
[R2]ping -a 2.2.2.2 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 tt1=255
time=120 ms
Reply from 1.1.1.1:
bytes=56
Sequence=2 tt1=255
time=15 ms
Reply from 1.1.1.1: bytes=56 Sequence=3 tt1=255
time=15 ms
Reply from 1.1.1.1:
bytes=56 Sequence=4 tt1=255 time=30 ms
Reply from 1.1.1.1:
bytes=56 Sequence=5 tt1=255 time=20 ms
1.1.1.1 ping statistics ---
5 packet (s) t r ansmi tted
5 packet (s) received
0.00%packet 1083
round-trip min/ avg/max = 20/54/120 ms
2.測試R2與R3的互聯互通
[R2 ]ping -a 2.2.2.2 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 tt1=255 time-30 ms
Reply from 3.3.3.3:
bytes=56 Sequence=2 tt1=255 time=40
ms
Reply from 3.3.3.3: bytes=56 Sequence=3 tt1=255 time=50 ms
Reply from 3.3.3.3: bytes=56 Sequence=4 tt1=255 time=30 ms
Reply from 3.3.3.3: bytes=56 Sequence=5 tt1=255 time=30 ms
3.3.3.3 ping statistics
5 packet (s) t r ansmi tted
5 packet (s) received
0.00%packet 1083
round- trip min/ avg/max = 30/ 36/50 ms
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。