MPLS – TE

1, 关于TE流量工程的背景知识介绍:

为什么会有TE流量工程的产生?
在现实生产网中,IGP往往有些致命的限制,比如ospf是根据cost来选择路径的,cost越小的那么越优先。但是有些时候cost越小,并不代表链路负荷小。比如有一个链路是100M,用了99M,有另外一个链路是E1,用了不到500K,那么E1的链路实际上是优于100M链路的。因为可用的带宽还有将近1.5M.这个时候你会用什么样的方式来控制链路进行路径的选择?PBR?访问列表?

好像都不是那么容易和可行。

MPLS –TE提供了一个有效而且确实可行的方法.也提供了一套MPLS OAM的维护准则.

 

2,关于配置顺序和逻辑

1, 全局下面:

mpls traffic-eng tunnels

所有接口下面都要:

mpls traffic-eng tunnels

ip rsvp bandwidth 2048

2, ospf进程下面:-->流量工程的router-id和流量工程的area

mpls traffic-eng router-id Loopback0

mpls traffic-eng area 0

3, 建立tunnel

interface Tunnel0

ip unnumbered Loopback0

tunnel mode mpls traffic-eng

tunnel destination 10.1.1.2

tunnel mpls traffic-eng priority 7 7

tunnel mpls traffic-eng bandwidth 1024-->我的物理接口是2M,这里是N多个隧道来分享一个物理接口的带宽,所以要小于最多等于物理接口的带宽.

tunnel mpls traffic-eng path-option 1 dynamic

no routing dynamic

end

4, 将IP流量引入TE. (如果没有这一步,那就是否定了上面的所有配置,因为真实的数据流量是不会通过TE隧道进行转发的,那配置TE的目的在哪里呢?J)

有几种方式:

静态引入:ip route 10.1.1.2 255.255.255.255 Tunnel0

动态计算:

在tunnel x下面:

tunnel mpls traffic-eng autoroute announce

这里来说一下TE流量工程对于路径选择的基本原理:

 

3, 配置MPLS TE的典型配置:

clip_p_w_picpath002

这里核心骨干网是用的MPLS ×××.

PC-1:

interface GigabitEthernet1/0

ip address 1.1.1.1 255.255.255.0

negotiation auto

!

ip route 0.0.0.0 0.0.0.0 1.1.1.2

R2-PE-1:

ip cef

!

ip vrf maipu

rd 1:1

route-target export 1:1

route-target import 1:1

!

multilink bundle-name authenticated

mpls traffic-eng tunnels

mpls label protocol ldp

!

interface Loopback0

ip address 10.1.1.1 255.255.255.255

!

interface Tunnel0

ip unnumbered Loopback0

tunnel mode mpls traffic-eng

tunnel destination 10.1.1.2

tunnel mpls traffic-eng autoroute announce

tunnel mpls traffic-eng priority 7 7

tunnel mpls traffic-eng bandwidth 1024

tunnel mpls traffic-eng path-option 1 dynamic

no routing dynamic

!

interface GigabitEthernet1/0

ip vrf forwarding maipu

ip address 1.1.1.2 255.255.255.0

negotiation auto

!

interface GigabitEthernet2/0

ip address 2.1.1.1 255.255.255.0

negotiation auto

mpls traffic-eng tunnels

mpls label protocol ldp

mpls ip

ip rsvp bandwidth 2048

!

router ospf 1

mpls traffic-eng router-id Loopback0

mpls traffic-eng area 0

router-id 10.1.1.1

network 0.0.0.0 255.255.255.255 area 0

!

router bgp 65500

bgp router-id 10.1.1.1

bgp log-neighbor-changes

neighbor 10.1.1.2 remote-as 65500

neighbor 10.1.1.2 update-source Loopback0

neighbor 10.1.1.2 next-hop-self

!

address-family ***v4

neighbor 10.1.1.2 activate

neighbor 10.1.1.2 send-community extended

exit-address-family

!

address-family ipv4 vrf maipu

redistribute connected

redistribute static

exit-address-family

!

R3-P-1:

ip cef

!

multilink bundle-name authenticated

mpls traffic-eng tunnels

mpls label protocol ldp

!

interface FastEthernet0/0

no ip address

shutdown

duplex half

!

interface GigabitEthernet1/0

ip address 2.1.1.2 255.255.255.0

negotiation auto

mpls traffic-eng tunnels

mpls label protocol ldp

mpls ip

ip rsvp bandwidth 2048

!

interface GigabitEthernet2/0

ip address 3.1.1.1 255.255.255.0

