【实验】MPLS L3VPN中EIGRP次优路径优化机制

本文最后一次被修改是在:2016年11月8日1:32:19

其他相关文章:

  • 如果您只是想查看MPLS L3VPN的基础配置,请看:《【实验】MPLS L3VPN详解》;
  • 如果您想查看更多关于MPLS L3VPN的内容请在搜索框中搜索:“MPLS L3VPN”。

 

实验环境:

操作系统:Windows 10(1607,14393.351,当时最新测试版),模拟器:GNS3 IOU for Windows 1.5.2(当时最新正式版)
注:当然,只要有思科模拟器都可以做这个实验

MPLS VPN中EIGRP次优路径优化机制
MPLS VPN中EIGRP次优路径优化机制

先配置IP地址,IP地址我的配置习惯是:

  1. 对于路由器IOUx的Lo 0地址:x.x.x.x /32;
  2. 对于路由器IOUx和IOUy的直连地址:IOUx 上是 xy.1.1.x /24,IOUy 上是 xy.1.1.y /24,同时x < y。
IOU1:

conf t
int l 0
ip add 1.1.1.1 255.255.255.255

int e 0/0
ip add 12.1.1.1 255.255.255.0
no sh

IOU2:

conf t
int l 0
ip add 2.2.2.2 255.255.255.255

int e 0/0
ip add 12.1.1.2 255.255.255.0
no sh

int e 0/1
ip add 26.1.1.2 255.255.255.0
no sh

int e 0/2
ip add 23.1.1.2 255.255.255.0
no sh

IOU3:

conf t
int l 0
ip add 3.3.3.3 255.255.255.255

int e 0/2
ip add 23.1.1.3 255.255.255.0
no sh

int e 0/3
ip add 34.1.1.3 255.255.255.0
no sh

IOU4:

conf t
int l 0
ip add 4.4.4.4 255.255.255.255

int e 0/0
ip add 45.1.1.4 255.255.255.0
no sh

int e 0/1
ip add 47.1.1.4 255.255.255.0
no sh

int e 0/3
ip add 34.1.1.4 255.255.255.0
no sh

IOU5:

conf t
int l 0
ip add 5.5.5.5 255.255.255.255

int e 0/0
ip add 45.1.1.5 255.255.255.0
no sh

IOU6:

conf t
int l 0
ip add 6.6.6.6 255.255.255.255

int e 0/0
ip add 67.1.1.6 255.255.255.0
no sh

int e 0/1
ip add 26.1.1.6 255.255.255.0
no sh

IOU7:

conf t
int l 0
ip add 7.7.7.7 255.255.255.255

int e 0/0
ip add 67.1.1.7 255.255.255.0
no sh

int e 0/1
ip add 47.1.1.7 255.255.255.0
no sh

再根据图中的要求快速完成MPLS VPN的配置:

IOU2:

conf t
ip cef
mpls ip
mpls label pro ldp
mpls ldp ro l 0 fo

int e 0/2
mpls ip

int r e 0/2 , l 0
ip os 100 a 0

ip vrf IOU1
rd 100:1
route-target 1:1

ip vrf IOU6
rd 100:6
route-target 1:1

int e 0/0
ip vrf f IOU1
ip add 12.1.1.2 255.255.255.0

int e 0/1
ip vrf f IOU6
ip add 26.1.1.2 255.255.255.0

router bgp 100
bgp router-id 2.2.2.2
no bgp def ipv4
nei 4.4.4.4 remot 100
nei 4.4.4.4 up l 0
add vpnv4 un
nei 4.4.4.4 ac

add ipv4 vrf IOU1
red eigrp 200
add ipv4 vrf IOU6
red eigrp 100

router eigrp 100
add ipv4 vrf IOU1 au 200
red bgp 100 me 10000 10 255 1 1500
net 12.1.1.2 0.0.0.0
add ipv4 vrf IOU6 au 100
net 26.1.1.2 0.0.0.0
red bgp 100 me 10000 10 255 1 1500

