OSPF协议总结

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了OSPF协议总结相关的知识,希望对你有一定的参考价值。

OSPF思维导图:

技术分享图片

Ospf控制选路及互备案列

技术分享图片

R1:
interface Loopback0
ip address 10.255.1.1 255.255.255.255
interface Loopback1
ip address 10.100.1.1 255.255.255.0
ip ospf network point-to-point
interface Loopback2
ip address 10.200.1.1 255.255.255.0
ip ospf network point-to-point
interface Ethernet0/0
ip address 10.1.12.1 255.255.255.0
interface Ethernet0/1
ip address 10.1.13.1 255.255.255.0
interface Ethernet0/2
no ip address
interface Ethernet0/2.1
encapsulation dot1Q 10
ip address 10.1.14.1 255.255.255.0
interface Ethernet0/2.2
encapsulation dot1Q 20
ip address 10.2.14.1 255.255.255.0
router ospf 1
router-id 10.255.1.1
network 10.1.12.0 0.0.0.255 area 1
network 10.1.13.0 0.0.0.255 area 1
network 10.1.14.0 0.0.0.255 area 1
network 10.2.14.0 0.0.0.255 area 2
network 10.100.1.1 0.0.0.0 area 1
network 10.200.1.1 0.0.0.0 area 2
network 10.255.1.1 0.0.0.0 area 1
R2:
interface Loopback0
ip address 10.255.2.2 255.255.255.255
interface Loopback1
ip address 10.100.2.2 255.255.255.0
ip ospf network point-to-point
interface Loopback2
ip address 10.200.2.2 255.255.255.0
ip ospf network point-to-point
interface Ethernet0/0
ip address 10.1.12.2 255.255.255.0
interface Ethernet0/1
no ip address
interface Ethernet0/1.1
encapsulation dot1Q 10
ip address 10.1.23.2 255.255.255.0
interface Ethernet0/1.2
encapsulation dot1Q 20
ip address 10.2.23.2 255.255.255.0
interface Ethernet0/2
ip address 10.1.24.2 255.255.255.0
router ospf 1
router-id 10.255.2.2
network 10.1.12.0 0.0.0.255 area 1
network 10.1.23.0 0.0.0.255 area 1
network 10.1.24.0 0.0.0.255 area 2
network 10.2.23.0 0.0.0.255 area 2
network 10.100.2.2 0.0.0.0 area 1
network 10.200.2.2 0.0.0.0 area 2
network 10.255.2.2 0.0.0.0 area 2
R3:
interface Loopback0
ip address 10.255.3.3 255.255.255.255
interface Ethernet0/0
no ip address
interface Ethernet0/0.1
encapsulation dot1Q 10
ip address 10.1.23.3 255.255.255.0
interface Ethernet0/0.2
encapsulation dot1Q 20
ip address 10.2.23.3 255.255.255.0
interface Ethernet0/1
ip address 10.1.13.3 255.255.255.0
interface Ethernet0/2
ip address 10.1.34.3 255.255.255.0
interface Serial1/1
no ip address
encapsulation frame-relay
no keepalive
serial restart-delay 0
interface Serial1/1.1 point-to-point
ip address 10.1.35.3 255.255.255.0
no keepalive
frame-relay interface-dlci 100
interface Serial1/1.2 point-to-point
ip address 10.2.35.3 255.255.255.0
ip ospf cost 100
no keepalive
frame-relay interface-dlci 200
router ospf 1
router-id 10.255.3.3
network 10.1.13.0 0.0.0.255 area 1
network 10.1.23.0 0.0.0.255 area 1
network 10.1.34.0 0.0.0.255 area 0
network 10.1.35.0 0.0.0.255 area 1
network 10.2.23.0 0.0.0.255 area 2
network 10.2.35.0 0.0.0.255 area 2
network 10.255.3.3 0.0.0.0 area 1
R4:
interface Loopback0
ip address 10.255.4.4 255.255.255.255
interface Ethernet0/0
ip address 10.1.34.4 255.255.255.0
interface Ethernet0/1
ip address 10.1.24.4 255.255.255.0
interface Ethernet0/2
no ip address
interface Ethernet0/2.1
encapsulation dot1Q 10
ip address 10.1.14.4 255.255.255.0
interface Ethernet0/2.2
encapsulation dot1Q 20
ip address 10.2.14.4 255.255.255.0
interface Serial1/1
no ip address
encapsulation frame-relay
no keepalive
serial restart-delay 0
interface Serial1/1.1 point-to-point
ip address 10.1.45.4 255.255.255.0
ip ospf cost 100
no keepalive
frame-relay interface-dlci 100
interface Serial1/1.2 point-to-point
ip address 10.2.45.4 255.255.255.0
no keepalive
frame-relay interface-dlci 200
router ospf 1
router-id 10.255.4.4
network 10.1.14.0 0.0.0.255 area 1
network 10.1.24.0 0.0.0.255 area 2
network 10.1.34.0 0.0.0.255 area 0
network 10.1.45.0 0.0.0.255 area 1
network 10.2.14.0 0.0.0.255 area 2
network 10.2.45.0 0.0.0.255 area 2
network 10.255.4.4 0.0.0.0 area 2
R5:
interface Loopback0
ip address 10.255.5.5 255.255.255.255
interface Loopback1
ip address 10.100.5.5 255.255.255.0
ip ospf network point-to-point
interface Loopback2
ip address 10.200.5.5 255.255.255.0
ip ospf network point-to-point
interface Serial1/0
no ip address
encapsulation frame-relay
no keepalive
serial restart-delay 0
interface Serial1/0.1 point-to-point
ip address 10.1.35.5 255.255.255.0
no keepalive
frame-relay interface-dlci 100
interface Serial1/0.2 point-to-point
ip address 10.2.35.5 255.255.255.0
ip ospf cost 100
no keepalive
frame-relay interface-dlci 200
interface Serial1/1
no ip address
encapsulation frame-relay
no keepalive
serial restart-delay 0
interface Serial1/1.1 point-to-point
ip address 10.1.45.5 255.255.255.0
ip ospf cost 100
no keepalive
frame-relay interface-dlci 100
interface Serial1/1.2 point-to-point
ip address 10.2.45.5 255.255.255.0
no keepalive
frame-relay interface-dlci 200
router ospf 1
router-id 10.255.5.5
network 10.1.35.0 0.0.0.255 area 1
network 10.1.45.0 0.0.0.255 area 1
network 10.2.35.0 0.0.0.255 area 2
network 10.2.45.0 0.0.0.255 area 2
network 10.100.5.5 0.0.0.0 area 1
network 10.200.5.5 0.0.0.0 area 2
network 10.255.5.5 0.0.0.0 area 1
断开R3的s1/1前,R5的路由表
r5#show ip route
Codes: L - local, 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, H - NHRP, l - LISP

    • replicated route, % - next hop override