negotiation auto

mpls traffic-eng tunnels

mpls label protocol ldp

mpls ip

ip rsvp bandwidth 2048

!

interface GigabitEthernet3/0

ip address 4.1.1.1 255.255.255.0

negotiation auto

mpls traffic-eng tunnels

mpls traffic-eng attribute-flags 0x3

mpls label protocol ldp

mpls ip

ip rsvp bandwidth 2048

!

router ospf 1

mpls traffic-eng router-id GigabitEthernet2/0

mpls traffic-eng area 0

network 0.0.0.0 255.255.255.255 area 0

!

R4-P-2:

ip cef

multilink bundle-name authenticated

mpls traffic-eng tunnels

mpls label protocol ldp

!

interface GigabitEthernet1/0

ip address 3.1.1.2 255.255.255.0

negotiation auto

mpls traffic-eng tunnels

mpls label protocol ldp

mpls ip

ip rsvp bandwidth 2048

!

interface GigabitEthernet2/0

ip address 5.1.1.1 255.255.255.0

negotiation auto

mpls traffic-eng tunnels

mpls label protocol ldp

mpls ip

ip rsvp bandwidth 2048

!

router ospf 1

mpls traffic-eng router-id GigabitEthernet1/0

mpls traffic-eng area 0

network 0.0.0.0 255.255.255.255 area 0

R5-P-3:

ip cef

!

multilink bundle-name authenticated

mpls traffic-eng tunnels

mpls label protocol ldp

!

interface GigabitEthernet1/0

ip address 5.1.1.2 255.255.255.0

negotiation auto

mpls traffic-eng tunnels

mpls label protocol ldp

mpls ip

ip rsvp bandwidth 2048

!

interface GigabitEthernet2/0

ip address 6.1.1.1 255.255.255.0

negotiation auto

mpls traffic-eng tunnels

mpls label protocol ldp

mpls ip

ip rsvp bandwidth 2048

!

interface GigabitEthernet3/0

ip address 4.1.1.2 255.255.255.0

negotiation auto

mpls traffic-eng tunnels

mpls label protocol ldp

mpls ip

ip rsvp bandwidth 2048

!

router ospf 1

mpls traffic-eng router-id GigabitEthernet1/0

mpls traffic-eng area 0

network 0.0.0.0 255.255.255.255 area 0

R6-PE-2:

ip cef

!

ip vrf maipu

rd 1:1

route-target export 1:1

route-target import 1:1

!

multilink bundle-name authenticated

mpls traffic-eng tunnels

mpls label protocol ldp

!

interface Loopback0

ip address 10.1.1.2 255.255.255.255

!

interface Tunnel0

ip unnumbered Loopback0

tunnel mode mpls traffic-eng

tunnel destination 10.1.1.1

tunnel mpls traffic-eng autoroute announce

tunnel mpls traffic-eng priority 7 7

tunnel mpls traffic-eng bandwidth 1024

tunnel mpls traffic-eng path-option 1 dynamic

no routing dynamic

interface GigabitEthernet1/0

ip address 6.1.1.2 255.255.255.0

negotiation auto

mpls traffic-eng tunnels

mpls label protocol ldp

mpls ip

ip rsvp bandwidth 2048

!

interface GigabitEthernet2/0

ip vrf forwarding maipu

ip address 7.1.1.1 255.255.255.0

negotiation auto

mpls label protocol ldp

mpls ip

!

router ospf 1

mpls traffic-eng router-id Loopback0

mpls traffic-eng area 0

router-id 10.1.1.2

network 0.0.0.0 255.255.255.255 area 0

!

router bgp 65500

bgp router-id 10.1.1.2

bgp log-neighbor-changes

neighbor 10.1.1.1 remote-as 65500

neighbor 10.1.1.1 update-source Loopback0

neighbor 10.1.1.1 next-hop-self

!

address-family ***v4

neighbor 10.1.1.1 activate

neighbor 10.1.1.1 send-community extended

exit-address-family

!

address-family ipv4 vrf maipu

redistribute connected

redistribute static

exit-address-family

PC-2:

interface GigabitEthernet1/0

ip address 7.1.1.2 255.255.255.0

negotiation auto

!

ip route 0.0.0.0 0.0.0.0 7.1.1.1

4, MPLS TE动态方式的路径选择原理.

attribute-flag >bandwidth>administrate weight (cost))

Bandwidth.

在一个拓扑中,首先TE比较的是bandwidth属性。

clip_p_w_picpath002[1]

