实验环境MPLS ××× option B,下图地址配置说明:
Rx,x表示路由器编号,环回口会x.x.x.x/32
Rx与Ry互联,互联地址为 Rx:xy.1.1.x/24,Ry:xy.1.1.y/24
当PE与CE之间使用OSPF协议,CE上学习到远端CE的路由有时表现为OE,有时表现为OIA。
说明:为方便查看,R3上未进行BGP到OSPF的重分发。
如上图,R1与R2 R3之间运行了OSPF,当在R2上进行BGP到OSPF的重分发后,R1能学习到远端CE(R9)的路由,
当两端PE,即R8,R2的OSPF domain-id不相同时,R1上关于R9的路由表现为域外路由,即OE;
R2(config-router)#do show run | be routerospf
router ospf 8 vrf vpn2
domain-id 0.0.0.2
log-adjacency-changes
redistribute bgp 2345 subnets
network 12.1.1.2 0.0.0.0 area 2
R8(config-router)#do show run | be routerospf
router ospf 8 vrf vpn8
log-adjacency-changes
redistribute bgp 78 subnets
network 89.1.1.8 0.0.0.0 area 8
R1#show ip route
Codes: C - connected, S - static, R - RIP,M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
9.0.0.0/32 is subnetted, 1 subnets
O E2 9.9.9.9 [110/1] via 12.1.1.2, 00:17:18, FastEthernet0/0
89.0.0.0/24 is subnetted, 1 subnets
O E2 89.1.1.0 [110/1] via 12.1.1.2, 00:17:18, FastEthernet0/0
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, FastEthernet0/0
13.0.0.0/24 is subnetted, 1 subnets
C 13.1.1.0 is directly connected, FastEthernet0/1
当两端PE,即R8,R2的OSPF domain-id相同时,R1上关于R9的路由表现为域间路由,即OIA。
R8(config-router)#do show run | be routerospf
router ospf 8 vrf vpn8
domain-id 0.0.0.2
log-adjacency-changes
redistribute bgp 78 subnets
network 89.1.1.8 0.0.0.0 area 8
R2(config-router)#do show run | be routerospf
router ospf 8 vrf vpn2
domain-id0.0.0.2
log-adjacency-changes
redistribute bgp 2345 subnets
network 12.1.1.2 0.0.0.0 area 2
R1#show ip route
Codes: C - connected, S - static, R - RIP,M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
9.0.0.0/32 is subnetted, 1 subnets
O IA 9.9.9.9 [110/11] via 12.1.1.2,00:00:12, FastEthernet0/0
89.0.0.0/24 is subnetted, 1 subnets
O IA 89.1.1.0 [110/11] via 12.1.1.2, 00:00:12, FastEthernet0/0
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, FastEthernet0/0
13.0.0.0/24 is subnetted, 1 subnets
C 13.1.1.0 is directly connected, FastEthernet0/1
默认情况下domain-id与当前OSPF进程号保持一致。
R8(config-router)#domain-id0.0.0.8
R8(config-router)#do show run | be routerospf
router ospf 8 vrf vpn8
log-adjacency-changes
redistribute bgp 78 subnets
network 89.1.1.8 0.0.0.0 area 8
配置了domain-id 0.0.0.8 ,但查看配置的时候却没有显示,
再看:
R8(config-router)#domain-id0.0.0.7
R8(config-router)#
R8(config-router)#do show run | be routerospf
router ospf 8 vrf vpn8
domain-id 0.0.0.7
log-adjacency-changes
redistribute bgp 78 subnets
network 89.1.1.8 0.0.0.0 area 8
这下就有了。
双PE情况下,存在路由环路问题,在MPLS ×××中的处理机制说明。
依旧如上图:
当R2完成BGP到OSPF的重分发后,R1上就能学习到远端CE的路由,并将LSA传递到R3,如果R3也像R2一样也做了BGP到OSPF的重分发,这时就会有路由环路产生。
但实际上R3却未将这些LSA加载进路由表。
分两种情况说明:
1、当两端PE的domain-id相同时,PE重分发后产生的LSA为3类LSA,并且DN位被置位。在该实验环境中, R2 R8的domain-id相同时,他们重分发产生的3类LSA,DN位会被置位。当其他PE,即R3收到该LSA时,由于DN被置位,因此不会将LSA信息加载到路由表。但LSDB中仍有这些LSA。
R3的LSDB:
R3#show ip ospf database
OSPF Router withID (13.1.1.3) (Process ID 2)
Router LinkStates (Area 2)
Link ID ADVRouter Age Seq# Checksum Link count
1.1.1.1 1.1.1.1 1224 0x8000000A 0x00A309 3
12.1.1.2 12.1.1.2 212 0x80000003 0x006D78 1
13.1.1.3 13.1.1.3 1173 0x80000006 0x005B82 1
Net LinkStates (Area 2)
Link ID ADVRouter Age Seq# Checksum
12.1.1.1 1.1.1.1 1977 0x80000003 0x009B75
13.1.1.1 1.1.1.1 1224 0x80000004 0x00A567
Summary NetLink States (Area 2)
Link ID ADVRouter Age Seq# Checksum
9.9.9.9 12.1.1.2 948 0x80000001 0x00E4A2
89.1.1.0 12.1.1.2 948 0x80000001 0x00E36C
抓包(R1连接R3的链路抓包)信息:
R3的路由信息:
R3#show ip route vrf vpn3
Routing Table: vpn3
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRPexternal, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA externaltype 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type1, E2 - OSPF external type 2
i - IS-IS, su - IS-ISsummary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area,* - candidate default, U - per-user static route
o - ODR, P - periodicdownloaded static route
Gateway of last resort is not set
1.0.0.0/32 is subnetted,1 subnets
O 1.1.1.1 [110/11] via13.1.1.1, 00:39:08, FastEthernet0/1
9.0.0.0/32 is subnetted, 1 subnets
B 9.9.9.9 [200/0] via 5.5.5.5, 00:17:52
89.0.0.0/24 is subnetted, 1 subnets
B 89.1.1.0 [200/0] via 5.5.5.5, 00:17:52
12.0.0.0/24 is subnetted,1 subnets
O 12.1.1.0 [110/20] via13.1.1.1, 00:39:08, FastEthernet0/1
13.0.0.0/24 is subnetted,1 subnets
C 13.1.1.0 is directlyconnected, FastEthernet0/1
如果想让这些LSA被加载到路由表,则在R3的OSPF进程中执行:
R3(config-router)#capability vrf-lite
*Mar 1 02:12:00.031:%OSPF-5-ADJCHG: Process 2, Nbr 1.1.1.1 on FastEthernet0/1 from FULL to DOWN,Neighbor Down: Interface down or detached
*Mar 1 02:12:02.203:%OSPF-5-ADJCHG: Process 2, Nbr 1.1.1.1 on FastEthernet0/1 from LOADING to FULL,Loading Done
执行完后,另据关系会先down掉,重新建立。
再看R3的路由表信息:
R3(config-router)#do show ip route vrf vpn3
Routing Table: vpn3
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRPexternal, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA externaltype 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type1, E2 - OSPF external type 2
i - IS-IS, su - IS-ISsummary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area,* - candidate default, U - per-user static route
o - ODR, P - periodicdownloaded static route
Gateway of last resort is not set
1.0.0.0/32 is subnetted,1 subnets
O 1.1.1.1 [110/11] via13.1.1.1, 00:00:03, FastEthernet0/1
9.0.0.0/32 is subnetted,1 subnets
O IA 9.9.9.9 [110/21] via 13.1.1.1, 00:00:03, FastEthernet0/1
89.0.0.0/24 is subnetted, 1 subnets
O IA 89.1.1.0 [110/21] via 13.1.1.1, 00:00:03, FastEthernet0/1
12.0.0.0/24 is subnetted,1 subnets
O 12.1.1.0 [110/20] via13.1.1.1, 00:00:03, FastEthernet0/1
13.0.0.0/24 is subnetted,1 subnets
C 13.1.1.0 is directlyconnected, FastEthernet0/1
再看另外一种情况:
当两端PE,即R2 R8的domain-id不相同时,之前已说过,CE上学习的路由表现为OE,则说明接收到的LSA为5类LSA。5类LSA的防环与3类LSA不同,5类LSA使用的是domain-tag,当R2重分发BGP到OSPF时,默认会带一个tag(该tag怎么计算的,目前还不清楚),也可手动设置。该tag会随着LSA传递,当R3收到后会与自身的tag进行比对,当tag一致时,则不会将LSA信息加载进路由表;不一致时,会加载。
R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRPexternal, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA externaltype 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPFexternal type 2
i - IS-IS, su - IS-ISsummary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area,* - candidate default, U - per-user static route
o - ODR, P - periodicdownloaded static route
Gateway of last resort is not set
1.0.0.0/24 is subnetted,1 subnets
C 1.1.1.0 is directlyconnected, Loopback0
9.0.0.0/32 is subnetted, 1 subnets
O E2 9.9.9.9 [110/1] via 12.1.1.2, 00:00:38, FastEthernet0/0
89.0.0.0/24 is subnetted, 1 subnets
O E2 89.1.1.0 [110/1] via 12.1.1.2, 00:00:38, FastEthernet0/0
12.0.0.0/24 is subnetted,1 subnets
C 12.1.1.0 is directlyconnected, FastEthernet0/0
13.0.0.0/24 is subnetted,1 subnets
C 13.1.1.0 is directlyconnected, FastEthernet0/1
路由详细信息:
R1#show ip route 9.9.9.9
Routing entry for 9.9.9.9/32
Known via "ospf1", distance 110, metric 1
Tag Complete, Path Length ==1, AS 2345, , type extern 2, forward metric 10
Last update from 12.1.1.2 on FastEthernet0/0,00:01:06 ago
Routing Descriptor Blocks:
* 12.1.1.2, from 12.1.1.2,00:01:06 ago, via FastEthernet0/0
Route metric is 1,traffic share count is 1
Routetag 3489663273
查看LSA的详细信息:
R1#show ip ospf database external 9.9.9.9
OSPF Router withID (1.1.1.1) (Process ID 1)
Type-5 ASExternal Link States
Routing Bit Set on this LSA
LS age: 278
Options: (No TOS-capability,DC)
LS Type: AS External Link
Link State ID: 9.9.9.9(External Network Number )
Advertising Router: 12.1.1.2
LS Seq Number: 80000001
Checksum: 0xBCBF
Length: 36
Network Mask: /32
Metric Type: 2 (Largerthan any link state path)
TOS: 0
Metric: 1
Forward Address: 0.0.0.0
External Route Tag: 3489663273
此时R3仍然能收到R1传递过来的LSA信息,但不会加载到路由表。
R3#show ip ospf database
OSPF Router withID (13.1.1.3) (Process ID 2)
Router LinkStates (Area 2)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1.1 1.1.1.1 201 0x8000000F 0x00990E 3
12.1.1.2 12.1.1.2 847 0x80000004 0x006B79 1
13.1.1.3 13.1.1.3 200 0x80000009 0x005585 1
Net LinkStates (Area 2)
Link ID ADVRouter Age Seq# Checksum
12.1.1.1 1.1.1.1 593 0x80000005 0x009777
13.1.1.1 1.1.1.1 201 0x80000009 0x009B6C
Type-5 ASExternal Link States
Link ID ADVRouter Age Seq# Checksum Tag
9.9.9.9 12.1.1.2 377 0x80000001 0x00BCBF 3489663273
89.1.1.0 12.1.1.2 377 0x80000001 0x00BB89 3489663273
R3#show ip ospf database external 9.9.9.9
OSPF Router withID (13.1.1.3) (Process ID 2)
Type-5 ASExternal Link States
LS age: 392
Options: (No TOS-capability,DC)
LS Type: AS External Link
Link State ID: 9.9.9.9(External Network Number )
Advertising Router: 12.1.1.2
LS Seq Number: 80000001
Checksum: 0xBCBF
Length: 36
Network Mask: /32
Metric Type: 2 (Largerthan any link state path)
TOS: 0
Metric: 1
Forward Address:0.0.0.0
External Route Tag: 3489663273
在看R3的路由表,依旧为BGP路由。
R3#show ip route vrf vpn3
Routing Table: vpn3
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRPexternal, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA externaltype 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type1, E2 - OSPF external type 2
i - IS-IS, su - IS-ISsummary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area,* - candidate default, U - per-user static route
o - ODR, P - periodicdownloaded static route
Gateway of last resort is not set
1.0.0.0/32 is subnetted,1 subnets
O 1.1.1.1 [110/11] via13.1.1.1, 00:04:48, FastEthernet0/1
9.0.0.0/32 is subnetted, 1 subnets
B 9.9.9.9 [200/0] via 5.5.5.5, 00:05:03
89.0.0.0/24 is subnetted, 1 subnets
B 89.1.1.0 [200/0] via 5.5.5.5, 00:05:03
12.0.0.0/24 is subnetted,1 subnets
O 12.1.1.0 [110/20] via13.1.1.1, 00:04:48, FastEthernet0/1
13.0.0.0/24 is subnetted,1 subnets
C 13.1.1.0 is directlyconnected, FastEthernet0/1
如果R2在重分发时,修改tag不采用默认的tag,或者执行capability vrf-lite,R3就能将LSA加载进路由表。
R2(config-router)#redistribute bgp 2345subnets tag 1111
再看R1路由详细信息:
R1#show ip ospf database external 9.9.9.9
OSPF Router withID (1.1.1.1) (Process ID 1)
Type-5 ASExternal Link States
Routing Bit Set on this LSA
LS age: 36
Options: (No TOS-capability,DC)
LS Type: AS External Link
Link State ID: 9.9.9.9(External Network Number )
Advertising Router: 12.1.1.2
LS Seq Number: 80000002
Checksum: 0x68BA
Length: 36
Network Mask: /32
Metric Type: 2 (Largerthan any link state path)
TOS: 0
Metric: 1
Forward Address:0.0.0.0
External Route Tag: 1111 之前为3489663273
再看R3的路由表及详细信息:
R3#show ip route vrf vpn3
Routing Table: vpn3
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRPexternal, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA externaltype 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type1, E2 - OSPF external type 2
i - IS-IS, su - IS-ISsummary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area,* - candidate default, U - per-user static route
o - ODR, P - periodicdownloaded static route
Gateway of last resort is not set
1.0.0.0/32 is subnetted,1 subnets
O 1.1.1.1 [110/11] via13.1.1.1, 00:10:25, FastEthernet0/1
9.0.0.0/32 is subnetted,1 subnets
O E2 9.9.9.9 [110/1] via13.1.1.1, 00:01:41, FastEthernet0/1
89.0.0.0/24 is subnetted,1 subnets
O E2 89.1.1.0 [110/1] via13.1.1.1, 00:01:41, FastEthernet0/1
12.0.0.0/24 is subnetted,1 subnets
O 12.1.1.0 [110/20] via13.1.1.1, 00:10:25, FastEthernet0/1
13.0.0.0/24 is subnetted,1 subnets
C 13.1.1.0 is directlyconnected, FastEthernet0/1
R3#
R3#show ip route vrf vpn3 9.9.9.9
Routing entry for 9.9.9.9/32
Known via "ospf2", distance 110, metric 1
Tag 1111, type extern 2,forward metric 20
Redistributing via bgp 2345
Last update from 13.1.1.1 onFastEthernet0/1, 00:01:49 ago
Routing Descriptor Blocks:
* 13.1.1.1, from 12.1.1.2,00:01:49 ago, via FastEthernet0/1
Route metric is 1,traffic share count is 1
Routetag 1111
此时R3的tag仍为系统默认的那个tag值。
capability vrf-lite 就不在说明。
最后看一下R2 R3都完成双向重分发后R1的路由表信息:
R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external,O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA externaltype 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type1, E2 - OSPF external type 2
i - IS-IS, su - IS-ISsummary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area,* - candidate default, U - per-user static route
o - ODR, P - periodicdownloaded static route
Gateway of last resort is not set
1.0.0.0/24 is subnetted,1 subnets
C 1.1.1.0 is directlyconnected, Loopback0
9.0.0.0/32 is subnetted,1 subnets
O E2 9.9.9.9 [110/1] via13.1.1.3, 00:00:03, FastEthernet0/1
[110/1] via12.1.1.2, 00:00:03, FastEthernet0/0
89.0.0.0/24 is subnetted,1 subnets
O E2 89.1.1.0 [110/1] via13.1.1.3, 00:00:03, FastEthernet0/1
[110/1] via12.1.1.2, 00:00:03, FastEthernet0/0
12.0.0.0/24 is subnetted,1 subnets
C 12.1.1.0 is directlyconnected, FastEthernet0/0
13.0.0.0/24 is subnetted,1 subnets
C 13.1.1.0 is directlyconnected, FastEthernet0/1
R1#show ip route 9.9.9.9
Routing entry for 9.9.9.9/32
Known via "ospf1", distance 110, metric 1
Tag Complete, Path Length ==1, AS 2345, , type extern 2, forward metric 10
Last update from 13.1.1.3 onFastEthernet0/1, 00:02:49 ago
Routing Descriptor Blocks:
13.1.1.3, from 13.1.1.3,00:02:49 ago, via FastEthernet0/1
Route metric is 1,traffic share count is 1
Route tag 3489663273
* 12.1.1.2, from 12.1.1.2,00:02:49 ago, via FastEthernet0/0
Route metric is 1, trafficshare count is 1
Route tag 3489663273