OSPF五类LSA之FA实验案例解析
一、概述
我们都知道,OSPF中通过五类的LSA来进行传递外部路由信息,在五类LSA中又使用FA参数来传递下一跳属性,如果FA为0则寻找ASBR,通过ASBR来访问目的网络。如果FA为非0则寻找该FA的参数值也就是FA的地址,通过FA的地址来访问目的网络。
在一些特殊的场景当中,如果对该参数的理解不够透彻,会形成环路风险,和计算不出目的路由等情况,本章节将通过实验的方式带大家进一步了解FA该参数的理解加深印象。
本实验还会涉及到一些BGP路由黑洞等问题,大家在学习的同时也可以作为BGP路由知识的回顾复习。
二、实验
1、实验一
拓扑
1、基础配置
AR1
system
sysname AR1
int g 0/0/0
ip add 10.0.12.1 24
int g 0/0/2
ip add 10.0.14.1 24AR2
system
sysname AR2
int g 0/0/0
ip add 10.0.12.2 24
int g 0/0/1
ip add 10.0.24.2 24
int g 0/0/2
ip add 10.0.23.2 24AR3
system
sysname AR3
int g 0/0/2
ip add 10.0.23.3 24
int l 0
ip add 3.3.3.3 32AR4
system
sysname AR4
int g 0/0/1
ip add 10.0.24.4 24
int g 0/0/2
ip add 10.0.14.4 24
2、路由配置
AR1
ospf 1 router-id 1.1.1.1
area 0
netw 10.0.12.1 0.0.0.0
netw 10.0.14.1 0.0.0.0AR2
ospf 1 router-id 2.2.2.2
area 0
netw 10.0.12.2 0.0.0.0
area 1
nssa
netw 10.0.23.2 0.0.0.0
netw 10.0.24.2 0.0.0.0AR3
ospf 1 router-id 3.3.3.3
import-route direct type 1
area 1
nssa
netw 10.0.23.3 0.0.0.0AR4
ospf 1 router-id 4.4.4.4
area 0
netw 10.0.14.4 0.0.0.0
area 1
nssa
netw 10.0.24.4 0.0.0.0
查看OSPF邻居状态
[AR2]display ospf peer briefOSPF Process 1 with Router ID 2.2.2.2Peer Statistic Information----------------------------------------------------------------------------Area Id Interface Neighbor id State 0.0.0.0 GigabitEthernet0/0/0 1.1.1.1 Full 0.0.0.1 GigabitEthernet0/0/1 4.4.4.4 Full 0.0.0.1 GigabitEthernet0/0/2 3.3.3.3 Full ----------------------------------------------------------------------------
查看LSDB
可以看到AR2现在收到了两条关于3.3.3.3的LSA信息
一条为AR3引入时的7类LSA
一条为AR4往区域0进行7转5的5类LSA
假设AR2优选了AR4发送过来的5类LSA那么访问路径就会变成这样
此时就形成了环路
但现在并没有形成环路,这是为什么?我们可以去AR2上看看详细的路由信息
可以看到不管是AR3还是AR4发布的7类或5类LSA,里面的FA参数都为10.0.23.3,所以AR2不管采用了哪条LSA来访问目的网络,都是走与AR3直连的链路,假如没有FA参数则就会形成环路,我们可以做个小操作看看效果。
AR4
ospf 1
area 1
nssa suppress-forwarding-addressAR2
int g 0/0/2
ospf cost 10
此时我们将AR2与AR3之间的链路COST改大一点,并让AR4在进行7转5时,将FA参数去掉。
如果FA参数并未更改,我们将AR2与AR3之间的链路COST改大一点也没用,因为有FA参数AR2还是会直接去找10.0.23.3
查看路由表
[AR2]display ip routing-table 3.3.3.3
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Table : Public
Summary Count : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface3.3.3.3/32 O_ASE 150 3 D 10.0.12.1 GigabitEthernet
0/0/0
<AR1>display ip routing-table 3.3.3.3
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Table : Public
Summary Count : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface3.3.3.3/32 O_ASE 150 2 D 10.0.14.4 GigabitEthernet
0/0/2
<AR4>display ip routing-table 3.3.3.3
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Table : Public
Summary Count : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface3.3.3.3/32 O_NSSA 150 10002 D 10.0.24.2 GigabitEthernet
0/0/1
使用路由跟踪查看路径
[AR2]tracert 3.3.3.3traceroute to 3.3.3.3(3.3.3.3), max hops: 30 ,packet length: 40,press CTRL_C t
o break 1 10.0.12.1 30 ms 10 ms 20 ms 2 10.0.14.4 30 ms 20 ms 20 ms 3 10.0.24.2 20 ms 20 ms 20 ms 4 10.0.12.1 30 ms 30 ms 30 ms 5 10.0.14.4 30 ms 50 ms 30 ms 6 10.0.24.2 30 ms 30 ms 30 ms 7 10.0.12.1 40 ms 40 ms 40 ms 8 10.0.14.4 50 ms 50 ms 50 ms 9 10.0.24.2 40 ms 40 ms 60 ms 10 10.0.12.1 50 ms 40 ms 50 ms 11 10.0.14.4 70 ms 50 ms 60 ms 12
可以看到直接就形成环路了,所以FA参数有防止环路的风险,在7类LSA中还能通过此参数解决次优路径的问题。
2、实验二
拓扑
1、基础配置
AR1
system
sysname AR1
int g 0/0/0
ip add 10.0.12.1 24
int l 0
ip add 1.1.1.1 32AR2
system
sysname AR2
int g 0/0/0
ip add 10.0.12.2 24
int g 0/0/1
ip add 10.0.23.2 24
int l 0
ip add 2.2.2.2 32AR3
system
sysname AR3
int g 0/0/1
ip add 10.0.23.3 24
int g 0/0/0
ip add 10.0.34.3 24AR4
system
sysname AR4
int g 0/0/0
ip add 10.0.34.4 24
int l 0
ip add 4.4.4.4 32
2、IGP路由配置
AR2
ospf 1 router-id 2.2.2.2
area 0
netw 10.0.23.2 0.0.0.0
netw 2.2.2.2 0.0.0.0AR3
ospf 1 router-id 3.3.3.3
area 0
netw 10.0.23.3 0.0.0.0
netw 10.0.34.3 0.0.0.0AR4
ospf 1 router-id 4.4.4.4
area 0
netw 10.0.34.4 0.0.0.0
netw 4.4.4.4 0.0.0.0
3、EGP路由配置
AR1
bgp 65001
router-id 1.1.1.1
peer 10.0.12.2 as-number 65002
peer 10.0.12.2 ebgp-max-hop
network 1.1.1.1 32AR2
bgp 65002
router-id 2.2.2.2
peer 10.0.12.1 as-number 65001
peer 10.0.12.1 ebgp-max-hop
peer 4.4.4.4 as-number 65002
peer 4.4.4.4 next-hop-local
peer 4.4.4.4 connect-interface LoopBack0AR4
bgp 65002
router-id 4.4.4.4
peer 2.2.2.2 as-number 65002
peer 2.2.2.2 connect-interface LoopBack0
查看OSPF邻居状态
[AR3]display ospf peer brief OSPF Process 1 with Router ID 3.3.3.3Peer Statistic Information----------------------------------------------------------------------------Area Id Interface Neighbor id State 0.0.0.0 GigabitEthernet0/0/0 4.4.4.4 Full 0.0.0.0 GigabitEthernet0/0/1 2.2.2.2 Full ----------------------------------------------------------------------------
查看BGP邻居状态
[AR2]display bgp peerBGP local router ID : 2.2.2.2Local AS number : 65002Total number of peers : 2 Peers in established state : 2Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv4.4.4.4 4 65002 17 18 0 00:15:17 Established 010.0.12.1 4 65001 8 26 0 00:05:23 Established
查看路由信息
[AR2]dis bgp routing-table BGP Local router ID is 2.2.2.2 Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 1Network NextHop MED LocPrf PrefVal Path/Ogn*> 1.1.1.1/32 10.0.12.1 0 0 65001i
AR2已经通过EBGP学习到了1.1.1.1/32的路由信息,由于BGP的路由通告原则,从EBGP学习到的路由会发送给所有对等体,因此AR4也会通过BGP学习到这条路由。
[AR4]display bgp routing-table BGP Local router ID is 4.4.4.4 Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 1Network NextHop MED LocPrf PrefVal Path/Ogn*>i 1.1.1.1/32 2.2.2.2 0 100 0 65001i
此时我们在让AR4将这条路由已五类的形式引入到IGP当中
[AR4-ospf-1]import-route bgp permit-ibgp
Info: This configuration may result in loops. Please do not perform this configu
ration if not necessary.
在引入时会提示我们这样可能会形成环路风险,但还是可以成功配置。
此时我们在去AR3上查看路由信息
[AR3]display ip routing-table 1.1.1.1 32
[AR3]
发现AR3并没有学习到这条路由,这是为什么?
我们再去查看AR3的LSDB表项
[AR3]display ospf lsdb OSPF Process 1 with Router ID 3.3.3.3Link State Database Area: 0.0.0.0Type LinkState ID AdvRouter Age Len Sequence MetricRouter 4.4.4.4 4.4.4.4 106 48 80000005 0Router 2.2.2.2 2.2.2.2 1344 48 80000006 1Router 3.3.3.3 3.3.3.3 1603 48 80000009 1Network 10.0.23.2 2.2.2.2 1652 32 80000002 0Network 10.0.34.3 3.3.3.3 1603 32 80000002 0AS External DatabaseType LinkState ID AdvRouter Age Len Sequence MetricExternal 1.1.1.1 4.4.4.4 106 36 80000001 1
可以看到AR3是学习到了1.1.1.1的五类LSA的,那为什么计算不出路由呢?
我们查看一下详细的LSA信息
[AR3]display ospf lsdb aseOSPF Process 1 with Router ID 3.3.3.3Link State DatabaseType : ExternalLs id : 1.1.1.1(目的网络)Adv rtr : 4.4.4.4 (始发者的Router-id)Ls age : 151 Len : 36 Options : E seq# : 80000001 chksum : 0xace0Net mask : 255.255.255.255 (掩码信息)TOS 0 Metric: 1 E type : 2Forwarding Address : 10.0.34.3 (FA参数)Tag : 1 Priority : Medium
我们可以看到这条LSA的FA地址有点奇怪,FA地址为AR3的接口IP地址。
我们知道FA如果为非0的情况下,则直接去找该FA地址作为路由的下一跳。
但此时FA地址为AR3的接口IP地址,所以AR3计算不出该路由的信息,无法计算拓扑。
那为什么会这样呢?
因为AR4在通过BGP路由协议学习到这条路由时,下一跳为2.2.2.2,通过路由迭代发现下一跳为10.0.34.3所以在引入OSPF时的FA地址就为10.0.34.3
[AR4]display fib
Route Flags: G - Gateway Route, H - Host Route, U - Up RouteS - Static Route, D - Dynamic Route, B - Black Hole RouteL - Vlink Route
--------------------------------------------------------------------------------FIB Table:Total number of Routes : 11 Destination/Mask Nexthop Flag TimeStamp Interface TunnelID
1.1.1.1/32 10.0.34.3 DGHU t[3194] GE0/0/0 0x0
2.2.2.2/32 10.0.34.3 DGHU t[2452] GE0/0/0 0x0
10.0.34.255/32 127.0.0.1 HU t[2182] InLoop0 0x0
10.0.34.4/32 127.0.0.1 HU t[2182] InLoop0 0x0
4.4.4.4/32 127.0.0.1 HU t[2035] InLoop0 0x0
255.255.255.255/32 127.0.0.1 HU t[2] InLoop0 0x0
127.255.255.255/32 127.0.0.1 HU t[2] InLoop0 0x0
127.0.0.1/32 127.0.0.1 HU t[2] InLoop0 0x0
127.0.0.0/8 127.0.0.1 U t[2] InLoop0 0x0
10.0.34.0/24 10.0.34.4 U t[2182] GE0/0/0 0x0
10.0.23.0/24 10.0.34.3 DGU t[2187] GE0/0/0 0x0
我们查看AR4的BGP路由时发现路由是最优且有效的,那AR4到底能不能访问到1.1.1.1/32网络呢?
我们使用路由跟踪1.1.1.1/32看看
[AR4]tracert 1.1.1.1traceroute to 1.1.1.1(1.1.1.1), max hops: 30 ,packet length: 40,press CTRL_C t
o break 1 * * * 2 * * * 3 * * * 4 * * * 5 * * * 6 * *
发现AR4根本到达不了1.1.1.1/32但是路由却是最优且有效的,这是因为AR4通过计算自身的路由发现路由可达,但是中间设备并未使能BGP协议,就形成了"路由黑洞",导致路由明明有效且无法访问的问题。
如果想要AR3计算出1.1.1.1/32的路由信息,则需要改变FA参数。
我们将AR3与AR4之间的OSPF接口类型更改为P2P类型。
AR3
int g 0/0/0
ospf network-type p2pAR4
int g 0/0/0
ospf network-type p2p
查看AR3的LSDB
[AR3]display ospf lsdb OSPF Process 1 with Router ID 3.3.3.3Link State Database Area: 0.0.0.0Type LinkState ID AdvRouter Age Len Sequence MetricRouter 4.4.4.4 4.4.4.4 30 60 8000000B 0Router 2.2.2.2 2.2.2.2 381 48 80000007 1Router 3.3.3.3 3.3.3.3 31 60 8000000F 1Network 10.0.23.2 2.2.2.2 689 32 80000003 0AS External DatabaseType LinkState ID AdvRouter Age Len Sequence MetricExternal 1.1.1.1 4.4.4.4 31 36 80000001 1
[AR3]display ospf lsdb aseOSPF Process 1 with Router ID 3.3.3.3Link State DatabaseType : ExternalLs id : 1.1.1.1Adv rtr : 4.4.4.4 Ls age : 40 Len : 36 Options : E seq# : 80000001 chksum : 0x5864Net mask : 255.255.255.255 TOS 0 Metric: 1 E type : 2Forwarding Address : 0.0.0.0 Tag : 1 Priority : Medium
可以看到此时FA参数为全0了,那么AR3在访问该网络时则会去寻找ASBR作为下一跳。
[AR3]display ip routing-table 1.1.1.1
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Table : Public
Summary Count : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface1.1.1.1/32 O_ASE 150 1 D 10.0.34.4 GigabitEthernet
0/0/0
那么此时AR4的路由为最优的路由,AR3同样也计算出了该路由放入的路由表当中,那么此时AR4能访问到1.1.1.1/32网络吗?
[AR4]tracert 1.1.1.1traceroute to 1.1.1.1(1.1.1.1), max hops: 30 ,packet length: 40,press CTRL_C t
o break 1 10.0.34.3 30 ms 20 ms 10 ms 2 10.0.34.4 20 ms 10 ms 10 ms 3 10.0.34.3 20 ms 20 ms 20 ms 4 10.0.34.4 20 ms 20 ms 20 ms 5 10.0.34.3 20 ms 20 ms 30 ms 6 10.0.34.4 30 ms 30 ms 40 ms 7 10.0.34.3 40 ms 40 ms 40 ms 8 10.0.34.4 30 ms 40 ms 30 ms 9 10.0.34.3 60 ms 60 ms 60 ms 10 10.0.34.4 60 ms 40 ms 50 ms 11 10.0.34.3 50 ms
可以看到AR4在访问该网络时立马就环路了,这是为什么?
前面我们说了AR4在进行路由迭代的时候,会将下一跳迭代到AR3的接口上,AR3计算出该拓扑后,发现AR4为ASBR,则AR3就认为该路由在AR4上,当有目的IP为该地址的数据包到达AR3后,AR3就会转发给AR4,此时就形成了环路。
如果想要解决以上问题,有三个解决办法
1、在AR3上也使能BGP,让AR3也通过BGP协议学习到该路由的信息
2、使AR3学习到的五类LSA的FA参数为AR2的接口IP信息(需要由AR2来引入该路由)
3、在AR3上手工配置该目的网络的静态路由
以上就是本章的全部内容了,感谢大家的浏览观看!如果本章节对你的学习理解有帮助可以点个赞评论一下,文章若有错误或疑问可联系博主删除更改,非常欢迎大家私聊博主讨论。