天天看點

CCNP精粹系列之二十--政策路由實戰二,部落客推薦文章

       管理距離

上一篇博文介紹了如何配置政策路由影響路由途徑,緩解路由流量擁塞的問題,上篇博文的遺留問題先解決一下:

當一個問題沒有解決時是難受的,相信自己的了解和配置沒問題,那麼肯定存在一個很小的疏忽,是以當把這個很小的疏忽解決掉之後,心情是最爽的,幸福都能展現出來,這種感覺是需要用心去尋找,用耐心去體驗,是以第一關就是克服自己。

下面給出30網段路由的路徑:

R1#

R1#traceroute

Protocol [ip]:

Target IP address: 192.168.10.1

Source address: 192.168.30.1

Numeric display [n]:

Timeout in seconds [3]:

Probe count [3]:

Minimum Time to Live [1]:

Maximum Time to Live [30]: 5

Port Number [33434]:

Loose, Strict, Record, Timestamp, Verbose[none]:

Type escape sequence to abort.

Tracing the route to 192.168.10.1

  1 202.110.100.2 36 msec 60 msec 48 msec

  2 202.110.104.1 96 msec 156 msec 96 msec

  3 202.110.103.1 192 msec 204 msec *

實作我們的預期的目的,解決了網絡流量的擁塞難題,達到裝置的合理利用。

前途是光明的,道路是曲折的,是以我們需要共同努力,刻不容緩,讓我們一起飛的更高,走進我的技術圈飛的更高………

下面來看今天新内容:

那麼方法不止一種,今天這篇博文将通過修改管理距離來影響路由的途徑。

  R2 :.   S1/1    202.110.101.1 255.255.255.0

S1/2    202.110.104.2 255.255.255.0

R3:S1/1    202.110.101.2 255.255.255.0

.          S1/2   202.110.102.1 255.255.255.0

R4 :S1/2    202.110.102.2 255.255.255.0

.          S1/1  202.110.103.1 255.255.255.0

R5 :S1/1    202.110.103.2 255.255.255.0

.          S1/2  202.110.104.1 255.255.255.0

在R1上做:

Router(config)#host R2

R2(config)#int s1/1

R2(config-if)#ip addr 202.110.101.1 255.255.255.0

R2(config-if)#encap hclc

                     ^

% Invalid input detected at '^' marker.

R2(config-if)#encap hdlc

R2(config-if)#clock rate 56000

R2(config-if)#no shut

R2(config-if)#

*Apr 21 17:05:13.907: %LINK-3-UPDOWN: Interface Serial1/1, changed state to up

*Apr 21 17:05:14.911: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1, changed state to up

R2(config-if)#int s1/2

R2(config-if)#ip addr 202.110.104.2 255.255.255.0

*Apr 21 17:06:34.147: %LINK-3-UPDOWN: Interface Serial1/2, changed state to up

*Apr 21 17:06:35.151: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/2, changed state to up

R2(config-if)#exit

R2(config)#router rip

R2(config-router)#ver 2

R2(config-router)#net 202.110.101.0

R2(config-router)#net 202.110.104.0

在R2上做:

Router(config)#host R3

R3(config)#int s1/1

R3(config-if)#ip addr 202.110.101.2 255.255.255.0

R3(config-if)#encap hdlc

R3(config-if)#no shut

R3(config-if)#

*Apr 21 17:08:15.767: %LINK-3-UPDOWN: Interface Serial1/1, changed state to up

*Apr 21 17:08:16.771: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1, changed state to up

R3(config-if)#int s1/2

R3(config-if)#ip addr 202.110.102.1 255.255.255.0

R3(config-if)#encap hdlc\

                        ^

R3(config-if)#clock rate 56000

R3(config-if)#ex

*Apr 21 17:08:58.267: %LINK-3-UPDOWN: Interface Serial1/2, changed state to upit

R3(config)#

*Apr 21 17:08:59.271: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/2, changed state to up

R3(config)#router rip

R3(config-router)#net 202.110.101.0

R3(config-router)#exit

R3(config)#router ospf 100

R3(config-router)#net 202.110.102.0

注意:将R3的左端口配置為rip協定,右端口配置為ospf協定。

在R4上做:

Router(config)#host R4

R4(config)#int s1/2

R4(config-if)#ip addr 202.110.102.2 255.255.255.0

