
实验拓扑如上图所示
各路由器配置接口IP地址,并均启用环回口,各路由器启用如图中的路由协议
更改R3、R4的接口优先级为0,使得R2成为DR
在R5上启用多个环回口,用于做路由汇总,配置如下:
Loopback0 5.5.5.5
Loopback1 172.5.1.1
Loopback2 172.5.2.1
Loopback3 172.5.3.1
在R9上启用多个环回口,用于做路由汇总,配置如下:
Loopback0 9.9.9.9
Loopback1 172.16.1.1
Loopback2 172.16.2.1
Loopback3 172.16.3.1
在R8上将EIGRP10的路由重发布到OSPF中,配置如下:
router ospf 10
log-adjacency-changes
redistribute eigrp 10 metric-type 1 subnets
在R8上使用ip default-network命令,给EIGRP10添加默认路由,配置如下:
interface Loopback1
ip
address 192.168.8.1 255.255.255.0
router eigrp 10
network 192.168.8.0 //将环回口所在的主类网段宣告进EIGRP中
network 192.168.89.0
no
auto-summary
ip default-network 192.168.8.0 指定环回口所在网段为默认路由
在R4上将RIP的路由重发布到OSPF中,配置如下:
router ospf 10
log-adjacency-changes
redistribute rip metric-type 1 subnets
在R4上向RIP域中宣告默认路由,配置如下:
router rip
version 2
network 192.168.47.0
default-information originate
no
auto-summary
查看R9的路由表如下:
Gateway of last resort is 192.168.89.8 to
network 192.168.8.0
C
192.168.89.0/24 is directly connected, Serial0/1
D*
192.168.8.0/24 [90/2297856] via 192.168.89.8, 01:04:43, Serial0/1
172.16.0.0/24 is subnetted, 3 subnets
C
172.16.1.0 is directly connected, Loopback1
C
172.16.2.0 is directly connected, Loopback2
C
172.16.3.0 is directly connected, Loopback3
9.0.0.0/24 is subnetted, 1 subnets
C
9.9.9.0 is directly connected, Loopback0
查看R7的路由表如下:
Gateway of last resort is 192.168.47.4 to
network 0.0.0.0
C
192.168.47.0/24 is directly connected, Serial0/0
7.0.0.0/24 is subnetted, 1 subnets
C
7.7.7.0 is directly connected, Loopback0
R*
0.0.0.0/0 [120/1] via 192.168.47.4, 00:00:22, Serial0/0
查看R2的LSDB如下:
R2#sh ip ospf da
OSPF Router with ID (2.2.2.2) (Process ID 10)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link
count
1.1.1.1 1.1.1.1 1109 0x80000006 0x00AFDD 3
2.2.2.2 2.2.2.2 1071 0x80000004 0x006D31 4
3.3.3.3 3.3.3.3 30 0x80000006 0x002AF4 2
4.4.4.4 4.4.4.4 520 0x80000007 0x0021EC 2
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
192.168.1.2 2.2.2.2 1071 0x80000004 0x007822
Summary Net Link States (Area
0)
Link ID ADV Router Age Seq# Checksum
5.5.5.5 1.1.1.1 1109 0x80000003 0x000DD4
6.6.6.6 4.4.4.4 1024 0x80000003 0x00844D
8.8.8.8 1.1.1.1 862 0x80000003 0x000590
172.5.1.0 1.1.1.1 60 0x80000001 0x00EB59
172.5.2.0 1.1.1.1 60 0x80000001 0x00E063
172.5.3.0 1.1.1.1 61 0x80000001 0x00D56D
192.168.15.0 1.1.1.1 1110 0x80000003 0x0092EB
192.168.46.0 4.4.4.4 1025 0x80000003 0x00E171
192.168.58.0 1.1.1.1 1110 0x80000003 0x003AD8
Summary ASB Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
8.8.8.8 1.1.1.1 863 0x80000003 0x00ECA8
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
7.7.7.0 4.4.4.4 520 0x80000003 0x00EA0F 0
9.9.9.0 8.8.8.8 881 0x80000003 0x002AB9 0
172.16.1.0 8.8.8.8 1885 0x80000002 0x00E061 0
172.16.2.0 8.8.8.8 1644 0x80000002 0x00D56B 0
172.16.3.0 8.8.8.8 1644 0x80000002 0x00CA75 0
192.168.8.0 8.8.8.8 881 0x80000003 0x006528 0
192.168.47.0 4.4.4.4 520 0x80000003 0x002F47 0
192.168.89.0 8.8.8.8 881 0x80000003 0x00E655 0
查看R2的路由表如下:
Gateway of last resort is not set
O E1 192.168.89.0/24 [110/212] via
192.168.12.1, 00:01:03, Serial0/0
O IA 192.168.46.0/24 [110/65] via
192.168.1.4, 00:29:57, FastEthernet1/0
C
192.168.12.0/24 is directly connected, Serial0/0
1.0.0.0/32 is subnetted, 1 subnets
O
1.1.1.1 [110/65] via 192.168.12.1, 00:29:57, Serial0/0
O E1 192.168.47.0/24 [110/21] via
192.168.1.4, 00:01:03, FastEthernet1/0
2.0.0.0/24 is subnetted, 1 subnets
C
2.2.2.0 is directly connected, Loopback0
3.0.0.0/32 is subnetted, 1 subnets
O
3.3.3.3 [110/2] via 192.168.1.3, 00:29:57, FastEthernet1/0
O IA 192.168.15.0/24 [110/128] via
192.168.12.1, 00:29:57, Serial0/0
O E1 192.168.8.0/24 [110/212] via
192.168.12.1, 00:01:03, Serial0/0
4.0.0.0/32 is subnetted, 1 subnets
O
4.4.4.4 [110/2] via 192.168.1.4, 00:29:58, FastEthernet1/0
O IA 192.168.58.0/24 [110/192] via
192.168.12.1, 00:29:58, Serial0/0
5.0.0.0/32 is subnetted, 1 subnets
O IA
5.5.5.5 [110/129] via 192.168.12.1, 00:29:58, Serial0/0
6.0.0.0/32 is subnetted, 1 subnets
O IA
6.6.6.6 [110/66] via 192.168.1.4, 00:29:58, FastEthernet1/0
172.5.0.0/24 is subnetted, 3 subnets
O IA
172.5.1.0 [110/129] via 192.168.12.1, 00:00:05, Serial0/0
O IA
172.5.3.0 [110/129] via 192.168.12.1, 00:00:05, Serial0/0
O IA
172.5.2.0 [110/129] via 192.168.12.1, 00:00:05, Serial0/0
172.16.0.0/24 is subnetted, 3 subnets
O E1
172.16.1.0 [110/212] via 192.168.12.1, 00:00:00, Serial0/0
O E1
172.16.2.0 [110/212] via 192.168.12.1, 00:00:00, Serial0/0
O E1
172.16.3.0 [110/212] via 192.168.12.1, 00:00:00, Serial0/0
7.0.0.0/24 is subnetted, 1 subnets
O E1
7.7.7.0 [110/21] via 192.168.1.4, 00:00:00, FastEthernet1/0
8.0.0.0/32 is subnetted, 1 subnets
O IA
8.8.8.8 [110/193] via 192.168.12.1, 00:29:58, Serial0/0
9.0.0.0/24 is subnetted, 1 subnets
O E1
9.9.9.0 [110/212] via 192.168.12.1, 00:00:00, Serial0/0
C
192.168.1.0/24 is directly connected, FastEthernet1/0
查看R5的路由表如下:
Gateway of last resort is not set
O E1 192.168.89.0/24 [110/84] via
192.168.58.8, 00:22:06, Serial0/0
O IA 192.168.46.0/24 [110/193] via
192.168.15.1, 00:49:13, Serial0/1
O IA 192.168.12.0/24 [110/128] via
192.168.15.1, 00:49:13, Serial0/1
1.0.0.0/32 is subnetted, 1 subnets
O IA
1.1.1.1 [110/65] via 192.168.15.1, 00:49:13, Serial0/1
O E1 192.168.47.0/24 [110/149] via
192.168.15.1, 00:22:06, Serial0/1
2.0.0.0/32 is subnetted, 1 subnets
O IA
2.2.2.2 [110/129] via 192.168.15.1, 00:49:13, Serial0/1
3.0.0.0/32 is subnetted, 1 subnets
O IA
3.3.3.3 [110/130] via 192.168.15.1, 00:22:11, Serial0/1
C
192.168.15.0/24 is directly connected, Serial0/1
O E1 192.168.8.0/24 [110/84] via
192.168.58.8, 00:22:06, Serial0/0
4.0.0.0/32 is subnetted, 1 subnets
O IA
4.4.4.4 [110/130] via 192.168.15.1, 00:49:14, Serial0/1
C
192.168.58.0/24 is directly connected, Serial0/0
5.0.0.0/24 is subnetted, 1 subnets
C
5.5.5.0 is directly connected, Loopback0
6.0.0.0/32 is subnetted, 1 subnets
O IA
6.6.6.6 [110/194] via 192.168.15.1, 00:49:14, Serial0/1
172.5.0.0/24 is subnetted, 3 subnets
C
172.5.1.0 is directly connected, Loopback1
C
172.5.3.0 is directly connected, Loopback3
C
172.5.2.0 is directly connected,
Loopback2
172.16.0.0/24 is subnetted, 3 subnets
O E1
172.16.1.0 [110/84] via 192.168.58.8, 00:22:06, Serial0/0
O E1
172.16.2.0 [110/84] via 192.168.58.8, 00:22:06, Serial0/0
O E1
172.16.3.0 [110/84] via 192.168.58.8, 00:22:06, Serial0/0
7.0.0.0/24 is subnetted, 1 subnets
O E1
7.7.7.0 [110/149] via 192.168.15.1, 00:22:06, Serial0/1
8.0.0.0/32 is subnetted, 1 subnets
O
8.8.8.8 [110/65] via 192.168.58.8, 00:49:14, Serial0/0
9.0.0.0/24 is subnetted, 1 subnets
O E1
9.9.9.0 [110/84] via 192.168.58.8, 00:22:06, Serial0/0
O IA 192.168.1.0/24 [110/129] via
192.168.15.1, 00:49:14, Serial0/1
发现各路由器的LSDB和路由表都比较庞大,进行优化
1、在ABR路由器R1上做区域间路由汇总,配置如下:
router ospf 10
log-adjacency-changes
area
2 range 172.5.0.0 255.255.252.0
2、在ASBR路由器R8上做外部路由汇总,配置如下:
router ospf 10
log-adjacency-changes
summary-address 172.16.0.0 255.255.252.0
3、将OSPF area2更改为 total NSSA区域,配置如下:
在R5、R8的ospf进程下,配置如下命令:
area 2 nssa
在R1的ospf进程下,配置如下命令:
area 2 nssa no-summary //加入参数no-summary,将禁止外部(5类)LSA和汇总(3类和4类)LSA进入区域,而用一条默认路由代替。将自动生成一条3类的默认路由,并将其通告到NSSA中,no-summary参数仅需在ABR路由器上配置即可。
4、将OSPF area1更改为total stub区域,配置如下:
在R4的OSPF进程下配置:area 1
stub no-summary
在R6的OSPF进程下配置:area 1
stub
再次查看R5的路由表,如下:
Gateway of last resort is 192.168.15.1 to
network 0.0.0.0
O N1 192.168.89.0/24 [110/85] via
192.168.58.8, 00:15:36, Serial0/0
C
192.168.15.0/24 is directly connected, Serial0/1
O N1 192.168.8.0/24 [110/85] via
192.168.58.8, 00:15:36, Serial0/0
C
192.168.58.0/24 is directly connected, Serial0/0
5.0.0.0/24 is subnetted, 1 subnets
C
5.5.5.0 is directly connected, Loopback0
172.5.0.0/24 is subnetted, 3 subnets
C
172.5.1.0 is directly connected, Loopback1
C
172.5.3.0 is directly connected, Loopback3
C
172.5.2.0 is directly connected, Loopback2
172.16.0.0/22 is subnetted, 1 subnets
O N1
172.16.0.0 [110/85] via 192.168.58.8, 00:15:36, Serial0/0
8.0.0.0/32 is subnetted, 1 subnets
O
8.8.8.8 [110/65] via 192.168.58.8, 00:15:37, Serial0/0
9.0.0.0/24 is subnetted, 1 subnets
O N1
9.9.9.0 [110/85] via 192.168.58.8, 00:15:37, Serial0/0
O*IA 0.0.0.0/0 [110/65] via 192.168.15.1,
00:15:37, Serial0/1 //由ABR路由器R1宣告进area2的默认路由
查看R5的LSDB表,如下:
R5#sh ip ospf da
OSPF Router with ID (5.5.5.5) (Process ID 10)
Router Link States (Area 2)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1.1 1.1.1.1 842 0x80000007 0x000186 2
5.5.5.5 5.5.5.5 1100 0x8000000D 0x00678A 8
8.8.8.8 8.8.8.8 1101 0x80000008 0x00516F 3
Summary Net Link States (Area
2)
Link ID ADV Router Age Seq# Checksum
0.0.0.0
1.1.1.1 1138 0x80000001 0x001B17
Type-7 AS External Link States
(Area 2)
Link ID ADV Router Age Seq# Checksum Tag
9.9.9.0 8.8.8.8 1108 0x80000001 0x002B90 0
172.16.0.0 8.8.8.8 1108 0x80000001 0x00DB41 0
192.168.8.0 8.8.8.8 1108 0x80000001 0x0066FE 0
192.168.89.0 8.8.8.8 1108 0x80000001 0x00E72C 0
仅剩1类、3类的默认路由和7类LSA
再次查看R2的路由表:
Gateway of last resort is not set
O E1 192.168.89.0/24 [110/213] via
192.168.12.1, 00:07:23, Serial0/0
O IA 192.168.46.0/24 [110/65] via
192.168.1.4, 00:20:14, FastEthernet1/0
C
192.168.12.0/24 is directly connected, Serial0/0
1.0.0.0/32 is subnetted, 1 subnets
O
1.1.1.1 [110/65] via 192.168.12.1, 00:20:14, Serial0/0
O E1 192.168.47.0/24 [110/21] via
192.168.1.4, 00:07:23, FastEthernet1/0
2.0.0.0/24 is subnetted, 1 subnets
C
2.2.2.0 is directly connected, Loopback0
3.0.0.0/32 is subnetted, 1 subnets
O
3.3.3.3 [110/2] via 192.168.1.3, 00:20:14, FastEthernet1/0
O IA 192.168.15.0/24 [110/128] via
192.168.12.1, 00:20:14, Serial0/0
O E1 192.168.8.0/24 [110/213] via
192.168.12.1, 00:07:24, Serial0/0
4.0.0.0/32 is subnetted, 1 subnets
O
4.4.4.4 [110/2] via 192.168.1.4, 00:20:14, FastEthernet1/0
O IA 192.168.58.0/24 [110/192] via
192.168.12.1, 00:19:50, Serial0/0
5.0.0.0/32 is subnetted, 1 subnets
O IA
5.5.5.5 [110/129] via 192.168.12.1, 00:19:50, Serial0/0
6.0.0.0/32 is subnetted, 1 subnets
O IA
6.6.6.6 [110/66] via 192.168.1.4, 00:07:29, FastEthernet1/0
172.5.0.0/22 is subnetted, 1 subnets
O IA
172.5.0.0 [110/129] via 192.168.12.1, 00:19:50, Serial0/0 //区域间路由汇总结果
172.16.0.0/22 is subnetted, 1 subnets
O E1
172.16.0.0 [110/213] via 192.168.12.1, 00:07:24, Serial0/0 //外部路由汇总的结果
7.0.0.0/24 is subnetted, 1 subnets
O E1
7.7.7.0 [110/21] via 192.168.1.4, 00:07:24, FastEthernet1/0
8.0.0.0/32 is subnetted, 1 subnets
O IA
8.8.8.8 [110/193] via 192.168.12.1, 00:19:30, Serial0/0
9.0.0.0/24 is subnetted, 1 subnets
O E1
9.9.9.0 [110/213] via 192.168.12.1, 00:07:24, Serial0/0
C
192.168.1.0/24 is directly connected, FastEthernet1/0
查看R6路由表,如下:
Gateway of last resort is 192.168.46.4 to
network 0.0.0.0
C
192.168.46.0/24 is directly connected, Serial0/0
6.0.0.0/24 is subnetted, 1 subnets
C
6.6.6.0 is directly connected, Loopback0
O*IA 0.0.0.0/0 [110/65] via 192.168.46.4,
00:09:31, Serial0/0
仅剩三条路由条目,大大减少R6的负担,节省资源
1、1类LSA:每台路由器都生成针对其所属区域的LSA,而非对其所有链路,查看R1发给R2的1类LSA,如下:
R2#sh ip ospf da router 1.1.1.1
OSPF Router with ID (2.2.2.2) (Process ID 10)
Router Link States (Area 0)
Routing Bit Set on this LSA
LS
age: 539
Options: (No TOS-capability, DC)
LS
Type: Router Links
Link State ID: 1.1.1.1
Advertising Router: 1.1.1.1
LS
Seq Number: 80000009
Checksum: 0xAFD8
Length: 60
Area Border Router
AS
Boundary Router
Number of Links: 3
Link connected to: a Stub Network
(Link ID) Network/subnet number: 1.1.1.1
(Link Data) Network Mask: 255.255.255.255
Number of TOS metrics: 0
TOS 0 Metrics: 1
Link connected to: another Router (point-to-point)
(Link ID) Neighboring Router ID: 2.2.2.2
(Link Data) Router Interface address: 192.168.12.1
Number of TOS metrics: 0
TOS 0 Metrics: 64
Link connected to: a Stub Network
(Link ID) Network/subnet number: 192.168.12.0
(Link Data) Network Mask: 255.255.255.0
Number of TOS metrics: 0
TOS 0 Metrics: 64
由上所示,并结合拓扑图,发现R1仅宣告了其与R2直连的网段和其环回口,因为环回口和R1--R2链路被宣告进了OSPF area0区域内。OSPF某区域内的路由器,仅需知道属于该区域的链路状态,无需知道ABR路由器上属于其他区域的链路状态。
Link Count:直接连接的链路总数,只用于1类LSA中,链路计数包括所有的点到点链路、中转链路和末节链路,除点到点串行链路导致计数增加2外(一条是到另一台路由器的点到点链路,另一条是将与邻居的那条链路认为是末节网络),其他所有串行链路(包括以太网链路)都导致链路计数增加1。
OSPF的5种网络类型:
1、点到点 2、广播型 3、非广播多路访问(NBMA) 4、点到多点 5、虚链路
以上5种网络类型,又可归纳到以下两种更普通的网络:
1、传送网络(transit network)——与两台或两台以上的路由器相连。
2、末梢网络(stub network)——仅仅和一条路由器相连,例如点到点,loopback接口也可以认为是末梢网络,并当做主机路由来通告。在接口下使用ip ospf network point-to-point,将可以使环回口的地址作为一个子网地址来通告,而非32位的主机地址。
实现区域间的路由过滤,方法是过滤3类LSA。
在R6上启用一个环回口,地址为192.168.6.1/24,使用ip ospf network point-to-point,将环回口地址做为网段宣告。该路由将会被整个网络中所有路由器学习到,除末节区域以外。若仅想让area1中的路由器学习到,则可在R4上做针对该网段的LSA过滤,配置如下:
ip
prefix-list 10 seq 1 deny 192.168.6.0/24
ip
prefix-list 10 seq 2 permit 0.0.0.0/0 le 32
router ospf 10
area
1 filter-list prefix 10 out
假设ospf area1区域未配置成末节区域,此时R4即是ABR又是ASBR,分析此时4类和5类LSA的产生和传递。
查看R6的LSDB表,下面仅选取部分:
Summary ASB Link States (Area
1)
Link ID ADV Router Age Seq# Checksum
1.1.1.1 4.4.4.4 210 0x80000001 0x006185
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
7.7.7.0 4.4.4.4 1159 0x80000006 0x00E412 0
发现R6收到的4类LSA仅仅是R4生成的针对R1所连接的area2区域内的ASBR链路,查看详细LSA如下:
R6#sh ip ospf da asbr-summary 1.1.1.1
OSPF Router with ID (6.6.6.6) (Process ID 10)
Summary ASB Link States (Area
1)
Routing Bit Set on this LSA
LS
age: 559
Options: (No TOS-capability, DC, Upward)
LS
Type: Summary Links(AS Boundary Router)
Link State ID: 1.1.1.1 (AS Boundary Router address)
Advertising Router: 4.4.4.4
LS
Seq Number: 80000001
Checksum: 0x6185
Length: 28
Network Mask: /0
TOS: 0 Metric: 65
查看R4的LSDB表,仅选取4类LSA,如下:
Summary ASB Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
1.1.1.1 4.4.4.4 955
0x80000001 0x006185
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
7.7.7.0 4.4.4.4 418 0x80000007 0x00E213 0
9.9.9.0 1.1.1.1 164
0x80000001 0x00924F 0
由上可知,R4仅针对area1生成了关于area2的4类LSA。首先先了解下4类LSA的相关知识。
4类LSA是由ABR生成,其作用是告诉其他路由器,如何到达ASBR的。并且最初生成4类LSA的ABR是和所宣告的ASBR是属于同一区域的。定义4类LSA的原因是因为ASBR使用5类LSA将外部路由宣告进OSPF域内,但其宣告路由器永远是ASBR。如果经过了NSSA区域,则宣告路由器将是实现7类LSA向5类LSA转换的ABR路由器ID。则既然R4即为OSPF与RIP的ASBR,则与其连接的区域将知道如何到达ASBR,则R4无需为area1生成4类LSA。只有当某区域和外部自治系统之间仍有区域时,该区域的路由器才需要4类LSA。例如图中的area0与EIGRP 10,则此时ABR路由器R1就需要生成一个4类LSA告知本区域内的路由器如何到达ASBR。
再查看5类LSA 9.9.9.0的详细信息,如下:
R4#sh ip ospf da external 9.9.9.0
OSPF Router with ID (4.4.4.4) (Process ID 10)
Type-5 AS External Link States
Routing Bit Set on this LSA
LS
age: 910
Options: (No TOS-capability, DC)
LS
Type: AS External Link
Link State ID: 9.9.9.0 (External Network Number )
Advertising Router: 1.1.1.1
LS
Seq Number: 80000001
Checksum: 0x924F
Length: 36
Network Mask: /24
Metric Type: 1 (Comparable directly to link state metric)
TOS: 0
Metric: 20
Forward Address: 8.8.8.8
External Route Tag: 0
发现有一个Forward Address: 8.8.8.8,说明虽然其宣告路由器ID是实现7类LSA向5类LSA转换的ABR路由器ID,但其依旧包含一个forward
address,这个才是最原始的ASBR。如果想更改forward address,可使用如下命令:
area id nssa translate type7 suppress-fa。
再次查看结果如下:
R4#sh ip ospf da external 9.9.9.0
OSPF Router with ID (4.4.4.4) (Process ID 10)
Type-5 AS External Link States
Routing Bit Set on this LSA
LS
age: 5
Options: (No TOS-capability, DC)
LS
Type: AS External Link
Link State ID: 9.9.9.0 (External Network Number )
Advertising Router: 1.1.1.1
LS
Seq Number: 80000002
Checksum: 0xFE02
Length: 36
Network Mask: /24
Metric Type: 1 (Comparable directly to link state metric)
TOS: 0
Metric: 20
Forward Address: 0.0.0.0
External Route Tag: 0
其forward address变为了0.0.0.0,即是转换7类到5类的ABR路由器。







发表评论 评论 (6 个评论)