国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 網(wǎng)絡(luò)通信 > 正文

Cisco IOS Cookbook 中文精簡版第八章OSPF

2019-11-05 00:09:51
字體:
供稿:網(wǎng)友

8.1.  配置OSPF

提問 在網(wǎng)絡(luò)中啟用OSPF

回答

Router5#configure terminal

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

Router5(config)#router ospf 87

Router5(config-router)#network 0.0.0.0 255.255.255.255 area 0

Router5(config-router)#exit

Router5(config)#end

Router5#

注釋 這里OSPF的進程號是本地使用,不需要像EIGRP一樣整個網(wǎng)絡(luò)保持一致。在12.3(11)T以后有一個專門的命令來指定端口加入OSPF 區(qū)域,而不需要用network的命令

Router9#configure terminal

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

Router9(config)#router ospf 87

Router9(config-router)#exit

Router9(config)#interface FastEthernet0/0

Router9(config-if)#ip address 172.18.5.9 255.255.255.0

Router9(config-if)#ip ospf 87 area 10

Router9(config-if)#exit

Router9(config)#end

Router9#

8.2.  路由過濾

提問 進行路由過濾,只答應(yīng)OSPF宣告特定路由進入路由表

回答

入方向

Router5#configure terminal

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

Router5(config)#access-list 1 deny 172.20.10.0

Router5(config)#access-list 1 permit any

Router5(config)#router ospf 87

Router5(config-router)#distribute-list 1 in Ethernet0/0

Router5(config-router)#exit

Router5(config)#end

Router5#

注釋 根據(jù)OSPF的機制,所有區(qū)域內(nèi)的路由器LSA數(shù)據(jù)庫內(nèi)容必須保持一致,所以正常情況下不能對出方向進行過濾,入方向過濾也是防止其進入路由表,在本地的LSA數(shù)據(jù)庫還是有此路由。當然假如確實需要對出方向進行過濾就必須對出方向所有的LSA進行過濾,這樣會導(dǎo)致下游路由器的LSA數(shù)據(jù)庫不完整,一般不推薦使用。

點對多點鏈路出方向過濾

Router1#configure terminal

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


Router1(config)#router ospf 87

Router1(config-router)#neighbor 192.168.1.3 database-filter all out

Router1(config-router)#exit

Router1(config)#end

Router1#

廣播,點到點鏈路出方向過濾

Router1#configure terminal

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

Router1(config)#interface Serial0/0

Router1(config-if)#encapsulation frame-relay

Router1(config-if)#exit

Router1(config)#interface Serial0/0.10 multipoint

Router1(config-subif)#ip address 192.168.1.1 255.255.255.0

Router1(config-subif)#ip ospf network broadcast

Router1(config-subif)#ip ospf database-filter all out

Router1(config-subif)#frame-relay map ip 192.168.1.3 101 broadcast

Router1(config-subif)#frame-relay map ip 192.168.1.5 109 broadcast

Router1(config-subif)#exit

Router1(config)#router ospf 1

Router1(config-router)#network 0.0.0.0 255.255.255.255 area 10

Router1(config-router)#exit

Router1(config)#end

Router1#

8.3.  調(diào)整OSPF代價值

提問 調(diào)整OSPF鏈路的代價值

回答

全局調(diào)整

Router5#configure terminal

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

Router5(config)#router ospf 87

Router5(config-router)#auto-cost reference-bandwidth 1000

Router5(config-router)#exit

Router5(config)#end

Router5#

接口調(diào)整

Router5#configure terminal

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

Router5(config)#interface Ethernet0

Router5(config-if)#ip ospf cost 31

Router5(config-if)# exit


Router5(config)#end

Router5#

注釋

8.4.  宣告缺省路由到OSPF

提問 宣告缺省路由到OSPF網(wǎng)絡(luò)

回答

Router1#configure terminal

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

Router1(config)#ip route 0.0.0.0 0.0.0.0 172.25.1.1

Router1(config)#router ospf 55

Router1(config-router)#default-information originate metric 30 metric-type 1

Router1(config-router)#exit

Router1(config)#end