Gateway of last resort is not set

  10.0.0.0/8 is variably subnetted, 29 subnets, 2 masks

O 10.1.12.0/24 [110/84] via 10.1.35.3, 00:13:36, Serial1/0.1
O 10.1.13.0/24 [110/74] via 10.1.35.3, 00:07:14, Serial1/0.1
O 10.1.14.0/24 [110/84] via 10.1.35.3, 00:07:14, Serial1/0.1
O 10.1.23.0/24 [110/74] via 10.1.35.3, 00:13:36, Serial1/0.1
O 10.1.24.0/24 [110/74] via 10.2.45.4, 00:49:05, Serial1/1.2
O IA 10.1.34.0/24 [110/74] via 10.2.45.4, 00:03:06, Serial1/1.2
[110/74] via 10.1.35.3, 00:13:36, Serial1/0.1
C 10.1.35.0/24 is directly connected, Serial1/0.1
L 10.1.35.5/32 is directly connected, Serial1/0.1
C 10.1.45.0/24 is directly connected, Serial1/1.1
L 10.1.45.5/32 is directly connected, Serial1/1.1
O 10.2.14.0/24 [110/74] via 10.2.45.4, 00:49:05, Serial1/1.2
O 10.2.23.0/24 [110/84] via 10.2.45.4, 00:40:33, Serial1/1.2
C 10.2.35.0/24 is directly connected, Serial1/0.2
L 10.2.35.5/32 is directly connected, Serial1/0.2
C 10.2.45.0/24 is directly connected, Serial1/1.2
L 10.2.45.5/32 is directly connected, Serial1/1.2
O 10.100.1.0/24 [110/75] via 10.1.35.3, 00:06:42, Serial1/0.1
O 10.100.2.0/24 [110/75] via 10.1.35.3, 00:05:56, Serial1/0.1
C 10.100.5.0/24 is directly connected, Loopback1
L 10.100.5.5/32 is directly connected, Loopback1
O 10.200.1.0/24 [110/75] via 10.2.45.4, 00:06:21, Serial1/1.2
O 10.200.2.0/24 [110/75] via 10.2.45.4, 00:05:46, Serial1/1.2
C 10.200.5.0/24 is directly connected, Loopback2
L 10.200.5.5/32 is directly connected, Loopback2
O 10.255.1.1/32 [110/75] via 10.1.35.3, 00:07:14, Serial1/0.1
O 10.255.2.2/32 [110/75] via 10.2.45.4, 00:49:05, Serial1/1.2
O 10.255.3.3/32 [110/65] via 10.1.35.3, 00:13:36, Serial1/0.1
O 10.255.4.4/32 [110/65] via 10.2.45.4, 00:49:05, Serial1/1.2
C 10.255.5.5/32 is directly connected, Loopback0
断开R3的s1/1后,R5的路由表
r5#show ip route
Codes: L - local, 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, H - NHRP, l - LISP

    • replicated route, % - next hop override

