cisco ospf命令總結

OSPF配置命令

Router(config)#router ospf 10  進程號只在本地有效

Router(config)#network 192.168.10.0 0.0.0.255 area 0  正反掩碼均可

Show ip protocols

Show ip route        查看路由表

Show ip route ospf     查看路由表中的OSPF路由項

Show ip ospf neighbors [detail]  顯示OSPF鄰居

Show ip ospf      顯示OSPF路由器的各項信息

Show ip ospf interface f0/1 [brief] 顯示接口的OSPF信息

Show ip ospf database [router]  顯示各類LSA

Show ip ospf database router 192.168.20.2  

Debug ip ospf adj     顯示鄰居關係的建立

Show ip ospf border-routers  可以看到ASBR和ABR,但不能看到自已的角色,只能看到其它路由器的角色

Show ip ospf database-summary   LSDB的彙總信息

查看各類LSA的方法:

Show ip ospf database router 查看一類LSA 域內

Show ip ospf database network 查看二類LSA  MA網絡

Show ip ospf database summary 查看三類LSA  域間

Show ip ospf database asbr-summary 查看四類LSA

Show ip ospf database external 查看五類LSA  域外

Show ip ospf database nssa-external 查看七類LSA

指定RID、修改路由器優先級、修改hello間隔、dead時間、接口帶寬、ospf接口的cost值,修改cost計算公式的分子

Router(config-router)#router-id 1.1.1.1     指定RID

Router(config-if)#ip ospf priority 0-255 注意在接口下改

Router(config-router)#clear ip ospf process  重新啓動OSPF路由選擇進程,如果希望本路由器成爲DR,則在更改優先級後用這一命令重新啓動進程才能成爲DR

Router(config-if)#ip ospf hello-interval 10

Router(config-if)#ip ospf dead-interval 40默認是hello間隔的四倍

Router(config-if)#bandwidth 5000 修改帶寬,可通過修改帶寬實現修改cost值的目的,這個屬性是接口本身的屬性。不起OSPF也能進行修改,且對其它路由進程同時產生效果

Router(config-if)#ip ospf cost 30 直接修改本接口在OSPF中的cost值

Router(config-router)#auto-cost reference-bandwidth 1000 修改COST計算公式的分子,單位是Mbps,即十的六次方

路由彙總:

Router(config-router)#area 0 range 172.16.32.0 255.255.254.0 域間彙總,area 0 是被彙總的區域,建議在本區域所有ABR上都做

Router(config-router)#summary-address 10.0.0.0 255.0.0.0 域外匯總,在ASBR的進程中做

下發默認路由:有兩種方法

Router(config)#ip route 0.0.0.0 0.0.0.0 serial 0

Router(config-router)#default-information originate

如果沒有寫默認路由,用下面這種:

Router(config-router)#default-information originate always [metric-type 1 metric 3] 實際上這條命令也只能吸引路由,並不能指向一個網關,所以還是要配一個默認網關

配置stub區域區域內的每臺路由器都要打上命令

Router(config-router)#area 2 stub 將area2配置爲stub區域

Router(config-router)#area 2 default-cost 5 將自動下發的默認路由的cost值改爲5,默認情況下是1

配置totally stub區域

Router(config-router)#area 2 stub no-summary 只需在ABR上配

配置NSSA區域

Router(config-router)#area 2 nssa

R2(config-router)#area 2 nssa default-information-originate 在ABR上做,會向nssa區域下發一條LSA7的默認路由

R2(config-router)#area 2 default-cost 6 (在ABR上做,改Seed Cost=6)

R2(config-router)#area 2 nssa default-information-originate metric 6 metric-type 1

Metric-type 1的作用是將N2類型的路由改爲N1類型的路由

R2(config-router)#area 2 nssa no-redistribution 在ABR上做,阻止ABR上所直連的其它外部區域的路由進入nssa區域

R2(config-router)#area 2 nssa no-summary 把三類的LSA也幹掉,同時也下發一條LSA3默認路由,並且會取代 default-information-originate所下發的N2的默認路由

<OSPF區域問題>

1)在ABR上起不同OSPF進程,進行OSPF之間的重分佈。

   例如:R3的s1口在area 1中,進程號是10,s0口在area 3中,進程號是20

   Router ospf 10                           router ospf 20

   Redistribute ospf 20 subnets             redistribute ospf 10 subnets

2)tunnel

  Int tunnel 1                      int tunnel 3

  Tunnel source s1                  tunnel source s1

  Tunnel destination 13.1.1.3       tunnel destination 13.1.1.1

  Ip add 111.1.1.1 255.255.255.0    Ip add 111.1.1.3 255.255.255.0

  Router ospf 10                    router ospf 10

  Net 111.1.1.0 0.0.0.255 area 0    net 111.1.1.0 0.0.0.255 area 0

