天天看點

廣播多路通路鍊路上的OSPF

通過本實驗可以了解:

1、 路由器OSPF的啟動過程;

2、 啟用路由接口,并通告網絡所在路由;

3、 DR選舉的控制;

4、 廣播多路通路鍊路的特征;

實驗拓撲圖:

<a target="_blank" href="http://blog.51cto.com/attachment/201009/141902202.png"></a>

實驗步驟:

配置各個路由器fa0/0和loopback 0的IP位址,并配置OSPF路由協定

R1的ospf配置如下:

R1(config)#router ospf 1

R1(config-router)#router-id 1.1.1.1

R1(config-router)#network 192.168.1.0 255.255.255.0 area 0

R1(config-router)#network 1.1.1.0 255.255.255.0 area 0

R2、R3、R4與之類似。

當所有配置完成之後,在R1、R2上檢視路由資訊,可以看到DR,BDR的選舉正在進行

<a href="http://linuxtro.blog.51cto.com/attachment/201009/8/1239505_1283926458h8gb.jpg"></a>

<a href="http://linuxtro.blog.51cto.com/attachment/201009/8/1239505_1283926460csC0.jpg"></a>

再到R4上執行“show ip ospf neighbor”

<a href="http://linuxtro.blog.51cto.com/attachment/201009/8/1239505_1283926466NRWx.jpg"></a>

以上實驗輸出表明在該廣播多路通路網絡中,R4是DR,R3是BDR,R1和R2是DROTHER。

【注】:

1、為了避免路由器之間建立完全鄰接關系而引起的大量開銷,OSPF協定要求在多路通路鍊路中選舉一個DR,每個路由器都與之建立鄰接關系。選舉DR的同時,也選舉一個BDR。在DR失效的時候,BDR擔負起DR的責任,而且所有其他路由器隻與DR和BDR建立鄰接關系;

2、DR和BDR有他們自己的多點傳播位址224.0.0.6;

3、DR和BDR的選舉是以各個網絡為基礎的,也就是說DR和BDR選舉是一個;路由器的接口特性,而不是整個路由器的特性;

4、DR的選舉規則為:

①首要因素是時間,最先啟動的路由器被選舉為DR;

②如果是同時啟動,或者重新選舉,則看接口優先級(範圍是0--255),優先級最高的被選舉為DR,預設情況下,多路通路網絡的接口優先級為1,點到點的接口優先級為0,修改優先級的指令為“ip ospf priority ”,如果接口的優先級被置為0,那麼該接口将不參與DR的選舉;

③如果前兩者相同,最後看路由器ID,路由器最高的被選舉為DR;

5、DR選舉是非搶占的,除非人為地重新選舉,重新選舉的方法有兩種,一是路由器重新開機,二是執行“clear ip ospf process”指令;

在R1上執行show ip ospf int fastEthernet 0/0指令

<a href="http://linuxtro.blog.51cto.com/attachment/201009/8/1239505_12839264717Rsu.jpg"></a>

R1#show ip ospf int fa0/0

FastEthernet0/0 is up, line protocol is up

Internet Address 192.168.1.1/24, Area 0

<b>Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 1</b>

//網絡類型為BROADCAST;

<b>Transmit Delay is 1 sec, State DROTHER, Priority 1</b>

//自己的State是DROTHER;

<b>Designated Router (ID) 4.4.4.4, Interface address 192.168.1.4</b>

//DR的路由器ID和接口位址;

<b>Backup Designated router (ID) 3.3.3.3, Interface address 192.168.1.3</b>

//BDR的路由器ID和接口位址;

Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5

oob-resync timeout 40

Hello due in 00:00:09

Supports Link-local Signaling (LLS)

Index 2/2, flood queue length 0

Next 0x0(0)/0x0(0)

Last flood scan length is 0, maximum is 1

Last flood scan time is 0 msec, maximum is 0 msec

<b>Neighbor Count is 3, Adjacent neighbor count is 2</b>

//有3個鄰居,隻與R3、R4形成鄰接關系,與R2隻是鄰居關系;

<b>Adjacent with neighbor 3.3.3.3 (Backup Designated Router)</b>

<b>Adjacent with neighbor 4.4.4.4 (Designated Router)</b>

//與R3、R4形成鄰接關系;

Suppress hello for 0 neighbor(s)

在R4上執行show ip ospf int fastEthernet 0/0指令

R4#show ip ospf int fastEthernet 0/0

Internet Address 192.168.1.4/24, Area 0

Process ID 1, Router ID 4.4.4.4, Network Type BROADCAST, Cost: 1

<b>Transmit Delay is 1 sec, State DR, Priority 1</b>

//自己是DR;

//DR路由器的ID和接口位址;

//BDR路由器的ID和接口位址;

Hello due in 00:00:07

Index 1/1, flood queue length 0

Last flood scan length is 1, maximum is 1

Last flood scan time is 4 msec, maximum is 4 msec

<b>Neighbor Count is 3, Adjacent neighbor count is 3</b>

