天天看點

浮動靜态路由

浮動靜态路由

<a href="http://yuzeying.blog.51cto.com/attachment/200907/14/644976_1247583355lBKJ.jpg"></a>

我簡單地試驗拓撲

Router&amp;gt;en

Router#conf t

Enter configuration commands, one per line. End with CNTL/Z.

Router(config)#host ru1

ru1(config)#int s0/0

ru1(config-if)#ip add 192.168.10.1 255.255.255.0

ru1(config-if)#clock rate 64000

ru1(config-if)#no shut

%LINK-5-CHANGED: Interface Serial0/0, changed state to down

ru1(config-if)#exit

ru1(config)#int s0/1

ru1(config-if)#ip add 192.168.11.1 255.255.255.0

%LINK-5-CHANGED: Interface Serial0/1, changed state to down

ru1(config)#int f0/0

ru1(config-if)#ip add 172.16.1.1 255.255.255.0

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

ru1(config)#

%LINK-5-CHANGED: Interface Serial0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up

%LINK-5-CHANGED: Interface Serial0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1, changed state to up

第一個路由器上的基本配置

這裡我把兩個接口下 均設定了 時鐘頻率 不知道有錯沒有

Router(config)#host ru2

ru2(config)#int s0/0

ru2(config-if)#ip add 192.168.10.2 255.255.255.0

ru2(config-if)#no shut

ru2(config-if)#

%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to upexit

ru2(config)#int s0/1

ru2(config-if)#ip add 192.168.11.2 255.255.255.0

%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1, changed state to upexit

ru2(config)#int f0/0

ru2(config-if)#ip add 172.16.2.1 255.255.255.0

ru2(config-if)#exit

ru2(config)#

我第二個路由器上的基本配置

Ru1上的靜态路由設定

ru1(config)#ip route 172.16.2.0 255.255.0.0 192.168.10.2

ru1(config)#ip route 172.16.2.0 255.255.0.0 192.168.11.2 50

注意的是這裡 目标網段 目标網段的子網路遮罩 後面可以跟下一跳ip也可以跟接口 在後面跟的就是 管理距離值

ru2(config)#ip route 172.16.1.0 255.255.0.0 192.168.10.1

ru2(config)#ip route 172.16.1.0 255.255.0.0 192.168.11.1 50

這是ru2上的靜态路由設定

<a href="http://yuzeying.blog.51cto.com/attachment/200907/14/644976_1247583357oCCQ.jpg"></a>

ru1&amp;gt;en

ru1#sh ip route

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP

D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP

i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area

* - candidate default, U - per-user static route, o - ODR

P - periodic downloaded static route

Gateway of last resort is not set

172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks

S 172.16.0.0/16 [1/0] via 192.168.10.2

C 172.16.1.0/24 is directly connected, FastEthernet0/0

C 192.168.10.0/24 is directly connected, Serial0/0

C 192.168.11.0/24 is directly connected, Serial0/1

ru1#

這是我ru1上學到的路由資訊

這裡的S表示是從靜态路由協定中學過來的 ,172.16.0.0/16表示目的網段 []内的1表示靜态路由預設的管理距離,0 表示路徑成本 192.168.10.2 表示到達目的網路的下一跳ip位址

ru2&amp;gt;en

ru2#sh ip route

S 172.16.0.0/16 [1/0] via 192.168.10.1

C 172.16.2.0/24 is directly connected, FastEthernet0/0

ru2#

這是我ru2上的路由表資訊

<a href="http://yuzeying.blog.51cto.com/attachment/200907/14/644976_1247583360na5g.jpg"></a>

Pc1 上的ip配置

<a href="http://yuzeying.blog.51cto.com/attachment/200907/14/644976_12475833628cml.jpg"></a>

Pc2 上的ip配置

PC&amp;gt;ping 172.16.1.2

Pinging 172.16.1.2 with 32 bytes of data:

Reply from 172.16.1.2: bytes=32 time=13ms TTL=126

Reply from 172.16.1.2: bytes=32 time=9ms TTL=126

Reply from 172.16.1.2: bytes=32 time=12ms TTL=126

Ping statistics for 172.16.1.2:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 9ms, Maximum = 13ms, Average = 11ms

PC&amp;gt;

這是在pc2 上pingpc1 的測試結果

現在我們把鍊路down掉一條看看變化 如何

ru1#conf t

ru1(config-if)#shut

%LINK-5-CHANGED: Interface Serial0/0, changed state to administratively down

%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to down

ru1(config-if)#

<a href="http://yuzeying.blog.51cto.com/attachment/200907/14/644976_1247583363i0rj.jpg"></a>

S 172.16.0.0/16 [50/0] via 192.168.11.2

在檢視路由表 注意這條資訊的變化情況

S 172.16.0.0/16 [50/0] via 192.168.11.1

Reply from 172.16.1.2: bytes=32 time=11ms TTL=126

Minimum = 11ms, Maximum = 13ms, Average = 11ms

再在pc2上測試一下連通性

本文轉自 yuzeying1 51CTO部落格,原文連結:http://blog.51cto.com/yuzeying/178265

繼續閱讀