Router1#

注釋 在這里不能使用再發(fā)布靜態(tài)路由得命令來發(fā)布缺省路由

8.5.  再發(fā)布靜態(tài)路由到OSPF

提問 宣告一條或者多條靜態(tài)路由到OSPF

回答

Router1#configure terminal

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

Router1(config)#ip route 192.168.10.0 255.255.255.0 172.22.1.4

Router1(config)#ip route 172.24.1.0 255.255.255.0 172.22.1.4

Router1(config)#ip route 10.100.1.0 255.255.255.0 172.22.1.4

Router1(config)#router ospf 55

Router1(config-router)#redistribute static    

% Only classful networks will be redistributed

Router1(config-router)#exit

Router1(config)#end

Router1#

注釋 根據(jù)上面得命令提示可以看到缺省情況下OSPF只再發(fā)布有類得路由,所以按照例子上雖然三條靜態(tài)路由但是只有192.168.10.0/24是有類路由,能夠發(fā)布出去,其它兩個就不行。這時候就需要配置redistribute static subnets命令來發(fā)布子網(wǎng),當然也可以添加metric等選項

 

8.6.  再發(fā)布外部路由到OSPF

提問 再發(fā)布其它路由協(xié)議得路由信息到OSPF

回答

Router1#configure terminal

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

Router1(config)#router ospf 55

Router1(config-router)#redistribute eigrp 11 subnets  

Router1(config-router)#exit

Router1(config)#end

Router1#

在12.3(2)T以后增加了下面得命令對再發(fā)布過來得條目做了限制

Router1(config-router)#redistribute maximum-PRefix 1000 80


 

注釋 這里還是要注重subnet得參數(shù)。對于最后一個條目限制得命令,第一個1000是路由條目數(shù),第二個80是百分比

8.7.  DR選舉

提問 對DR選舉做人為控制

回答

Router5#configure terminal

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

Router5(config)#interface Ethernet0

Router5(config-if)#ip ospf priority 10                 

Router5(config-if)#exit

Router5(config)#end

Router5#

注釋 DR選舉人工控制最重要得兩種情況是MOSPF和NBMA網(wǎng)絡(luò)。在MOSPF網(wǎng)絡(luò)中,MOSPF得DR和正常OSPF得DR是相同得,而假如DR不是一個MOSPF得路由器那么所有組播得路由就不能轉(zhuǎn)發(fā),思科路由器是不支持MOPSF得,所以在這種情況下必須使用ip ospf priority 0得命令來禁止其稱為BDR或者DR。在NBMA得網(wǎng)絡(luò)中要不DR設(shè)置在Hub路由器上。還有一個重要得問題是DR是不能強占得,假如網(wǎng)絡(luò)中已經(jīng)有了DR,這時即使新加入得路由器有更高得優(yōu)先級他也不能稱為DR,必須等待現(xiàn)在得DR出了問題才可以重新選舉為DR。

8.8.  設(shè)置OSPF RID

提問 人工設(shè)定路由器得Router ID

回答

一種是Loopback地址方式

Router5#configure terminal

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

Router5(config)#interface Loopback0

Router5(config-if)#ip address 172.25.25.6 255.255.255.255

Router5(config-if)#exit

Router5(config)#end

Router5#

一種是Router ID命令方式

Router5#configure terminal

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

Router5(config)#router ospf 87

Router5(config-router)#router-id 172.25.1.7

Router5(config-if)#exit

Router5(config)#end

Router5#

注釋 缺省會用最大IP地址作為Router ID。Router id命令后面得IP地址可以隨意,不需要必須是存在得地址。另外router id一旦定下來以后,即使重新修改了地址也不能變更,必須通過clear

ip ospf process得方式或者reload得方式來改變

8.9.  啟用OSPF鑒權(quán)

提問 對鄰居關(guān)系建立啟用鑒權(quán)從而保證網(wǎng)絡(luò)設(shè)備得安全性

回答

Router1#configure terminal

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

Router1(config)#interface Serial0/1


Router1(config-if)#ip ospf message-digest-key 1 md5 oreilly