IOU4:

conf t
ip cef
mpls ip
mpls label pro ldp
mpls ldp ro l 0 fo

int e 0/3
mpls ip

int r e 0/3 , l 0
ip os 100 a 0

ip vrf IOU5
rd 100:5
route-target 1:1

ip vrf IOU7
rd 100:7
route-target 1:1

int e 0/0
ip vrf f IOU5
ip add 45.1.1.4 255.255.255.0

int e 0/1
ip vrf f IOU7
ip add 47.1.1.4 255.255.255.0

router bgp 100
bgp router-id 4.4.4.4
no bgp def ipv4
nei 2.2.2.2 remot 100
nei 2.2.2.2 up l 0
add vpnv4 un
nei 2.2.2.2 ac

add ipv4 vrf IOU5
red eigrp 200
add ipv4 vrf IOU7
red eigrp 100

router eigrp 100
add ipv4 vrf IOU5 au 200
net 45.1.1.4 0.0.0.0
red bgp 100 me 10000 10 255 1 1500
add ipv4 vrf IOU7 au 100
net 47.1.1.4 0.0.0.0
red bgp 100 me 10000 10 255 1 1500

IOU1/IOU5:

conf t
router eigrp 200
no au
net 0.0.0.0

IOU3:

conf t
ip cef
mpls ip
mpls label pro ldp
mpls ldp ro l 0 fo

int r e 0/2-3
mpls ip

int r e 0/2-3 , l 0
ip os 100 a 0

IOU6/IOU7:

conf t
router eigrp 100
no au
net 0.0.0.0


实验过程:

配置完上面的需求后我们来看看此时的现象:

IOU1#sh ip route
Codes: L - local, 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, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override

Gateway of last resort is not set

      1.0.0.0/32 is subnetted, 1 subnets
C        1.1.1.1 is directly connected, Loopback0
      5.0.0.0/32 is subnetted, 1 subnets
D        5.5.5.5 [90/435200] via 12.1.1.2, 00:01:00, Ethernet0/0
                                 —— 对于从相同AS号过来的路由,被标记为EIGRP内部路由
      6.0.0.0/32 is subnetted, 1 subnets
D EX     6.6.6.6 [170/284160] via 12.1.1.2, 00:01:21, Ethernet0/0
                                 —— 对于从不同AS号过来的路由,被标记为EIGRP外部路由
           7.0.0.0/32 is subnetted, 1 subnets
D EX     7.7.7.7 [170/284160] via 12.1.1.2, 00:01:00, Ethernet0/0
      12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        12.1.1.0/24 is directly connected, Ethernet0/0
L        12.1.1.1/32 is directly connected, Ethernet0/0
      26.0.0.0/24 is subnetted, 1 subnets
D EX     26.1.1.0 [170/284160] via 12.1.1.2, 00:01:21, Ethernet0/0
      45.0.0.0/24 is subnetted, 1 subnets
D        45.1.1.0 [90/307200] via 12.1.1.2, 00:01:00, Ethernet0/0
      47.0.0.0/24 is subnetted, 1 subnets
D EX     47.1.1.0 [170/284160] via 12.1.1.2, 00:01:00, Ethernet0/0
      67.0.0.0/24 is subnetted, 1 subnets
D EX     67.1.1.0 [170/284160] via 12.1.1.2, 00:01:21, Ethernet0/0

EIGRP重分布进BGP,像OSPF一样会有很多信息被BGP从一台BGP设备携带给另外一台BGP设备。其中有两个信息必须要知道:一个是EIGRP AS号、一个是EIGRP metric。其中EIGRP metric是被BGP的cost-community携带。