现在如果建立一个隧道从R2到R6,那么有两个路径可以用。

Path1:R2àR3àR4àR5àR6

Path2: R2àR3àR5àR6

那么IGP ospf优选肯定是路径2,因为路径2的cost之和要比路径1小。

通过TE隧道,首先要比较的是bandwidth.

在R2上面,我们配置了隧道:

interface Tunnel0

ip unnumbered Loopback0

tunnel mode mpls traffic-eng

tunnel destination 10.1.1.2

tunnel mpls traffic-eng autoroute announce

tunnel mpls traffic-eng priority 7 7

tunnel mpls traffic-eng bandwidth 1024

tunnel mpls traffic-eng path-option 1 dynamic

no routing dynamic

end

在路径1和路径2上面,如果路径1的所有物理接口的bandwidth都大于1024K,那么就走path1, 如果两条链路都可以达到这个要求,那么接下来就比较administrative-weight .

clip_p_w_picpath002[2]

对于这个administrative-weight,我的理解就是从IGP中ospf cost中提取出来的值,但是关系是复制出来,并不是和igp的cost共用的关系。

也就是说,修改administrative-weight,可以修改TE的路径,但是对于IGP的ospf计算路径是没有任何的关系的。

这里有两条路径,他们的bandwidth已经比较完了,都是一样的。

接下来就是比较administrative-weight, 对于path-1来说,aw=4, path2, aw=3.

所以从R2上面来看TE隧道的路径,一定是走path2.

下面是R2上面的输出结果:

clip_p_w_picpath004

这里根据拓扑图,明显可以看出走的是path2,下面那个路径,因为之前已经说过,他的adminstrative-weight是3,优于上面的一条。

clip_p_w_picpath002[3]

在这里仍然用该拓扑:

如果在R3-P-1路由器的interface gigaethernet 3/0上面,配置一个命令:

clip_p_w_picpath006

那么,在R2上面重新计算路径,最后走的应该是path1.

原因很简单,path 1 的aw=4,而path2,因为R3上面修改了出方向的aw为3.

那么path2最后的aw应该是1+3+1=5. Path1优于path2.

当在R3的interface giga 3/0加了mpls traffic-administrative-weight 3以后,在R1上面触发重新计算TE隧道的路径,我们可以看到已经切换到了path1.

clip_p_w_picpath008

最后,在R3/0的aw=3的时候,我再把R3的interface g2/0给shutdown以后。

最后应该走下面的路径,可是path weight应该是5.之前就计算过。

clip_p_w_picpath010

这就是TE路径选择比较的第二个要素。

最后一个也是最重要的一个要素。

亲和属性.

Attribute-flag.

这个属性我现在了解的也不多,以后又机会再慢慢的去了解。

在cisco的IOS里面整个链路的亲和属性都是0x0.如果哪个链路的接口不是0x0的话,那么TE隧道是不会选择这个路径的,因为亲和属性比较以后完全不匹配,所以如果正常的路径链路出现问题,那么TE隧道是不会选择那条亲和属性不匹配的链路,而会认为链路已经完全down掉,没有路径可选。

当然亲和属性远没有这里谈的这样简单,还有掩码的概念在里面,假如一共有5条链路,有3条的亲和属性相同,那么就可以在这三条路径中进行选择。更深入的概念以后又时间再进行研究。

这里依然用上面的拓扑图:

clip_p_w_picpath002[4]

这里有2条链路,path1(橘红色),path2(紫色).

现在所有链路的attribute-flags都是0x0.这个时候肯定比较的就是bandwidth和administrative-weight属性。

前提是所有的attribute-flags都是一样的,如果不一样呢?

现在我把R3的interface G3/0下面加一条命令:

clip_p_w_picpath012

Mpls traffic-eng attribute-flags 0x3

相当于所有链路的接口亲和属性都是0x0(默认的),现在将path2的interface g3/0修改为0x3.

那么在R2上面看隧道,他会立马切换到path1上面去。

clip_p_w_picpath014

这里就已经验证了这个理论。

那么有个问题是,如果我的path1有地方down掉了。这个时候是否会启用备用隧道path2呢?

答案是不会。

clip_p_w_picpath002[5]

现在R3的interface g3/0,attribute-flags是0x3,那么从R2到R5当然走的是path1.当path1的R3接口giga 2/0 shutdown以后,那么在R2上面是不会再有有效TE隧道到R6的。

clip_p_w_picpath016

再在R2上面看看隧道的情况:

clip_p_w_picpath018

这样就验证了今天MPLS –TE选路的所有原理。