Router1(config-if)#exit

Router1(config)#router ospf 55

Router1(config-router)#area 2 authentication message-digest

Router1(config-router)#exit

Router1(config)#end

Router1#

注釋 注重得是不同廠商得OPSF MD5加密認證互聯(lián)可能會有問題,因為RFC沒有規(guī)范。對于新老密碼替換得問題,通過配置新舊兩個密碼得方式來解決

8.10.  選擇合適得區(qū)域類型

提問 不同得區(qū)域有不同得鏈路狀態(tài)數(shù)據(jù)庫,通過不同區(qū)域得選擇來節(jié)省路由器資源和更快收斂

回答

Stubby Area

Router1#configure terminal

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

Router1(config)#router ospf 55

Router1(config-router)#area 100 stub

Router1(config-router)#exit

Router1(config)#end

Router1#

Totally Stubby Area

Router1#configure terminal

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

Router1(config)#router ospf 55

Router1(config-router)#area 100 stub no-summary

Router1(config-router)#exit

Router1(config)#end

Router1#

Not So Stubby Areas (NSSA), 同時生成一條缺省路由

Router1#configure terminal

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

Router1(config)#router ospf 55

Router1(config-router)#area 100 nssa default-information-originate

Router1(config-router)#exit

Router1(config)#end

Router1#

Totally Stubby, Not So Stubby Area.

Router1#configure terminal

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

Router1(config)#router ospf 55

Router1(config-router)#area 100 nssa no-summary

Router1(config-router)#exit


Router1(config)#end

Router1#

 

注釋 這些都是在ABR上的配置,對于區(qū)域里面其它的路由器就是只有NSSA和stub的配置沒有必要配置是否為totally stubby。

8.11.  在撥號接口上配置OSPF

提問 在撥號接口上啟用OSPF,但又不想讓OSPF的協(xié)議數(shù)據(jù)一直保持撥號鏈路處于激活狀態(tài)

回答

下面例子是R4只能撥號到R1

Router4#configure terminal

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

Router4(config)#username Router1 passWord 0 cisco

Router4(config)#interface BRI0

Router4(config-if)#ip address 192.168.15.4 255.255.255.0

Router4(config-if)#encapsulation ppp

Router4(config-if)#ip ospf demand-circuit

Router4(config-if)#dialer map ip 192.168.15.1 broadcast 4165550000

Router4(config-if)#dialer-group 1

Router4(config-if)#isdn switch-type basic-ni

Router4(config-if)#isdn spid1 416555001000 4165550010

Router4(config-if)#isdn spid2 416555001100 4165550011

Router4(config-if)#ppp authentication chap

Router4(config-if)#ppp multilink

Router4(config-if)#exit

Router4(config)#dialer-list 1 protocol ip permit

Router4(config)#router ospf 87

Router4(config-router)#network 192.168.15.0 0.0.0.255 area 10

Router4(config-router)#exit

Router4(config)#end

Router4#

Router1#configure terminal

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

Router1(config)#username Router4 password 0 cisco

Router1(config)#interface BRI0/0

Router1(config-if)#ip address 192.168.15.1 255.255.255.0

Router1(config-if)#encapsulation ppp

Router1(config-if)#dialer-group 1

Router1(config-if)#isdn switch-type basic-ni


Router1(config-if)#isdn spid1 416555000000 4165550000

Router1(config-if)#isdn spid2 416555000100 4165550001

Router1(config-if)#ppp authentication chap

Router1(config-if)#ppp multilink

Router1(config-if)#exit

Router1(config)#dialer-list 1 protocol ip permit

Router1(config)#router ospf 87

Router1(config-router)#network 192.168.15.0 0.0.0.255 area 10

Router1(config-router)#exit

Router1(config)#end

Router1#

 

注釋 使用ip ospf demand-circuit 的命令可以保持鄰居關(guān)系一直是FULL狀態(tài),而不管鏈路是否激活

8.12.  路由匯總

提問 減少路由表大小

回答

Router1#configure terminal

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

Router1(config)#router ospf 55

Router1(config-router)#area 100 range 172.20.0.0 255.255.0.0