什么是BGP cost-community?请看《BGP Cost Community详解

  • 因为EIGRP AS号被携带才会造成上述拓扑中IOU1对IOU5和IOU6的路由处理不一样(一个是D路由,一个是D EX路由)。
  • 因为有了cost-community,PE设备则不会关心AD,而直接用cost-community决定路径的优劣。比如上述拓扑中关于5.5.5.5的路由,IOU2的VRF IOU6中有两个路径:一个是从IBGP(AD = 200)方向导入进VRF的,一个是通过EIGRP(AD = 170)从IOU6学习过来的(如下图所示)。
MPLS VPN中EIGRP次优路径优化机制
MPLS VPN中EIGRP次优路径优化机制
  • 从IBGP方向导入的路由cost-community就是IOU5重分布进BGP时的EIGRP的metric;
  • 通过EIGRP从IOU6学习的话,metric = IOU5重分布进BGP时的EIGRP的metric + IOU4和IOU7之间的metric + IOU6和IOU7之间的metric + IOU2和IOU6之间的metric。

显然从IBGP方向导入的路由cost-community要远小于通过EIGRP从IOU6学习。所以就算从IOU6过来的路由是170的AD(从IBGP是200的AD),IOU2也不会选择AD小的路由,而是选择cost-community小的路由。

可以通过如下配置使PE设备忽略cost-community的比较,但这样会造成拓扑的次优路径。

IOU2#sh ip route vrf IOU6

Routing Table: IOU6
Codes: L - local, 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, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override

Gateway of last resort is not set

      1.0.0.0/32 is subnetted, 1 subnets
B        1.1.1.1 [20/409600] via 12.1.1.1 (IOU1), 00:06:56, Ethernet0/0
      5.0.0.0/32 is subnetted, 1 subnets
B        5.5.5.5 [200/409600] via 4.4.4.4, 00:06:35
                                           —— 此时是200的优,而不是170的优
      6.0.0.0/32 is subnetted, 1 subnets
D        6.6.6.6 [90/409600] via 26.1.1.6, 00:08:30, Ethernet0/1
      7.0.0.0/32 is subnetted, 1 subnets
B        7.7.7.7 [200/409600] via 4.4.4.4, 00:06:35
      12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
B        12.1.1.0/24 is directly connected (IOU1), 00:06:56, Ethernet0/0
L        12.1.1.2/32 is directly connected, Ethernet0/0
      26.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        26.1.1.0/24 is directly connected, Ethernet0/1
L        26.1.1.2/32 is directly connected, Ethernet0/1
      45.0.0.0/24 is subnetted, 1 subnets
B        45.1.1.0 [200/0] via 4.4.4.4, 00:06:35
      47.0.0.0/24 is subnetted, 1 subnets
B        47.1.1.0 [200/0] via 4.4.4.4, 00:06:35
      67.0.0.0/24 is subnetted, 1 subnets
D        67.1.1.0 [90/307200] via 26.1.1.6, 00:08:30, Ethernet0/1

现在配置命令:

IOU2(config)#router bgp 100
IOU2(config-router)#bgp bestpath cost-community ignore 
IOU2(config-router)#do clear bgp vpnv4 unicast *
IOU2#sh ip route vrf IOU6

Routing Table: IOU6
Codes: L - local, 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, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override

Gateway of last resort is not set

      1.0.0.0/32 is subnetted, 1 subnets
B        1.1.1.1 [20/409600] via 12.1.1.1 (IOU1), 00:00:41, Ethernet0/0
      5.0.0.0/32 is subnetted, 1 subnets
D EX     5.5.5.5 [170/335360] via 26.1.1.6, 00:01:25, Ethernet0/1
                                            —— 现在是170的优,而不是200的优
      6.0.0.0/32 is subnetted, 1 subnets
D        6.6.6.6 [90/409600] via 26.1.1.6, 00:19:56, Ethernet0/1
      7.0.0.0/32 is subnetted, 1 subnets
D        7.7.7.7 [90/435200] via 26.1.1.6, 00:01:25, Ethernet0/1
      12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