Gateway of last resort is not set

  10.0.0.0/8 is variably subnetted, 29 subnets, 2 masks

O 10.1.12.0/24 [110/120] via 10.1.45.4, 00:00:00, Serial1/1.1
O 10.1.13.0/24 [110/120] via 10.1.45.4, 00:00:00, Serial1/1.1
O 10.1.14.0/24 [110/110] via 10.1.45.4, 00:00:00, Serial1/1.1
O 10.1.23.0/24 [110/130] via 10.1.45.4, 00:00:00, Serial1/1.1
O 10.1.24.0/24 [110/74] via 10.2.45.4, 00:54:02, Serial1/1.2
O IA 10.1.34.0/24 [110/74] via 10.2.45.4, 00:00:00, Serial1/1.2
C 10.1.35.0/24 is directly connected, Serial1/0.1
L 10.1.35.5/32 is directly connected, Serial1/0.1
C 10.1.45.0/24 is directly connected, Serial1/1.1
L 10.1.45.5/32 is directly connected, Serial1/1.1
O 10.2.14.0/24 [110/74] via 10.2.45.4, 00:54:02, Serial1/1.2
O 10.2.23.0/24 [110/84] via 10.2.45.4, 00:45:30, Serial1/1.2
C 10.2.35.0/24 is directly connected, Serial1/0.2
L 10.2.35.5/32 is directly connected, Serial1/0.2
C 10.2.45.0/24 is directly connected, Serial1/1.2
L 10.2.45.5/32 is directly connected, Serial1/1.2
O 10.100.1.0/24 [110/111] via 10.1.45.4, 00:00:00, Serial1/1.1
O 10.100.2.0/24 [110/121] via 10.1.45.4, 00:00:00, Serial1/1.1
C 10.100.5.0/24 is directly connected, Loopback1
L 10.100.5.5/32 is directly connected, Loopback1
O 10.200.1.0/24 [110/75] via 10.2.45.4, 00:11:18, Serial1/1.2
O 10.200.2.0/24 [110/75] via 10.2.45.4, 00:10:43, Serial1/1.2
C 10.200.5.0/24 is directly connected, Loopback2
L 10.200.5.5/32 is directly connected, Loopback2
O 10.255.1.1/32 [110/111] via 10.1.45.4, 00:00:00, Serial1/1.1
O 10.255.2.2/32 [110/75] via 10.2.45.4, 00:54:02, Serial1/1.2
O 10.255.3.3/32 [110/121] via 10.1.45.4, 00:00:00, Serial1/1.1
O 10.255.4.4/32 [110/65] via 10.2.45.4, 00:54:02, Serial1/1.2
C 10.255.5.5/32 is directly connected, Loopback0
断开R3的e0/1前,R1的路由表
r1#show ip route
Codes: L - local, 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, H - NHRP, l - LISP

    • replicated route, % - next hop override

Gateway of last resort is not set

  10.0.0.0/8 is variably subnetted, 29 subnets, 2 masks