//R4是DR,有3個鄰居,并且全部形成鄰接關系;

Adjacent with neighbor 1.1.1.1

Adjacent with neighbor 2.2.2.2

Adjacent with neighbor 3.3.3.3 (Backup Designated Router)

從路由器的R1和R4的輸出來看,鄰居關系和鄰接關系是不相同的,鄰居關系是指達到2WAY狀态的路由器,而鄰接關系是指達到FULL狀态的路由器。

Debug ip ospf adj 指令顯示鄰接關系的建立或中斷的過程。在OSPF鄰接關系建立的過程中,接口狀态變化包括:DOWN,2WAY,EXSTART,EXCHANGE,LOADING,FULL

R4# debug ip ospf adj

OSPF adjacency events debugging is on

R4#clear ip ospf process

………………

*Mar 1 00:09:44.811: OSPF: Elect DR 3.3.3.3

*Mar 1 00:09:44.811: DR: 3.3.3.3 (Id) BDR: 4.4.4.4 (Id)

*Mar 1 00:09:47.495: OSPF: 3.3.3.3 address 192.168.1.3 on FastEthernet0/0 is dead

*Mar 1 00:09:47.495: OSPF: 3.3.3.3 address 192.168.1.3 on FastEthernet0/0 is dead, state <b>DOWN</b>

*Mar 1 00:09:47.495: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on FastEthernet0/0 from FULL to DOWN, Neighbor Down: Dead timer expired

*Mar 1 00:09:47.499: OSPF: Neighbor change Event on interface FastEthernet0/0

*Mar 1 00:09:47.499: OSPF: DR/BDR election on FastEthernet0/0

*Mar 1 00:10:05.791: OSPF: 2 Way Communication to 3.3.3.3 on FastEthernet0/0, state <b>2WAY</b>

*Mar 1 00:10:05.791: OSPF: Neighbor change Event on interface FastEthernet0/0

*Mar 1 00:10:05.791: OSPF: DR/BDR election on FastEthernet0/0

*Mar 1 00:10:05.795: OSPF: Elect BDR 1.1.1.1

*Mar 1 00:10:05.795: OSPF: Elect DR 4.4.4.4

*Mar 1 00:10:05.795: DR: 4.4.4.4 (Id) BDR: 1.1.1.1 (Id)

*Mar 1 00:10:05.795: OSPF: Send DBD to 3.3.3.3 on FastEthernet0/0 seq 0x6CD opt 0x52 flag 0x7 len 32

*Mar 1 00:10:06.703: OSPF: Rcv DBD from 3.3.3.3 on FastEthernet0/0 seq 0x8AF opt 0x52 flag 0x7 len 32 mtu 1500 state <b>EXSTART</b>

*Mar 1 00:10:06.703: OSPF: First DBD and we are not SLAVE

*Mar 1 00:10:06.727: OSPF: Rcv DBD from 3.3.3.3 on FastEthernet0/0 seq 0x6CD opt 0x52 flag 0x2 len 132 mtu 1500 state EXSTART

*Mar 1 00:10:06.727: OSPF: NBR Negotiation Done. We are the MASTER

*Mar 1 00:10:06.731: OSPF: Send DBD to 3.3.3.3 on FastEthernet0/0 seq 0x6CE opt 0x52 flag 0x3 len 132

*Mar 1 00:10:07.063: OSPF: Rcv DBD from 3.3.3.3 on FastEthernet0/0 seq 0x6CE opt 0x52 flag 0x0 len 32 mtu 1500 state <b>EXCHANGE</b>

*Mar 1 00:10:07.063: OSPF: Send DBD to 3.3.3.3 on FastEthernet0/0 seq 0x6CF opt 0x52 flag 0x1 len 32

*Mar 1 00:10:07.111: OSPF: Rcv LS UPD from 3.3.3.3 on FastEthernet0/0 length 88 LSA count 1

*Mar 1 00:10:07.115: OSPF: Rcv LS UPD from 3.3.3.3 on FastEthernet0/0 length 68 LSA count 1

*Mar 1 00:10:07.183: OSPF: Rcv LS REQ from 3.3.3.3 on FastEthernet0/0 length 36 LSA count 1

*Mar 1 00:10:07.187: OSPF: Send UPD to 192.168.1.3 on FastEthernet0/0 length 52 LSA count 1

*Mar 1 00:10:07.187: OSPF: Rcv DBD from 3.3.3.3 on FastEthernet0/0 seq 0x6CF opt 0x52 flag 0x0 len 32 mtu 1500 state EXCHANGE

*Mar 1 00:10:07.187: OSPF: Exchange Done with 3.3.3.3 on FastEthernet0/0

*Mar 1 00:10:07.187: OSPF: Synchronized with 3.3.3.3 on FastEthernet0/0, state <b>FULL</b>

*Mar 1 00:10:07.191: %OSPF-5-ADJCHG: Process 1, <b>Nbr 3.3.3.3 on FastEthernet0/0 from LOADING to FULL, Loading Done</b>

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

繼續閱讀