B        12.1.1.0/24 is directly connected (IOU1), 00:00:41, Ethernet0/0
L        12.1.1.2/32 is directly connected, Ethernet0/0
      26.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        26.1.1.0/24 is directly connected, Ethernet0/1
L        26.1.1.2/32 is directly connected, Ethernet0/1
      45.0.0.0/24 is subnetted, 1 subnets
D EX     45.1.1.0 [170/335360] via 26.1.1.6, 00:01:25, Ethernet0/1
      47.0.0.0/24 is subnetted, 1 subnets
D        47.1.1.0 [90/332800] via 26.1.1.6, 00:01:25, Ethernet0/1
      67.0.0.0/24 is subnetted, 1 subnets
D        67.1.1.0 [90/307200] via 26.1.1.6, 00:19:56, Ethernet0/1

IOU2#sh ip ro vrf IOU1

Routing Table: IOU1
Codes: L - local, 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, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override

Gateway of last resort is not set

      1.0.0.0/32 is subnetted, 1 subnets
D        1.1.1.1 [90/409600] via 12.1.1.1, 00:22:17, Ethernet0/0
      5.0.0.0/32 is subnetted, 1 subnets
B        5.5.5.5 [20/335360] via 26.1.1.6 (IOU6), 00:03:23, Ethernet0/1
                                            —— 现在IOU1将会选择从IOU6走
      6.0.0.0/32 is subnetted, 1 subnets
B        6.6.6.6 [20/409600] via 26.1.1.6 (IOU6), 00:02:40, Ethernet0/1
      7.0.0.0/32 is subnetted, 1 subnets
B        7.7.7.7 [20/435200] via 26.1.1.6 (IOU6), 00:03:23, Ethernet0/1
      12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        12.1.1.0/24 is directly connected, Ethernet0/0
L        12.1.1.2/32 is directly connected, Ethernet0/0
      26.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
B        26.1.1.0/24 is directly connected (IOU6), 00:02:40, Ethernet0/1
L        26.1.1.2/32 is directly connected, Ethernet0/1
      45.0.0.0/24 is subnetted, 1 subnets
B        45.1.1.0 [20/335360] via 26.1.1.6 (IOU6), 00:03:23, Ethernet0/1
      47.0.0.0/24 is subnetted, 1 subnets
B        47.1.1.0 [20/332800] via 26.1.1.6 (IOU6), 00:03:23, Ethernet0/1
      67.0.0.0/24 is subnetted, 1 subnets
B        67.1.1.0 [20/307200] via 26.1.1.6 (IOU6), 00:02:40, Ethernet0/1

IOU2的VRF IOU1关于5.5.5.5之所以选择了26.1.1.6作为下一跳而没有选择4.4.4.4,是因为忽略了cost-community的比较。而关于5.5.5.5在IOU2上分别是从IBGP和EIGRP学习的,EIGRP的AD 170,小于IBGP 200,所以IOU1访问IOU5就会出现以下路径:

IOU1#tra 5.5.5.5
Type escape sequence to abort.
Tracing the route to 5.5.5.5
VRF info: (vrf in name/id, vrf out name/id)
  1 12.1.1.2 6 msec 5 msec 13 msec
  2 26.1.1.6 10 msec 0 msec 0 msec
  3 67.1.1.7 1 msec 1 msec 1 msec
  4 47.1.1.4 1 msec 0 msec 1 msec
  5 45.1.1.5 1 msec 0 msec 1 msec

这显然是一个次优路径!当然默认情况下不会出现这种现象,因为默认情况下就是只比较cost-community的大小决定路径。

 

如有错误,欢迎在下方留言指正,谢谢。

这篇文章对你有帮助吗?

相关文章

1条评论

  1. 今天(2016年11月8日1:32:19)对本文进行了修改,增加了一些show命令的展示,增强了上下文的联系。

发表评论?

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据