3)虛鏈路:

  最簡單的方法,只需在區域的兩臺邊界路由器上配就可以了

 R3(config-router)#area 2 virtual-link 2.2.2.2

          (中轉區域)   (對方Router-ID)   

·遠離Area0 / 分隔的Area 0       

R2#show ip ospf virtual-links

OSPF的認證

Link:同一鏈路上的路由器之間,在接口下做

 R1(config-router)#int s1

 R1(config-if)#ip ospf authentication-key wolf  (配明文密碼)

 R1(config-if)#ip ospf authentication       (啓動明文認證)

R1(config-if)#ip ospf message-digest-key 1 md5 wolf (配密文密碼)

R1(config-if)#ip ospf authentication message-digest-key(啓動密文認證)

Area:接口下配密碼,進程下調用

 R1(config-router)#int s0

 R2(config-if)#ip ospf message-digest-key 1 md5 wolf   (配密文密碼)

 R2(config-router)#area 0 authentication Message-digest  (啓動密文認證)

 區域內的所有路由器都要認證。

Virtual-Link:

 R2(config-router)#area 2 virtual-link 2.2.2.2 message-digest-key 1 md5 wolf (配密文密碼)

 R2(config-router)#area 2 virtual-link 2.2.2.2 authentication message-digest (啓動密文認證)

 如果Area0啓動認證,在Virtual-Link上也要啓動相應的認證。

OSPF鏈路類型

·NON_BROADCAST

 ·3層是NBMA,2層是否讓通過廣播都無所謂。(FR map後加不加Broadcast皆可)

 在HUB端(R1)單播

 R1(config)#router os 110

 R1(config-router)#neighbor 145.1.1.4

 R1(config-router)#neighbor 145.1.1.5

 確保HUB成爲DR,和Spoke交互路由信息。

 R1(config)#int s0

 R1(config-if)#ip ospf priority 2

 R4/R5(config-if)#ip ospf priority 0

 R4: O  5.5.5.0 [110/65] via 145.1.1.5, 00:00:07, Serial

 手工MAP(Spoke 端的互訪)

 R4(config-if)#frame-relay map ip 145.1.1.5 401

 R5(config-if)#frame-relay map ip 145.1.1.4 501

·BROADCAST

 ·3層是BMA,2層也一定要讓廣播通過。(FR map後一定要加Broadcsat)

 R1(config-if)#fram ma ip 145.1.1.4 104 broadcast

 R1(config-if)#fram ma ip 145.1.1.5 105 broadcast

 確保HUB成爲DR,和Spoke交互路由信息。

 R1(config)#int s0

 R1(config-if)#ip ospf priority 2

 R4/R5(config-if)#ip ospf priority 0

 R4: O  5.5.5.0 [110/65] via 145.1.1.5, 00:00:07, Serial

 手工MAP

 R4(config-if)#frame-relay map ip 145.1.1.5 401 broadcast

 R5(config-if)#frame-relay map ip 145.1.1.4 501 broadcast

 

·POINT_TO_MULTIPOINT NON_BROADCAST   cisco專有的

 ·3層是NBMA,2層是否讓通過廣播都無所謂。(FR map後加不加Broadcast皆可)

 在HUB端(R1)單播

 R1(config)#router os 110

 R1(config-router)#neighbor 145.1.1.4

 R1(config-router)#neighbor 145.1.1.5

 R4: O  145.1.1.5/32 [110/128] via 145.1.1.1, 00:00:24, Serial1

 產生/32主機路由,且下一跳指向HUB,所以不需手工MAP。這就是32位的好處。

·POINT_TO_MULTIPOINT    全自動,最好的

 ·3層是允許廣播,2層也一定要讓廣播通過。(FR map後一定要加Broadcsat)


·R1#show ip os neighbor detail

 DR is 0.0.0.0 BDR is 0.0.0.0

 P2P/P2MP/P2MP NBMA都不需要選舉DR/BDR,所以DR is 0.0.0.0 BDR is 0.0.0.0

 

·POINT_TO_POINT(做不同網段)

 HUB端起2個P2P子接口:

 interface Serial0

 encapsulation frame-relay

 no frame-relay inverse-arp    關閉反向ARP

 interface Serial0.14 point-to-point

 ip address 14.1.1.1 255.255.255.0

 frame-relay interface-dlci 104   

 interface Serial0.15 point-to-point

 ip address 15.1.1.1 255.255.255.0

 frame-relay interface-dlci 105

原地址(http://blog.sina.com.cn/s/blog_5cc947380100arm3.html)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章