session 1 OSPF的汇总
一、针对于LSA3、LSA5做汇总,因为其他LSA是不会传出区域的,做了没有意义还会增加一条汇总LSA反而会增加了LSA条目。所以针对LSA3、LSA5(包括LSA5转换成的LSA7)这种夸区域的LSA做汇总,在ABR与ASBR做汇总。
1、LSA3区域间路由汇总,在ABR上使用area 0 range 192.168.0.0 255.255.0.0命令,基于区域做的汇总。
在area0与area1的ABR路由器R1上做area0的路由汇总,宣告给area1中的R2
R1#show ip interface brief
Interface
IP-Address
OK? Method Status
Protocol
FastEthernet0/0
12.1.1.1
YES manual up
up
Loopback0
192.168.1.1
YES manual up
up
Loopback1
192.168.2.1
YES manual up
up
Loopback2
192.168.3.1
YES manual up
up
Loopback3
192.168.4.1
YES manual up
up
R1#show run | s ospf
router ospf 1
log-adjacency-changes
network 12.1.1.1 0.0.0.0 area1
network 192.168.1.1 0.0.0.0 area 0
network 192.168.2.1 0.0.0.0 area 0
network 192.168.3.1 0.0.0.0 area 0
network 192.168.4.1 0.0.0.0 area 0
area 0 range 192.168.0.0 255.255.0.0 汇总R1上area0的LSA3,汇总为192.168.0.0/16
R1#show ip ospf database
OSPF Router with ID (12.1.1.1) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
12.1.1.1 12.1.1.1 915 0x80000001 0x00131D 4
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
12.1.1.0 12.1.1.1 916 0x80000001 0x00B85D
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
12.1.1.1 12.1.1.1 915 0x80000003 0x007376 1
12.1.1.2 12.1.1.2 1005 0x80000002 0x007078 1
Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
12.1.1.2 12.1.1.2 1005 0x80000001 0x007585
Summary Net Link States (Area 1) 看到这条汇总后的LSA3路由
Link ID ADV Router Age Seq# Checksum
192.168.0.0 12.1.1.1 834 0x80000001 0x006063
R2#show ip ospf database summary 在R2上查看R1发来的LSA3汇总路由
OSPF Router with ID (12.1.1.2) (Process ID 1)
Summary Net Link States (Area 1)
Routing Bit Set on this LSA
LS age: 914
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 192.168.0.0 (summary Network Number)
Advertising Router: 12.1.1.1
LS Seq Number: 80000001
Checksum: 0x6063
Length: 28
Network Mask: /16
TOS: 0 Metric: 1
R2#show ip route ospf
O IA 192.168.0.0/16 [110/11] via 12.1.1.1, 00:16:13, FastEthernet0/0 R2上只有汇总路由了
2、LSA3过滤
LSA3过滤命令和汇总命令一样,只是多了一个参数:not-advertise
R1(config)#router ospf 1
R1(config-router)#area 0 range 192.168.0.0 255.255.0.0 not-advertise
过滤掉所area0区域所有匹配了192.168.0.0/16网络的LSA3类路由信息
R2#show ip route ospf
经过R1过滤掉LSA3后,R2已经收不到R1发来的LSA3了
空的,没有到R1换回接口的路由了
R2#show ip ospf database summary
OSPF Router with ID (12.1.1.2) (Process ID 1)
空的,R2上没有任何LSA3消息(从R1收到的)
R2#
二、LSA5区域外部路由汇总
LSA5区域外部路由,在ASBR上使用summary-address 172.16.0.0 255.255.0.0 命令来汇总
LSA7区域外部路由,在NSSA区域的ASBR上使用summary-address 172.16.0.0 255.255.0.0 命令来汇总
非NSSA区域的ABR是将NSSA区域的ASBR发来的外部路由LSA7转换为LSA5宣告进本区域,但是不能做LSA5、SAL7的汇总(因为无效,只能在ASBR上做LSA5、7的汇总)
拓扑使用上面的图,将R1的环回接口看做ospf的外部路由,而R1与R2连接接口为ospf的area0:
1、普通area区域,在R1这台ASBR上做外部LSA5的路由汇总:
R1#show ip interface brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 12.1.1.1 YES manual up up
Loopback0 172.16.1.1 YES manual up up
Loopback1 172.16.2.1 YES manual up up
Loopback2 172.16.3.1 YES manual up up
R1#show run | s ospf
router ospf 1
log-adjacency-changes
summary-address 172.16.0.0 255.255.0.0 LSA5的汇总命令
redistribute connected subnets 重分布直连的loopback接口模拟外部路由LSA5
network 12.1.1.1 0.0.0.0 area 0
在R2上查看R1发来的LSA5的汇总路由
R2#show ip route ospf
O E2 172.16.0.0/16 [110/20] via 12.1.1.1, 00:00:04, FastEthernet0/0 查看路由表中LSA5的汇总路由
R2#show ip ospf database external 查看ospf的LSA数据库的LSA5类路由
OSPF Router with ID (2.2.2.2) (Process ID 1)
Type-5 AS External Link States
Routing Bit Set on this LSA
LS age: 377
Options: (No TOS-capability, DC)
LS Type: AS External Link
Link State ID: 172.16.0.0 (External Network Number ) 只有一个汇总的
Advertising Router: 172.16.3.1
LS Seq Number: 80000001
Checksum: 0xB46E
Length: 36
Network Mask: /16 掩码是16为bit的
Metric Type: 2 (Larger than any link state path)
TOS: 0
Metric: 20
Forward Address: 0.0.0.0
External Route Tag: 0
2、NSSA区域的LSA7外部路由汇总,在NSSA区域的ASBR上或者非NSSA区域的ABR上(LSA7转5)做汇总
R1#show run | s ospf
router ospf 1
log-adjacency-changes
area 1 nssa
summary-address 172.16.0.0 255.255.0.0
汇总LSA7
redistribute connected subnets
network 12.1.1.1 0.0.0.0 area 1
area0不能是NSSA区域,所以把R1与R2连接的接口都划到了area1中
查看R2上的LSA路由信息
R2#show ip route ospf
O N2 172.16.0.0/16 [110/20] via 12.1.1.1, 00:01:59, FastEthernet0/0
R2#show ip ospf database nssa-external 查看LSA7信息,只有一条汇总LSA7信息
OSPF Router with ID (2.2.2.2) (Process ID 1)
Type-7 AS External Link States (Area 1)
Routing Bit Set on this LSA
LS age: 239
Options: (No TOS-capability, Type 7/5 translation, DC)
LS Type: AS External Link
Link State ID: 172.16.0.0 (External Network Number ) 汇总的LSA7信息
Advertising Router: 172.16.3.1
LS Seq Number: 80000001
Checksum: 0xCB3E
Length: 36
Network Mask: /16 掩码16bit位的
Metric Type: 2 (Larger than any link state path)
TOS: 0
Metric: 20
Forward Address: 12.1.1.1
External Route Tag: 0
3、LSA7过滤
LSA3过滤命令和汇总命令一样,只是多了一个参数:not-advertise
R1(config)#router ospf 1
R1(config-router)#summary-address 172.16.0.0 255.255.0.0 not-advertise
过滤掉所area0区域所有匹配了192.168.0.0/16网络的LSA3类路由信息
R2#show ip route ospf R1设置了过滤掉LSA7后,R2已经收不到R1发来的LSA7了
空的
R2#show ip ospf database nssa-external
OSPF Router with ID (2.2.2.2) (Process ID 1)
空的
R2#
LSA7转LSA5的过滤:
R1(config)#router ospf 1
R1(config-router)#summary-address 172.16.0.0 255.255.0.0 nssa-only
配置了nssa-only参数后,LSA7将不允许被非NSSA区域的ABR转换成LSA5宣告到非NSSA区域中去,也就是这条外部路由只能以LSA7的形式存在于NSSA区域内,不允许被非NSSA区域的路由器(以LSA5的形式)学习到。nssa-only:仅仅nssa,字面意思就是只能存在于nssa区域内。(通过将LSA7中的type7这个bit置为为no来实现的,抓包可能看到的这个bit位是0)
在非NSSA区域的ABR上show ip ospf database nssa-external可以看到LSA7的信息,但是无法(转换成LSA5)宣告出去。(模拟器版本低没有nssa-only参数,高版本的有,不演示了)
session 2 OSPF汇总的总结
ABR上:LSA3、LSA5(由LSA7转换来的)
ASBR:LSA5、LSA7