通过实验来学习多种LSA
实验:
实验步骤:
++++++++++++++++++++++++++++++++++++++++++++
r1
++++++++++++++++++++++++++++++++++++++++++++
en
conf t
no ip do lo
line c 0
exec-t 0 0
logg sync
exit
host r1
in e0/1
ip add 192.168.4.1 255.255.255.0
no sh
exit
in loo 0
ip add 192.168.1.1 255.255.255.0
exit
in loo 1
ip add 192.168.2.1 255.255.255.0
exit
in loo 2
ip add 192.168.3.1 255.255.255.0
exit
router ospf 1
net 192.168.1.0 0.0.0.255 a 1
net 192.168.2.0 0.0.0.255 a 1
net 192.168.3.0 0.0.0.255 a 1
net 192.168.4.0 0.0.0.255 a 1
end
write
++++++++++++++++++++++++++++++++++++++++++++++++++
r2
++++++++++++++++++++++++++++++++++++++++++++++++++
en
conf t
no ip do lo
host r2
line c 0
exec-t 0 0
logg sync
exit
in e0/1
ip add 192.168.4.2 255.255.255.0
no sh
exit
in e0/2
ip add 192.168.5.1 255.255.255.0
no sh
exit
router ospf 1
net 192.168.4.0 0.0.0.255 a 1
net 192.168.5.0 0.0.0.255 a 0
end
write
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
r3
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
en
conf t
no ip do lo
host r3
line c 0
exec-t 0 0
logg sync
exit
in e0/2
ip add 192.168.5.2 255.255.255.0
no sh
exit
in e0/3
ip add 192.168.6.1 255.255.255.0
no sh
exit
router ospf 1
net 192.168.5.0 0.0.0.255 a 0
net 192.168.6.0 0.0.0.255 a 2
end
write
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
r4
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
en
conf t
no ip do lo
line c 0
exec-t 0 0
logg sync
exit
in e0/3
ip add 192.168.6.2 255.255.255.0
no sh
exit
in e0/0
ip add 192.168.70.1 255.255.255.0
no sh
exit
router rip
ver 2
no au
net 192.168.70.0
exit
router ospf 1
net 192.168.6.0 0.0.0.255 a 2
redistribute rip subnets
exit
router rip
redistribute ospf 1 metric 1
end
write
+++++++++++++++++++++++++++++++++++++++++++++
r5
++++++++++++++++++++++++++++++++++++++++++++++
en
conf t
no ip do lo
host r5
line c 0
exec-t 0 0
logg sync
exit
in e0/0
ip add 192.168.70.2 255.255.255.0
no sh
exit
in loo 0
ip add 192.168.80.1 255.255.255.0
exit
in loo 1
ip add 192.168.90.1 255.255.255.0
exit
in loo 2
ip add 192.168.100.1 255.255.255.0
exit
router rip
ver 2
no au
net 192.168.70.0
net 192.168.80.0
net 192.168.90.0
net 192.168.100.0
end
copy running startup
++++++++++++++++++++++++++++++++++++++++++++++++++++++
配置完以上命令后:查看个路由表。
R1 – R3 是类似的。有O ,O E2 ,O IA ,C,
关键看R4:它是外部LSA的发布者。它不会有外部LSA。
R5:只有RIP ,C 路径。
查看R1的链路状态数据库:
r1#show ip ospf database
OSPF Router with ID (192.168.3.1) (Process ID 1)
Router Link States (Area 1)*由同区的路由器发出*
Link ID ADV Router Age Seq# Checksum Link count
192.168.3.1 192.168.3.1 791 0x80000002 0x0051A6 4
192.168.5.1 192.168.5.1 737 0x80000003 0x00A8C0 1
Net Link States (Area 1) *唯广播网络特有*由DR发出*
Link ID ADV Router Age Seq# Checksum
192.168.4.2 192.168.5.1 792 0x80000001 0x009FDE
Summary Net Link States (Area 1)*由ABR发出*
Link ID ADV Router Age Seq# Checksum
192.168.5.0 192.168.5.1 718 0x80000003 0x00CB87
192.168.6.0 192.168.5.1 723 0x80000001 0x002921
Summary ASB Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
192.168.70.1 192.168.5.1 723 0x80000001 0x004EB9
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
192.168.70.0 192.168.70.1 1980 0x80000001 0x00330D 0
192.168.80.0 192.168.70.1 640 0x80000001 0x00C471 0
192.168.90.0 192.168.70.1 926 0x80000001 0x0056D5 0
192.168.100.0 192.168.70.1 614 0x80000001 0x00E73A 0
可以看到除5型LSA外,其他LSA都是由R2 (192.168.5.1)发出。
查看R2的链路状态数据库:
r2#show ip ospf database
OSPF Router with ID (192.168.5.1) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link coun
192.168.5.1 192.168.5.1 1799 0x80000005 0x00ACB9 1
192.168.6.1 192.168.6.1 1804 0x80000004 0x00AAB9 1
Net Link States (Area 0)由DR发出
Link ID ADV Router Age Seq# Checksum
192.168.5.2 192.168.6.1 1804 0x80000001 0x00B0C8
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
192.168.1.1 192.168.5.1 1812 0x80000001 0x00FB5B
192.168.2.1 192.168.5.1 1812 0x80000001 0x00F065
192.168.3.1 192.168.5.1 1812 0x80000001 0x00E56F
192.168.4.0 192.168.5.1 1812 0x80000001 0x00DA7B
192.168.6.0 192.168.6.1 1002 0x80000004 0x00B798
Summary ASB Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
192.168.70.1 192.168.6.1 1002 0x80000002 0x00E02F
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link coun
192.168.3.1 192.168.3.1 1868 0x80000002 0x0051A6 4
192.168.5.1 192.168.5.1 1814 0x80000003 0x00A8C0 1
Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
192.168.4.2 192.168.5.1 1868 0x80000001 0x009FDE
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
192.168.5.0 192.168.5.1 1794 0x80000003 0x00CB87
192.168.6.0 192.168.5.1 1799 0x80000001 0x002921
Summary ASB Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
192.168.70.1 192.168.5.1 1799 0x80000001 0x004EB9
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
192.168.70.0 192.168.70.1 1060 0x80000002 0x00310E 0
192.168.80.0 192.168.70.1 1706 0x80000001 0x00C471 0
192.168.90.0 192.168.70.1 53 0x80000002 0x0054D6 0
192.168.100.0 192.168.70.1 1680 0x80000001 0x00E73A 0
对于R2比较特殊。
它既是Area 1 的DR 又是Area 0 的BDR,
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
由此图进一步配置:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
r1:
en
conf t
router ospf 1
area 1 stub
exit
end
r2:
en
conf t
router ospf 1
area 1 stub
exit
end
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++关键看R1的路由表变化:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
原:
O E2 192.168.90.0/24 [110/20] via 192.168.4.2, 00:56:57, Ethernet0/1
C 192.168.4.0/24 is directly connected, Ethernet0/1
O E2 192.168.80.0/24 [110/20] via 192.168.4.2, 00:55:30, Ethernet0/1
O IA 192.168.5.0/24 [110/20] via 192.168.4.2, 00:57:02, Ethernet0/1
O IA 192.168.6.0/24 [110/30] via 192.168.4.2, 00:57:07, Ethernet0/1
C 192.168.1.0/24 is directly connected, Loopback0
C 192.168.2.0/24 is directly connected, Loopback1
O E2 192.168.70.0/24 [110/20] via 192.168.4.2, 00:56:57, Ethernet0/1
O E2 192.168.100.0/24 [110/20] via 192.168.4.2, 00:55:04, Ethernet0/1
C 192.168.3.0/24 is directly connected, Loopback2
配置后:
C 192.168.4.0/24 is directly connected, Ethernet0/1
O IA 192.168.5.0/24 [110/20] via 192.168.4.2, 00:00:09, Ethernet0/1
O IA 192.168.6.0/24 [110/30] via 192.168.4.2, 00:00:09, Ethernet0/1
C 192.168.1.0/24 is directly connected, Loopback0
C 192.168.2.0/24 is directly connected, Loopback1
C 192.168.3.0/24 is directly connected, Loopback2
O*IA 0.0.0.0/0 [110/11] via 192.168.4.2, 00:00:09, Ethernet0/1
可见 R1 不再接收5型LSA。而是用一条默认路由代替。
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
进一步配置:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
r2:
en
conf t
router ospf 1
area 1 stub no-summary
end
查看R1 路由表再次变化:
C 192.168.4.0/24 is directly connected, Ethernet0/1
C 192.168.1.0/24 is directly connected, Loopback0
C 192.168.2.0/24 is directly connected, Loopback1
C 192.168.3.0/24 is directly connected, Loopback2
O*IA 0.0.0.0/0 [110/11] via 192.168.4.2, 00:06:26, Ethernet0/1
R1接收的网络汇总LSA为:
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
0.0.0.0 192.168.5.1 120 0x80000002 0x007A53
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
进一步配置:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
r3:
en
conf t
router ospf 1
area 2 nssa no-summary
end
r4:
en
conf t
router ospf 1
area 2 nssa
end
查看r4的路由表:
R 192.168.90.0/24 [120/1] via 192.168.70.2, 00:00:23, Ethernet0/0
R 192.168.80.0/24 [120/1] via 192.168.70.2, 00:00:23, Ethernet0/0
C 192.168.6.0/24 is directly connected, Ethernet0/3
C 192.168.70.0/24 is directly connected, Ethernet0/0
R 192.168.100.0/24 [120/1] via 192.168.70.2, 00:00:23, Ethernet0/0
O*IA 0.0.0.0/0 [110/11] via 192.168.6.1, 00:00:09, Ethernet0/3
查看r3 的路由表:
O N2 192.168.90.0/24 [110/20] via 192.168.6.2, 00:03:35, Ethernet0/3
O IA 192.168.4.0/24 [110/20] via 192.168.5.1, 00:03:35, Ethernet0/2
O N2 192.168.80.0/24 [110/20] via 192.168.6.2, 00:03:35, Ethernet0/3
C 192.168.5.0/24 is directly connected, Ethernet0/2
C 192.168.6.0/24 is directly connected, Ethernet0/3
192.168.1.0/32 is subnetted, 1 subnets
O IA 192.168.1.1 [110/21] via 192.168.5.1, 00:03:35, Ethernet0/2
192.168.2.0/32 is subnetted, 1 subnets
O IA 192.168.2.1 [110/21] via 192.168.5.1, 00:03:35, Ethernet0/2
O N2 192.168.70.0/24 [110/20] via 192.168.6.2, 00:03:35, Ethernet0/3
O N2 192.168.100.0/24 [110/20] via 192.168.6.2, 00:03:35, Ethernet0/3
192.168.3.0/32 is subnetted, 1 subnets
O IA 192.168.3.1 [110/21] via 192.168.5.1, 00:03:35, Ethernet0/2
查看r3的链路状态数据库:
Type-7 AS External Link States (Area 2)
Link ID ADV Router Age Seq# Checksum Tag
192.168.70.0 192.168.70.1 764 0x80000001 0x00398B 0
192.168.80.0 192.168.70.1 764 0x80000001 0x00CAEF 0
192.168.90.0 192.168.70.1 764 0x80000001 0x005C54 0
192.168.100.0 192.168.70.1 764 0x80000001 0x00EDB8 0
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
192.168.70.0 192.168.6.1 436 0x80000001 0x008F7F 0
192.168.80.0 192.168.6.1 439 0x80000001 0x0021E3 0
192.168.90.0 192.168.6.1 439 0x80000001 0x00B248 0
192.168.100.0 192.168.6.1 439 0x80000001 0x0044AC 0
可见7型到5型LSA的转化是在ABR上实现的。
7型LSA由处于NSSA的ASBR发出