Router1(config-router)#area 0 range 172.25.0.0 255.255.0.0

Router1(config-router)#area 2 range 10.0.0.0 255.0.0.0

Router1(config-router)#exit

Router1(config)#end

Router1#

注釋 OSPF的路由匯總只能配置在ABR上。生成的匯總路由代價值缺省情況下和子網(wǎng)路由中最小的一致,也就是說匯總路由的穩(wěn)定狀態(tài)和代價值最小的那個路由條目相關(guān),這也是RFC1583上的定義,在新的RFC中定義了匯總路由代價值和最大的那個路由條目相關(guān),所以一定要確定所有路由器采用相同的計算方法,思科缺省使用RFC1583的方法,禁用可以使用no compatible rfc1583。在ABR上啟用匯總以后會自動生成一條匯總路由的丟棄路由(12.1(6))來避免路由回環(huán)

8.13.  在特定端口禁用OSPF

提問 禁止某個端口參與OSPF

回答

Router3#configure terminal

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

Router3(config)#router ospf 44

Router3(config-router)#network 0.0.0.0 255.255.255.255 area 100

Router3(config-router)#passive-interface Ethernet0

Router3(config-router)#exit

Router3(config)#end

Router3#


注釋 OSPF也是通過配置被動接口的方式來不生成鄰居關(guān)系從而避免參與OSPF。當然也可以通過不在network命令中包含此端口來禁止,下面就是另外一種很好的配置方法,network了所有接口,但是缺省所有端口是被動接口,對于需要的接口再使用no的命令才參與OSPF:

Router3(config)#router ospf 44

Router3(config-router)#network 0.0.0.0 255.255.255.255 area 100

Router3(config-router)#passive-interface default

Router3(config-router)#no passive-interface Ethernet0

Router3(config-router)#exit

Router3(config)#end

Router3#

8.14.  修改接口的網(wǎng)絡(luò)類型

提問 修改某個端口缺省的網(wǎng)絡(luò)類型

回答

Router9#configure terminal

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

Router9(config)#interface FastEthernet0/0

Router9(config-if)#ip ospf network ?

  broadcast            Specify OSPF broadcast multi-access network

  non-broadcast        Specify OSPF NBMA network

  point-to-multipoint  Specify OSPF point-to-multipoint network

  point-to-point       Specify OSPF point-to-point network

 

Router9(config-if)#

注釋 上述四個要害詞主要定義媒介是否支持廣播或者組播數(shù)據(jù)包,是否需要選舉DR。對于Broadcast網(wǎng)絡(luò),支持組播,DR可以自動選擇,不需要配置。對于nonbroadcast網(wǎng)絡(luò),不支持組播,必須人工使用neighbor命令配置鄰居關(guān)系。對于point-to-multipoint網(wǎng)絡(luò),不需要DR選舉,也不需要neighbor命令,這時候需要注重的是framerelay配置中要答應(yīng)broadcast:

Router9(config)#interface Serial0/0

Router9(config-if)#ip address 192.168.10.9 255.255.255.0

Router9(config-if)#encapsulation frame-relay

Router9(config-if)#frame-relay map ip 192.168.10.2 123 broadcast

Router9(config-if)#ip ospf network point-to-multipoint

Router9(config-if)#exit

Router9(config)#router ospf 1

Router9(config-router)#network 192.168.10.0 0.0.0.255 area 0

Router9(config-router)#exit

否則必須配置neighbor

Router9(config)#interface Serial0/0

Router9(config-if)#ip address 192.168.10.9 255.255.255.0


Router9(config-if)#encapsulation frame-relay

Router9(config-if)#frame-relay map ip 192.168.10.2 123

Router9(config-if)#ip ospf network point-to-multipoint non-broadcast

Router9(config-if)#exit

Router9(config)#router ospf 1

Router9(config-router)#network 192.168.10.0 0.0.0.255 area 0

Router9(config-router)#neighbor 192.168.10.2

Router9(config-router)#exit

最后一種point-to-point網(wǎng)絡(luò)不需要DR,但必須支持組播來建立鄰居,否則需要配置neighbor命令。

