1. 程式人生 > >Cisco之OSPF

Cisco之OSPF

cisco ospf

OSPF網絡架構如下:

技術分享

R1的配置:

R1(config)#router ospf 100

R1(config-router)#router-id 1.1.1.1

R1(config-router)#network 10.1.1.0 0.0.0.3 area 0

R1(config-router)#network 10.1.1.4 0.0.0.3 area 1


R2的配置:

R2(config)#router ospf 100

R2(config-router)#router-id 2.2.2.2

R2(config-router)#network 10.1.1.8 0.0.0.3 area 0

R2(config-router)#network 10.1.1.12 0.0.0.3 area 1


R3的配置:

R3(config)#router ospf 100

R3(config-router)#router-id 3.3.3.3

R3(config-router)#network 10.1.1.0 0.0.0.3 area 0

R3(config-router)#network 10.1.1.8 0.0.0.3 area 0

R3(config-router)#network 192.168.1.0 0.0.0.255 area 0


R4的配置:

R4(config)#router ospf 100

R4(config-router)#router-id 4.4.4.4

R4(config-router)#network 10.1.1.4 0.0.0.3 area 1

R4(config-router)#network 10.1.1.12 0.0.0.3 area 1

R4(config-router)#network 172.16.1.0 0.0.0.255 area 1


顯示路由器的路由協議信息:

R1#sh ip protocols

Routing Protocol is "ospf 100"

Outgoing update filter list for all interfaces is not set

Incoming update filter list for all interfaces is not set

Router ID 1.1.1.1

It is an area border router

Number of areas in this router is 2. 2 normal 0 stub 0 nssa

Maximum path: 4

Routing for Networks:

10.1.1.0 0.0.0.3 area 0

10.1.1.4 0.0.0.3 area 1

Reference bandwidth unit is 100 mbps

Routing Information Sources:

Gateway Distance Last Update

4.4.4.4 110 00:14:48

2.2.2.2 110 00:14:48

3.3.3.3 110 00:17:19

Distance: (default is 110)


查看路由表:

R1#sh ip route

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


172.16.0.0/32 is subnetted, 1 subnets

O 172.16.1.1 [110/2] via 10.1.1.6, 00:03:55, FastEthernet1/0

10.0.0.0/30 is subnetted, 4 subnets

O 10.1.1.8 [110/2] via 10.1.1.1, 00:06:26, FastEthernet0/0

O 10.1.1.12 [110/2] via 10.1.1.6, 00:03:55, FastEthernet1/0

C 10.1.1.0 is directly connected, FastEthernet0/0

C 10.1.1.4 is directly connected, FastEthernet1/0

192.168.1.0/32 is subnetted, 1 subnets

O 192.168.1.1 [110/2] via 10.1.1.1, 00:06:26, FastEthernet0/0


僅顯示與OSPF相關的路由信息:

R1#sh ip route ospf

172.16.0.0/32 is subnetted, 1 subnets

O 172.16.1.1 [110/2] via 10.1.1.6, 00:17:27, FastEthernet1/0

10.0.0.0/30 is subnetted, 4 subnets

O 10.1.1.8 [110/2] via 10.1.1.1, 00:19:58, FastEthernet0/0

O 10.1.1.12 [110/2] via 10.1.1.6, 00:17:27, FastEthernet1/0

192.168.1.0/32 is subnetted, 1 subnets

O 192.168.1.1 [110/2] via 10.1.1.1, 00:19:58, FastEthernet0/0


驗證網絡是否暢通:

R3#ping 172.16.1.1 source 192.168.1.1


Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds:

Packet sent with a source address of 192.168.1.1

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 52/66/76 ms


查看鄰接關系:

R1#sh ip ospf neighbor


Neighbor ID Pri State Dead Time Address Interface

3.3.3.3 1 FULL/BDR 00:00:34 10.1.1.1 FastEthernet0/0

4.4.4.4 1 FULL/BDR 00:00:32 10.1.1.6 FastEthernet1/0


R3#sh ip ospf neighbor


Neighbor ID Pri State Dead Time Address Interface

2.2.2.2 1 FULL/DR 00:00:33 10.1.1.10 FastEthernet1/0

1.1.1.1 1 FULL/DR 00:00:35 10.1.1.2 FastEthernet0/0


查看接口是否加入正確的區域:

R1#sh ip ospf interface

FastEthernet0/0 is up, line protocol is up

Internet Address 10.1.1.2/30, Area 0

Process ID 100, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 1

Transmit Delay is 1 sec, State DR, Priority 1

Designated Router (ID) 1.1.1.1, Interface address 10.1.1.2

Backup Designated router (ID) 3.3.3.3, Interface address 10.1.1.1

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

oob-resync timeout 40

Hello due in 00:00:07

Supports Link-local Signaling (LLS)

Index 1/1, 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 4 msec

Neighbor Count is 1, Adjacent neighbor count is 1

Adjacent with neighbor 3.3.3.3 (Backup Designated Router)

Suppress hello for 0 neighbor(s)

FastEthernet1/0 is up, line protocol is up

Internet Address 10.1.1.5/30, Area 1

Process ID 100, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 1

Transmit Delay is 1 sec, State DR, Priority 1

Designated Router (ID) 1.1.1.1, Interface address 10.1.1.5

Backup Designated router (ID) 4.4.4.4, Interface address 10.1.1.6

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

oob-resync timeout 40

Hello due in 00:00:06

Supports Link-local Signaling (LLS)

Index 1/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

Neighbor Count is 1, Adjacent neighbor count is 1

Adjacent with neighbor 4.4.4.4 (Backup Designated Router)

Suppress hello for 0 neighbor(s)


查看OSPF數據庫:

R1#sh ip ospf database


OSPF Router with ID (1.1.1.1) (Process ID 100)


Router Link States (Area 0)


Link ID ADV Router Age Seq# Checksum Link count

1.1.1.1 1.1.1.1 1390 0x80000003 0x00AD5E 1

2.2.2.2 2.2.2.2 1373 0x80000003 0x0022D1 1

3.3.3.3 3.3.3.3 1367 0x80000005 0x00083C 3


Net Link States (Area 0)


Link ID ADV Router Age Seq# Checksum

10.1.1.2 1.1.1.1 1390 0x80000001 0x007AA0

10.1.1.10 2.2.2.2 1374 0x80000001 0x002EDC


Summary Net Link States (Area 0)


Link ID ADV Router Age Seq# Checksum

10.1.1.4 1.1.1.1 1749 0x80000001 0x00A189

10.1.1.4 2.2.2.2 1218 0x80000001 0x008D98

10.1.1.12 1.1.1.1 1225 0x80000001 0x005BC6

10.1.1.12 2.2.2.2 1507 0x80000001 0x0033EB



本文出自 “一萬年太久,只爭朝夕” 博客,請務必保留此出處http://zengwj1949.blog.51cto.com/10747365/1927782

Cisco之OSPF