C 10.1.12.0/24 is directly connected, Ethernet0/0
L 10.1.12.1/32 is directly connected, Ethernet0/0
C 10.1.13.0/24 is directly connected, Ethernet0/1
L 10.1.13.1/32 is directly connected, Ethernet0/1
C 10.1.14.0/24 is directly connected, Ethernet0/2.1
L 10.1.14.1/32 is directly connected, Ethernet0/2.1
O 10.1.23.0/24 [110/20] via 10.1.13.3, 00:13:13, Ethernet0/1
[110/20] via 10.1.12.2, 01:05:13, Ethernet0/0
O 10.1.24.0/24 [110/20] via 10.2.14.4, 00:58:30, Ethernet0/2.2
O IA 10.1.34.0/24 [110/20] via 10.2.14.4, 00:00:07, Ethernet0/2.2
[110/20] via 10.1.14.4, 00:57:55, Ethernet0/2.1
[110/20] via 10.1.13.3, 00:13:13, Ethernet0/1
O 10.1.35.0/24 [110/74] via 10.1.13.3, 00:00:07, Ethernet0/1
O 10.1.45.0/24 [110/110] via 10.1.14.4, 00:48:47, Ethernet0/2.1
C 10.2.14.0/24 is directly connected, Ethernet0/2.2
L 10.2.14.1/32 is directly connected, Ethernet0/2.2
O 10.2.23.0/24 [110/30] via 10.2.14.4, 00:58:30, Ethernet0/2.2
O 10.2.35.0/24 [110/130] via 10.2.14.4, 00:00:07, Ethernet0/2.2
O 10.2.45.0/24 [110/74] via 10.2.14.4, 00:57:42, Ethernet0/2.2
C 10.100.1.0/24 is directly connected, Loopback1
L 10.100.1.1/32 is directly connected, Loopback1
O 10.100.2.0/24 [110/11] via 10.1.12.2, 00:12:05, Ethernet0/0
O 10.100.5.0/24 [110/111] via 10.1.14.4, 00:01:12, Ethernet0/2.1
C 10.200.1.0/24 is directly connected, Loopback2
L 10.200.1.1/32 is directly connected, Loopback2
O 10.200.2.0/24 [110/21] via 10.2.14.4, 00:11:55, Ethernet0/2.2
O 10.200.5.0/24 [110/75] via 10.2.14.4, 00:09:14, Ethernet0/2.2
C 10.255.1.1/32 is directly connected, Loopback0
O 10.255.2.2/32 [110/21] via 10.2.14.4, 00:58:30, Ethernet0/2.2
O 10.255.3.3/32 [110/11] via 10.1.13.3, 00:13:13, Ethernet0/1
O 10.255.4.4/32 [110/11] via 10.2.14.4, 00:58:30, Ethernet0/2.2
O 10.255.5.5/32 [110/111] via 10.1.14.4, 00:01:12, Ethernet0/2.1
断开R3的e0/1后,R1的路由表
r1#show ip route
Codes: L - local, 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, H - NHRP, l - LISP

    • replicated route, % - next hop override

Gateway of last resort is not set

  10.0.0.0/8 is variably subnetted, 29 subnets, 2 masks

C 10.1.12.0/24 is directly connected, Ethernet0/0
L 10.1.12.1/32 is directly connected, Ethernet0/0
C 10.1.13.0/24 is directly connected, Ethernet0/1
L 10.1.13.1/32 is directly connected, Ethernet0/1
C 10.1.14.0/24 is directly connected, Ethernet0/2.1
L 10.1.14.1/32 is directly connected, Ethernet0/2.1
O 10.1.23.0/24 [110/20] via 10.1.12.2, 01:06:34, Ethernet0/0
O 10.1.24.0/24 [110/20] via 10.2.14.4, 00:59:51, Ethernet0/2.2
O IA 10.1.34.0/24 [110/20] via 10.2.14.4, 00:00:09, Ethernet0/2.2
[110/20] via 10.1.14.4, 00:59:16, Ethernet0/2.1
O 10.1.35.0/24 [110/84] via 10.1.12.2, 00:00:09, Ethernet0/0
O 10.1.45.0/24 [110/110] via 10.1.14.4, 00:50:08, Ethernet0/2.1
C 10.2.14.0/24 is directly connected, Ethernet0/2.2
L 10.2.14.1/32 is directly connected, Ethernet0/2.2
O 10.2.23.0/24 [110/30] via 10.2.14.4, 00:59:51, Ethernet0/2.2
O 10.2.35.0/24 [110/130] via 10.2.14.4, 00:01:28, Ethernet0/2.2
O 10.2.45.0/24 [110/74] via 10.2.14.4, 00:59:03, Ethernet0/2.2
C 10.100.1.0/24 is directly connected, Loopback1
L 10.100.1.1/32 is directly connected, Loopback1
O 10.100.2.0/24 [110/11] via 10.1.12.2, 00:13:26, Ethernet0/0
O 10.100.5.0/24 [110/85] via 10.1.12.2, 00:00:09, Ethernet0/0
C 10.200.1.0/24 is directly connected, Loopback2
L 10.200.1.1/32 is directly connected, Loopback2
O 10.200.2.0/24 [110/21] via 10.2.14.4, 00:13:16, Ethernet0/2.2
O 10.200.5.0/24 [110/75] via 10.2.14.4, 00:10:35, Ethernet0/2.2
C 10.255.1.1/32 is directly connected, Loopback0
O 10.255.2.2/32 [110/21] via 10.2.14.4, 00:59:51, Ethernet0/2.2
O 10.255.3.3/32 [110/21] via 10.1.12.2, 00:00:09, Ethernet0/0
O 10.255.4.4/32 [110/11] via 10.2.14.4, 00:59:51, Ethernet0/2.2
O 10.255.5.5/32 [110/85] via 10.1.12.2, 00:00:09, Ethernet0/0

以上是关于OSPF协议总结的主要内容,如果未能解决你的问题,请参考以下文章

OSPF协议超详总结

OSPF协议总结

OSPF协议的总结

HCNP网络工程师OSPF学习总结

OSPF协议各类LSA的内容总结

OSPF总结