還有一個非凡的回環(huán)地址,缺省情況OSPF會宣告回環(huán)地址為/32的網(wǎng)絡(luò),但是你可以在回環(huán)接口上配置其為ip ospf network point-to-point,來強制他宣告正確的網(wǎng)絡(luò)掩碼

8.15.  路由標簽

提問 對特定的路由打標簽避免互相再發(fā)布出現(xiàn)路由回環(huán)

回答

Router1#configure terminal

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

Router1(config)#router ospf 55

Router1(config-router)#redistribute eigrp 11 metric-type 1 subnets tag 67

Router1(config-router)#exit

Router1(config)#end

Router1#

注釋

8.16.  記錄OSPF鄰居狀態(tài)變化

提問 記錄OSPF鄰居狀態(tài)變化信息

回答

Router2#configure terminal

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

Router2(config)#router ospf 12

Router2(config-router)#log-adjacency-changes

Router2(config-router)#exit

Router2(config)#end

Router2#

注釋 12.1后對上面命令增加了detail參數(shù)可以看到更多鄰居狀態(tài)變化的信息
8.17.  OSPF定時器

提問 調(diào)整定時器,加快收斂

回答

Router1#configure terminal

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

Router1(config)#interface Serial0/1

Router1(config-if)#ip ospf hello-interval 5

Router1(config-if)#ip ospf dead-interval 20

Router1(config-if)#exit

Router1(config)#end


Router1#

注釋 要保證和此端口相連的設(shè)備采用相同的定時器值,否則鄰居關(guān)系不能建立

8.18.  減少OSPF協(xié)議流量

提問 在穩(wěn)定的網(wǎng)絡(luò)要不需要LSA的過多數(shù)據(jù)包傳遞

回答

Router9#configure terminal

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

Router9(config)#interface Serial0/0

Router9(config-if)#ip address 192.168.10.9 255.255.255.0

Router9(config-if)#ip ospf flood-redUCtion

Router9(config-if)#exit

Router9(config)#end

Router9#

注釋 正常情況下OSPF會每隔一小時進行所有的LSA泛洪,在穩(wěn)定網(wǎng)絡(luò)里面一般不需要,所以通過這種方式設(shè)定LSA的DoNotAge位,避免過多流量

8.19.  OSPF虛擬鏈路

提問 把兩個分開的路由器通過虛擬鏈路的方式相連

回答

Router9#configure terminal

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

Router9(config)#router ospf 1

Router9(config-router)#area 10 virtual-link 10.54.0.1

Router9(config-router)#exit

Router9(config)#end

Router9#

注釋 通過show ip ospf virtual-links來驗證。需要注重的是這個需要兩個路由器都進行配置,IP地址是對方的Router ID,要確保這個地址是通的,area后面跟的是穿越的Area

8.20.  使用域名查看OSPF狀態(tài)

提問 在OSPF的show命令中現(xiàn)實設(shè)備域名而不是地址

回答

Router3#configure terminal

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

Router3(config)#ip ospf name-lookup

Router3(config)#end

Router3#

注釋 無

8.21.  OSPF排錯

提問 對OSPF進行排錯

回答

Router3#debug ip ospf adj

OSPF adjacency events debugging is on

Router3#

注釋 OSPF排錯命令很多,這里只提供了對鄰居關(guān)系的排錯命令,因為鄰居是OSPF的基礎(chǔ)



發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 濉溪县| 阜平县| 丰城市| 阿瓦提县| 和林格尔县| 赤水市| 滁州市| 皋兰县| 临海市| 青铜峡市| 高陵县| 峨眉山市| 望都县| 大名县| 邹平县| 彰化市| 资阳市| 和静县| 湄潭县| 纳雍县| 固原市| 梅河口市| 瓦房店市| 苗栗市| 武邑县| 晴隆县| 江安县| 岗巴县| 桂林市| 邵阳县| 呈贡县| 黎川县| 滁州市| 商洛市| 西昌市| 元氏县| 阳新县| 铁岭县| 固安县| 云安县| 贵德县|