R4(config-if)#encap hdlc

R4(config-if)#no shut

R4(config-if)#

*Apr 21 17:11:09.087: %LINK-3-UPDOWN: Interface Serial1/2, changed state to up

*Apr 21 17:11:10.091: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/2, changed state to up

R4(config-if)#exit

R4(config)#router ospf 100

R4(config-router)#no router ospf 100

R4(config)#int s1/1

R4(config-if)#ip addr 202.110.103.1 255.255.255.0

R4(config-if)#clock rate 56000

R4(config)#

*Apr 21 17:12:34.627: %LINK-3-UPDOWN: Interface Serial1/1, changed state to up

*Apr 21 17:12:35.631: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1, changed state to up

R4(config-router)#net 202.110.102.2 0.0.0.0 area 1

R4(config-router)#ne t

*Apr 21 17:12:57.895: %OSPF-5-ADJCHG: Process 100, Nbr 202.110.102.1 on Serial1/2 from LOADING to FULL, Loading Do

% Incomplete command.

R4(config-router)#net 202.110.103.1 0.0.0.0 area 1

在R5上做:

Router(config)#host R5

R5(config)#int s1/1

R5(config-if)#ip addr 202.110.103.2 255.255.255.0

R5(config-if)#encap hdlc

R5(config-if)#no shut

R5(config-if)#

*Apr 21 17:14:26.439: %LINK-3-UPDOWN: Interface Serial1/1, changed state to up

*Apr 21 17:14:27.443: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1, changed state to up

R5(config-if)#exit

R5(config)#int s1/2

R5(config-if)#ip addr 202.110.104.1 255.255.255.0

*Apr 21 17:14:57.911: %LINK-3-UPDOWN: Interface Serial1/2, changed state to up

*Apr 21 17:14:58.915: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/2, changed state to up

R5(config)#router rip

R5(config-router)#net 202.110.104.0

R5(config-router)#ver2

R5(config-router)#no router rip

R5(config-router)#ver 2

R5(config-router)#exit

R5(config)#router ospf 100

R5(config-router)#net 202.110.103.2 0.0.0.0 area 1

由于不同路由協定間是不能通信的,是以必須要做路由的再釋出,在邊緣路由器上配置路由的再釋出。

首先是R3上:

R3(config-router)#redistribute rip subnets

R3(config-router)#router rip

R3(config-router)#redistribute ospf 100 metric 3

R5上同理:

為了看到下面修改管理距離的清楚,我将釋出的路由度量設定為相同的,假如都是3.

R5(config-router)#redis

R5(config-router)#redistribute rip subnets

R5(config-router)#router rip

R5(config-router)#redistribute ospf 100 metric 3

測試:在R5上測試路由是有左側的rip環境學到的,還是有右邊的ospf環境學到的。

R5#show ip ro

Codes: C - connected, S - static, 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

       i - IS-IS, su - IS-IS summary, 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

O E2 202.110.101.0/24 [110/20] via 202.110.103.1, 00:00:55, Serial1/1

O    202.110.102.0/24 [110/128] via 202.110.103.1, 00:00:55, Serial1/1

C    202.110.103.0/24 is directly connected, Serial1/1

C    202.110.104.0/24 is directly connected, Serial1/2

顯然我們能看出,R5上路由是通過右邊的ospf環境學到的,下面我将通過修改管理距離改變路由的路徑,這篇博文的精彩點是由這一刻開始的,還望耐心學習下去。

由于管理距離越小越好,是以人為将rip環境的管理距離設小一點,讓R5學到的路由從rip學到,我們今天的任務就圓滿成功了。

下面配置修改管理距離:

R3:

R3(config-router)#distance 150 0.0.0.0 255.255.255.255  5 //比對5号表

R3(config)#access-list 5 permit 202.110.101.0 0.0.0.255

R5上做修改:

R5(config-router)#distance 100 0.0.0.0 255.255.255.255 6//比對6号表

R5(config)#access-list 6 permit 202.110.104.0 0.0.0.255

再在R5上測試看學習到的101網段的路由路徑:

尚未完善,有待解決**********************************************************

     本文轉自shenleigang 51CTO部落格,原文連結:http://blog.51cto.com/shenleigang/152038,如需轉載請自行聯系原作者

繼續閱讀