要求:用靜態(tài)路由中的下一跳方法和環(huán)回接口實現(xiàn)三臺路由器的全網(wǎng)可達
1.先配置三臺路由總共四個物理接口的ip
<Huawei>sys
[Huawei]sys r1
[r1]user-interface console 0
[r1-ui-console0]idle-timeout 0 0
[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ip address 12.1.1.1 24
Apr 7 2023 23:22:34-08:00 r1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
<Huawei>sys
[Huawei]sys r2
[r2]user-interface console 0
[r2-ui-console0]idle-timeout 0 0
[r2]interface GigabitEthernet 0/0/1
[r2-GigabitEthernet0/0/1]ip ad 12.1.1.2 24
Apr 7 2023 23:23:48-08:00 r2 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r2]interface GigabitEthernet 0/0/0
[r2-GigabitEthernet0/0/0]ip ad 24.1.1.1 24
Apr 7 2023 23:24:33-08:00 r2 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
<Huawei>sys
[Huawei]sys r3
[r3]user-interface console 0
[r3-ui-console0]idle-timeout 0 0
[r3]interface GigabitEthernet 0/0/1
[r3-GigabitEthernet0/0/1]ip ad 24.1.1.2 24
Apr 7 2023 23:25:09-08:00 r3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
2.利用下一跳做好四個接口的路由
[r1]ip route-static 24.1.1.0 24 12.1.1.2
[r3]ip route-static 12.1.1.0 24 24.1.1.1
r2在中間直連r1和r3,故不用配置。路由與通信沒有直接關(guān)系,在只配置一臺下一跳路由時,r1有了到r3的路由,但是r3不知道r1的網(wǎng)段,數(shù)據(jù)從r1到r3后,r3不能將數(shù)據(jù)路由到r1,這一點需要注意。
3.創(chuàng)建環(huán)回接口(虛擬接口),并實現(xiàn)三臺路由器之間的環(huán)回路由
[r1]interface LoopBack 0
[r1-LoopBack0]ip ad 1.1.1.1 24
[r2]interface LoopBack 0
[r2-LoopBack0]ip ad 2.2.2.2 24
[r3]interface LoopBack 0
[r3-LoopBack0]ip ad 3.3.3.3 24
配置三個路由器的環(huán)回接口,然后配置三個接口的路由。雖然兩兩之間進行了物理直連,但是虛擬接口之間并沒有路由通信,所以要讓互相路由。
r1配置:
[r1]ip route-static 2.2.2.0 24 12.1.1.2
[r1]ip route-static 3.3.3.0 24 12.1.1.2
r2配置:
[r2]ip route-static 1.1.1.0 24 12.1.1.1
[r2]ip route-static 3.3.3.0 24 24.1.1.2
r3配置:
[r3]ip route-static 1.1.1.0 24 24.1.1.1
[r3]ip route-static 2.2.2.0 24 24.1.1.1
4.查看路由表:
在最后養(yǎng)成查看路由表的習(xí)慣,其實要在每一步都要檢查一下自己的路由表為及時改正錯誤。我這里已經(jīng)直接把路由配完了。所以最后查看路由表。
r1路由表:
[r1]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 13 Routes : 13
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.0/24 Direct 0 0 D 1.1.1.1 LoopBack0
1.1.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
1.1.1.255/32 Direct 0 0 D 127.0.0.1 LoopBack0
2.2.2.0/24 Static 60 0 RD 12.1.1.2 GigabitEthernet
0/0/0
3.3.3.0/24 Static 60 0 RD 12.1.1.2 GigabitEthernet
0/0/0
12.1.1.0/24 Direct 0 0 D 12.1.1.1 GigabitEthernet
0/0/0
12.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
12.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
24.1.1.0/24 Static 60 0 RD 12.1.1.2 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
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
r2路由表:
[r2]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 15 Routes : 15
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.0/24 Static 60 0 RD 12.1.1.1 GigabitEthernet
0/0/1
2.2.2.0/24 Direct 0 0 D 2.2.2.2 LoopBack0
2.2.2.2/32 Direct 0 0 D 127.0.0.1 LoopBack0
2.2.2.255/32 Direct 0 0 D 127.0.0.1 LoopBack0
3.3.3.0/24 Static 60 0 RD 24.1.1.2 GigabitEthernet
0/0/0
12.1.1.0/24 Direct 0 0 D 12.1.1.2 GigabitEthernet
0/0/1
12.1.1.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
12.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
24.1.1.0/24 Direct 0 0 D 24.1.1.1 GigabitEthernet
0/0/0
24.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
24.1.1.255/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
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
r3路由表:
[r3]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 13 Routes : 13
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.0/24 Static 60 0 RD 24.1.1.1 GigabitEthernet
0/0/1
2.2.2.0/24 Static 60 0 RD 24.1.1.1 GigabitEthernet
0/0/1
3.3.3.0/24 Direct 0 0 D 3.3.3.3 LoopBack0
3.3.3.3/32 Direct 0 0 D 127.0.0.1 LoopBack0
3.3.3.255/32 Direct 0 0 D 127.0.0.1 LoopBack0
12.1.1.0/24 Static 60 0 RD 24.1.1.1 GigabitEthernet
0/0/1
24.1.1.0/24 Direct 0 0 D 24.1.1.2 GigabitEthernet
0/0/1
24.1.1.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
24.1.1.255/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
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
5.結(jié)果:文章來源:http://www.zghlxwxcb.cn/news/detail-508567.html
r1:
[r1]ping 2.2.2.2
PING 2.2.2.2: 56 data bytes, press CTRL_C to break
Reply from 2.2.2.2: bytes=56 Sequence=1 ttl=255 time=40 ms
Reply from 2.2.2.2: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 2.2.2.2: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 2.2.2.2: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 2.2.2.2: bytes=56 Sequence=5 ttl=255 time=40 ms
[r1]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=254 time=20 ms
Reply from 3.3.3.3: bytes=56 Sequence=2 ttl=254 time=20 ms
Reply from 3.3.3.3: bytes=56 Sequence=3 ttl=254 time=40 ms
Reply from 3.3.3.3: bytes=56 Sequence=4 ttl=254 time=30 ms
Reply from 3.3.3.3: bytes=56 Sequence=5 ttl=254 time=40 ms
[r1]ping 24.1.1.2
PING 24.1.1.2: 56 data bytes, press CTRL_C to break
Reply from 24.1.1.2: bytes=56 Sequence=1 ttl=254 time=30 ms
Reply from 24.1.1.2: bytes=56 Sequence=2 ttl=254 time=20 ms
Reply from 24.1.1.2: bytes=56 Sequence=3 ttl=254 time=30 ms
Reply from 24.1.1.2: bytes=56 Sequence=4 ttl=254 time=30 ms
Reply from 24.1.1.2: bytes=56 Sequence=5 ttl=254 time=30 ms
r2:
[r2]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=20 ms
Reply from 1.1.1.1: bytes=56 Sequence=2 ttl=255 time=30 ms
Reply from 1.1.1.1: bytes=56 Sequence=3 ttl=255 time=30 ms
Reply from 1.1.1.1: bytes=56 Sequence=4 ttl=255 time=40 ms
Reply from 1.1.1.1: bytes=56 Sequence=5 ttl=255 time=20 ms
[r2]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=20 ms
Reply from 3.3.3.3: bytes=56 Sequence=2 ttl=255 time=10 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=20 ms
Reply from 3.3.3.3: bytes=56 Sequence=5 ttl=255 time=40 ms
r3:
[r3]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=254 time=30 ms
Reply from 1.1.1.1: bytes=56 Sequence=2 ttl=254 time=40 ms
Reply from 1.1.1.1: bytes=56 Sequence=3 ttl=254 time=40 ms
Reply from 1.1.1.1: bytes=56 Sequence=4 ttl=254 time=40 ms
Reply from 1.1.1.1: bytes=56 Sequence=5 ttl=254 time=30 ms
[r3]ping 2.2.2.2
PING 2.2.2.2: 56 data bytes, press CTRL_C to break
Reply from 2.2.2.2: bytes=56 Sequence=1 ttl=255 time=20 ms
Reply from 2.2.2.2: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 2.2.2.2: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 2.2.2.2: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 2.2.2.2: bytes=56 Sequence=5 ttl=255 time=40 ms
[r3]ping 12.1.1.1
PING 12.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 12.1.1.1: bytes=56 Sequence=1 ttl=254 time=20 ms
Reply from 12.1.1.1: bytes=56 Sequence=2 ttl=254 time=40 ms
Reply from 12.1.1.1: bytes=56 Sequence=3 ttl=254 time=30 ms
Reply from 12.1.1.1: bytes=56 Sequence=4 ttl=254 time=30 ms
Reply from 12.1.1.1: bytes=56 Sequence=5 ttl=254 time=40 ms
?文章來源地址http://www.zghlxwxcb.cn/news/detail-508567.html
到了這里,關(guān)于靜態(tài)路由用下一跳方法配置的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!