OSPF
精髓
5
类
LSA
和
RIP
综合实验
R1
的配置:首先配置每个接口ip地址 并加上环回口
R1>en
R1#conf t
R1(config)#inter fa0/0
R1(config-if)#ip address 202.106.12.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#int loop 0
R1(config-if)#ip add 1.1.1.1 255.255.255.255
R1(config-if)#no shut
R1(config)#router rip 配置RIP动态路由协议 度量值为跳数并保存
R1(config-router)#v 2
R1(config-router)#no auto-summary
R1(config-router)#net 0.0.0.0
R1(config-router)#end
R1(config)#ip route 0.0.0.0 0.0.0.0 202.106.12.2
R1#write
Building configuration...
[OK]
R2
的配置
R2>en
R2#conf t
R2(config)#inter f0/0
R2(config-if)#ip address 202.106.12.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#inter f0/1
R2(config-if)#ip address 202.106.23.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#inter loop 0
R2(config-if)#ip address 2.2.2.2 255.255.255.255
R2(config-if)#no shut
R2(config-if)#ex
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#no auto-summary
R2(config-router)#net 0.0.0.0
R2(config-router)#end
R2(config)#ip route 0.0.0.0 0.0.0.0 202.106.23.3
R2#write
Building configuration...
[OK]
R3
的配置
R3>en
R3#conf t
R3(config)#inter f0/0
R3(config-if)#ip address 202.106.23.3 255.255.255.0
R3(config-if)#no shut
R3(config-if)#inter f0/1
R3(config-if)#ip address 202.106.34.3 255.255.255.0
R3(config-if)#no shut
R3(config-if)#inter loop 0
R3(config-if)#ip address 3.3.3.3 255.255.255.255
R3(config-if)#no shut
R3(config-if)#ex
R3(config)#router ospf 110 配置OSPF协议 度量值为COST
R3(config-router)#net 3.3.3.3 0.0.0.0 a 1
R3(config-router)#net 202.106.34.0 0.0.0.255 a 1
R3(config-router)#net 202.106.23.0 0.0.0.255 a 1
R3(config-router)#redistribute rip subnets 把RIP协议加入到OSPF里
R3(config-router)#end
R3(config)#router rip
R3(config-router)#v 2
R3(config-router)#no au
R3(config-router)#net 0.0.0.0
R3(config-router)#end
R3#show ip rout
C 202.106.23.0/24 is directly connected, FastEthernet0/0
1.0.0.0/32 is subnetted, 1 subnets
R 1.1.1.1 [120/2] via 202.106.23.2, 00:00:16, FastEthernet0/0
2.0.0.0/32 is subnetted, 1 subnets
R 2.2.2.2 [120/1] via 202.106.23.2, 00:00:16, FastEthernet0/0
3.0.0.0/32 is subnetted, 1 subnets
C 3.3.3.3 is directly connected, Loopback0
4.0.0.0/32 is subnetted, 1 subnets
O 4.4.4.4 [110/11] via 202.106.34.4, 00:01:46, FastEthernet0/1
5.0.0.0/32 is subnetted, 1 subnets
O IA 5.5.5.5 [110/21] via 202.106.34.4, 00:01:48, FastEthernet0/1
6.0.0.0/32 is subnetted, 1 subnets
O IA 6.6.6.6 [110/31] via 202.106.34.4, 00:01:48, FastEthernet0/1
C 202.106.34.0/24 is directly connected, FastEthernet0/1
O IA 202.106.45.0/24 [110/20] via 202.106.34.4, 00:07:02, FastEthernet0/1
R 202.106.12.0/24 [120/1] via 202.106.23.2, 00:00:23, FastEthernet0/0
O IA 202.106.56.0/24 [110/30] via 202.106.34.4, 00:07:02, FastEthernet0/1
R3#write
Building configuration...
[OK]
R3#
R4
的配置
R4>en
R4#conf t
R4(config)#inter f0/0
R4(config-if)#ip address 202.106.34.4 255.255.255.0
R4(config-if)#no shut
R4(config-if)#inter f0/1
R4(config-if)#ip address 202.106.45.4 255.255.255.0
R4(config-if)#no shut
R4(config-if)#inter loop 0
R4(config-if)#ip address 4.4.4.4 255.255.255.255
R4(config-if)#no shut
R4(config-if)#ex
R4(config)#router ospf 110
R4(config-router)#net 4.4.4.4 0.0.0.0 a 1
R4(config-router)#net 202.106.34.0 0.0.0.255 a 1
R4(config-router)#net 202.106.45.0 0.0.0.255 a 0
R4(config-router)#end
R4#write
Building configuration...
R5
的配置
R5>en
R5#conf t
R5(config)#inter f0/0
R5(config-if)#ip address 202.106.45.5 255.255.255.0
R5(config-if)#no shut
R5(config-if)#inter f0/1
R5(config-if)#ip address 202.106.56.5 255.255.255.0
R5(config-if)#no shut
R5(config-if)#inter loop 0
R5(config-if)#ip address 5.5.5.5 255.255.255.255
R5(config-if)#no shut
R5(config-if)#ex
R5(config)#router ospf 110
R5(config-router)#net 5.5.5.5 0.0.0.0 a 0
R5(config-router)#net 202.106.56.0 0.0.0.255 a 2
R5(config-router)#net 202.106.45.0 0.0.0.255 a 0
R5#write
Building configuration...
R6
的配置
R6>en
R6#conf t
R6(config)#inter f0/0
R6(config-if)#ip address 202.106.56.6 255.255.255.0
R6(config-if)#no shut
R6(config-if)#int loop 0
R6(config-if)#ip address 6.6.6.6 255.255.255.255
R6(config-if)#no shut
R6(config-if)#ex
R6(config)#router ospf 110
R6(config-router)#net 6.6.6.6 0.0.0.0 a 2
R6(config-router)#net 202.106.56.0 0.0.0.255 a 2
R6(config-router)#end
R6#ping 202.106.34.3
ending 5, 100-byte ICMP Echos to 202.106.34.3, timeout is 2 seconds:
!!!!!
R6#write
Building configuration...
[OK]
R6#show ip route
O IA 202.106.23.0/24 [110/40] via 202.106.56.5, 00:01:54, FastEthernet0/0
1.0.0.0/32 is subnetted, 1 subnets
O E2 1.1.1.1 [110/20] via 202.106.56.5, 00:01:49, FastEthernet0/0
2.0.0.0/32 is subnetted, 1 subnets
O E2 2.2.2.2 [110/20] via 202.106.56.5, 00:01:49, FastEthernet0/0
3.0.0.0/32 is subnetted, 1 subnets
O IA 3.3.3.3 [110/31] via 202.106.56.5, 00:20:46, FastEthernet0/0
4.0.0.0/32 is subnetted, 1 subnets
O IA 4.4.4.4 [110/21] via 202.106.56.5, 00:20:46, FastEthernet0/0
5.0.0.0/32 is subnetted, 1 subnets
O IA 5.5.5.5 [110/11] via 202.106.56.5, 00:20:47, FastEthernet0/0
6.0.0.0/32 is subnetted, 1 subnets
C 6.6.6.6 is directly connected, Loopback0
O IA 202.106.34.0/24 [110/30] via 202.106.56.5, 00:20:48, FastEthernet0/0
O IA 202.106.45.0/24 [110/20] via 202.106.56.5, 00:20:48, FastEthernet0/0
O E2 202.106.12.0/24 [110/20] via 202.106.56.5, 00:01:51, FastEthernet0/0
C 202.106.56.0/24 is directly connected, FastEthernet0/0
R6#ping 2.2.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
!!!!!
查看一类
LSA show ip ospf database router
查看
2
类
LSA show ip ospf database network
查看
3
类
LSA show ip ospf database summary
查看
4
类
LSA show ip ospf database asbr-summary
查看
5
类
LSA show ip ospf database external
1
类
|
由区域内的路由器发出。
|
2
类
|
由区域内的
DR
发出,这个广播网络有哪些成员。
|
3
类
|
通告一个结果,
ABR
发出,其他区域的汇总链路通告。
|
4
类
|
是
ABR
产生的,用于通告
ASBR
信息
|
5
类
|
AS
外部的
LSA
,
ASBR
发出的,用于通告外部路由。有能力引入外部路由的路由器就是
ASBR
|
7
类
|
NSSA
外部的
LSA
,
NSSA
区域内的
ASBR
发出,用于通告本区域连接的外部路由
|
OE 2
的路由在域间和域外的度量值固定值是
20
,不累加
类型
2
类型
1
在
OSPF
域内累加,每经一跳,累加度量值,域外不累加!