【实验】MPLS L2VPN下,Point-to-Point的AToM实验

本文最后一次被修改是在:2016年11月23日19:26:05

 

实验环境:

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

【实验】MPLS L2VPN下,Point-to-Point的AToM实验
【实验】MPLS L2VPN下,Point-to-Point的AToM实验

实验需求:

  • IOU2、IOU3和IOU4上运行IGP(OSPF 234)和MPLS;
  • 在IOU2和IOU4上配置MPLS / AToM,让IOU1IOU7实现L2VPN通信;
  • 在IOU2和IOU4上配置MPLS / AToM,让IOU5IOU6实现L2VPN通信;
  • 在IOU2和IOU4上配置MPLS / AToM,让IOU8IOU9实现L2VPN通信;
  • 因为是L2VPN,所以IOU2的s 2/0、e 0/1和e 1/0接口均不需要配置IP地址,IOU4的s 2/0、s 2/1和e 1/0接口也不需要配置IP地址。

其他相关文章:

  • 什么是 MPLS / AToM?MPLS / AToM 属于 L2VPN → Point-to-Point → Like-to-Like(Any-to-Any) → MPLS / AToM 这个分类,详情请看:《L2VPN传统结构

实验步骤:

1、先配置IP地址、IGP(OSPF 234)和 MPLS:

IOU2:

conf t
int l 0
ip add 2.2.2.2 255.255.255.255

int e 0/2
ip add 23.1.1.2 255.255.255.0
no sh

ip cef
mpls ip
mpls label pro ldp
mpls ldp ro l 0 fo
mpls label range 2000 2999

int e 0/2
mpls ip

router ospf 234
router-id 2.2.2.2

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

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

ip cef
mpls ip
mpls label pro ldp
mpls ldp ro l 0 fo
mpls label range 3000 3999

int r e 0/2-3
mpls ip

router ospf 234
router-id 3.3.3.3

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

IOU4:

conf t
int l 0
ip add 4.4.4.4 255.255.255.255

int e 0/3
ip add 34.1.1.4 255.255.255.0
no sh

ip cef
mpls ip
mpls label pro ldp
mpls ldp ro l 0 fo
mpls label range 4000 4999

int e 0/3
mpls ip

router ospf 234
router-id 4.4.4.4

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

IOU1:

conf t
int s 2/0
ip add 10.1.1.1 255.255.255.0
no sh

IOU7:

conf t
int s 2/0
ip add 10.1.1.7 255.255.255.0
no sh

IOU5:

conf t
int s 2/1
encapsulation ppp
ip add 100.1.1.5 255.255.255.0
no sh

IOU6:

conf t
int e 0/1
ip add 100.1.1.6 255.255.255.0
no sh

IOU8:

conf t
int e 1/0
no sh
int e 1/0.8
en do 8
ip add 200.1.1.8 255.255.255.0

IOU9:

conf t
int e 1/0
no sh
int e 1/0.9
en do 9
ip add 200.1.1.9 255.255.255.0

2、配置IOU1和IOU7上的MPLS / AToM:

【实验】MPLS L2VPN下,Point-to-Point的AToM实验
【实验】MPLS L2VPN下,Point-to-Point的AToM实验
IOU2(config)#int s 2/0
IOU2(config-if)#no shutdown
IOU2(config-if)#xconnect 4.4.4.4 17 encapsulation mpls

IOU4(config)#int s 2/0
IOU4(config-if)#no shutdown
IOU4(config-if)#xconnect 2.2.2.2 17 encapsulation mpls

注意:xconnect 4.4.4.4 17 encapsulation mpls 中的“17”指的是VC ID value(如下图所示),路由器通过VC ID来区分每条虚拟线路。如果是同一条虚拟线路,那么两个路由器上配置的VC ID必须一致。

IOU2(config)#int s 2/0
IOU2(config-if)#xconnect 4.4.4.4 ?
  <1-4294967295>  Enter VC ID value

此时,你会看到在IOU2和IOU4上弹出了两条log日志:

IOU4(config-if-xconn)#
*Nov  1 12:04:14.816: %LINEPROTO-5-UPDOWN: Line protocol on Interface
 pseudowire0, changed state to up
*Nov  1 12:05:40.437: %LDP-5-NBRCHG: LDP Neighbor 2.2.2.2:0 (2) is UP
  1. pseudowire0接口起来了;
  2. IOU2和IOU4之间多建立了一个LDP邻居关系。
IOU4#sh mpls ldp nei
    Peer LDP Ident: 3.3.3.3:0; Local LDP Ident 4.4.4.4:0
        TCP connection: 3.3.3.3.646 - 4.4.4.4.49684
        State: Oper; Msgs sent/rcvd: 10/10; Downstream
        Up time: 00:02:07
        LDP discovery sources:
          Ethernet0/3, Src IP addr: 34.1.1.3
        Addresses bound to peer LDP Ident:
          23.1.1.3        34.1.1.3        3.3.3.3         
    Peer LDP Ident: 2.2.2.2:0; Local LDP Ident 4.4.4.4:0
        TCP connection: 2.2.2.2.646 - 4.4.4.4.53793
        State: Oper; Msgs sent/rcvd: 9/9; Downstream
        Up time: 00:00:39
        LDP discovery sources:
          Targeted Hello 4.4.4.4 -> 2.2.2.2, active, passive
        Addresses bound to peer LDP Ident:
          23.1.1.2        2.2.2.2

现在通过LDP和MPLS转发机制在IOU2和IOU4之间建立了一条虚拟线路(pseudowire,伪线),这条虚拟线路能够帮助IOU1和IOU7实现互通。

现在IOU1就可以ping通IOU7了:

IOU1#p 10.1.1.7
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.7, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 17/19/20 ms

traceroute一下你会发现看不到IOU2、IOU3和IOU4,相当于IOU1和IOU7是“直连”的:

IOU1#traceroute 10.1.1.7
Type escape sequence to abort.
Tracing the route to 10.1.1.7
VRF info: (vrf in name/id, vrf out name/id)
  1 10.1.1.7 20 msec 20 msec 18 msec
IOU1#

3、配置IOU5和IOU6上的MPLS / AToM:

【实验】MPLS L2VPN下,Point-to-Point的AToM实验
【实验】MPLS L2VPN下,Point-to-Point的AToM实验

IOU1上是通过serial口(HDLC封装)连接的IOU2,IOU7也是通过serial口(HDLC封装)连接的IOU4,那如果(两个客户路由器上)连接服务提供商的接口不同(或者二层封装格式不同)可不可以互通呢?答案是:可以的。

现在IOU6是通过e 0/1口(Ethernet封装)连接的IOU2,而IOU5是通过s 2/1口(PPP封装)连接的IOU4。

IOU2(config)#pseudowire-class T56
IOU2(config-pw-class)#encapsulation mpls
IOU2(config-pw-class)#interworking ip

IOU2(config-pw-class)#int e 0/1
IOU2(config-if)#no sh
IOU2(config-if)#xconnect 4.4.4.4 56 pw-class T56
IOU4(config)#pseudowire-class T56
IOU4(config-pw-class)#encapsulation mpls
IOU4(config-pw-class)#interworking ip

IOU4(config-pw-class)#int s 2/1
IOU4(config-if)#encapsulation ppp
IOU4(config-if)#no sh
IOU4(config-if)#xconnect 2.2.2.2 56 pw-class T56

IOU5和IOU6之间的伪线配置跟IOU1和IOU7之间的伪线配置有所区别:

  1. IOU5和IOU6的配置需要先建立一个伪线的类(pseudowire-class);
  2. 紧接着在类中配置两个参数(encapsulation mpls 和 interworking ip);
  3. 最后才到接口下去配置xconnect的连接。

encapsulation mpls的含义就是采用MPLS封装,与之对应的还有一个L2TPv3封装,这个很好理解;而interworking ip的含义是在伪线里只允许传递IP三层头部,也就是说二层头部将会被全部擦除(文章下方对这部分会有详细的讲解)。

其他相关文章:

注意:IOU4和IOU5的链路上是要配置PPP封装的。如果不配置PPP封装,在配置xconnect时,就会报下面的错误:

IOU4(config-if)#int s 2/1 
IOU4(config-if)#xconnect 2.2.2.2 56 pw-class T56
Interworking specified in pw-class is not supported on this interface

现在IOU6就可以ping通IOU5了,traceroute也会发现IOU5和IOU6之间显示是直连的:

IOU6#p 100.1.1.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 100.1.1.5, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 10/10/11 ms

IOU6#traceroute 100.1.1.5
Type escape sequence to abort.
Tracing the route to 100.1.1.5
VRF info: (vrf in name/id, vrf out name/id)
  1 100.1.1.5 11 msec 10 msec 11 msec

其他相关文章:

4、配置IOU8和IOU9上的MPLS / AToM:

【实验】MPLS L2VPN下,Point-to-Point的AToM实验
【实验】MPLS L2VPN下,Point-to-Point的AToM实验

IOU8和IOU9上连接服务提供商的接口采用的都是802.1Q子接口:

IOU2(config)#pseudowire-class T89
IOU2(config-pw-class)#encapsulation mpls
IOU2(config-pw-class)#interworking ethernet 

IOU2(config-pw-class)#int e 1/0
IOU2(config-if)#no sh
IOU2(config-if)#int e 1/0.8
IOU2(config-subif)#encapsulation dot1Q 8
IOU2(config-subif)#xconnect 4.4.4.4 89 pw-class T89
IOU4(config)#pseudowire-class T89
IOU4(config-pw-class)#encapsulation mpls
IOU4(config-pw-class)#interworking ethernet

IOU4(config-pw-class)#int e 1/0
IOU4(config-if)#no sh 
IOU4(config-if)#int e 1/0.9
IOU4(config-subif)#encapsulation dot1Q 9
IOU4(config-subif)#xconnect 2.2.2.2 89 pw-class T89

注意:

  • IOU8和IOU9的配置跟IOU5和IOU6的配置基本上是一样的,只是在配置伪线的类的参数时,interworking是ethernet而不是ip了。而interworking ethernet的含义是在伪线里只允许传递Ethernet二层头部,也就是说其他二层头部将会被全部擦除(文章下方对这部分会有详细的讲解)。
  • 因为IOU8和IOU9是用802.1Q子接口跟服务提供商相连,所以要配置命令:encapsulation dot1Q x。

现在IOU8就可以ping通IOU9了,traceroute也会发现IOU8和IOU9之间显示是直连的:

IOU8#p 200.1.1.9
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 200.1.1.9, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 1/1/2 ms

IOU8#traceroute 200.1.1.9
Type escape sequence to abort.
Tracing the route to 200.1.1.9
VRF info: (vrf in name/id, vrf out name/id)
  1 200.1.1.9 2 msec 1 msec 1 msec

实验完成。

用一些show命令看一下该实验:

在MPLS L2VPN中,

  • Control Plane:维护PE-PE之间的伪线;
  • Data Plane:完成本地封装与伪线封装的转换。

我们先来看看控制面,IOU2和IOU4的LDP邻居关系表:

IOU2#sh mpls ldp neighbor 
    Peer LDP Ident: 3.3.3.3:0; Local LDP Ident 2.2.2.2:0
        TCP connection: 3.3.3.3.13363 - 2.2.2.2.646
        State: Oper; Msgs sent/rcvd: 117/115; Downstream
        Up time: 01:35:23
        LDP discovery sources:
          Ethernet0/2, Src IP addr: 23.1.1.3
        Addresses bound to peer LDP Ident:
          23.1.1.3        34.1.1.3        3.3.3.3         
    Peer LDP Ident: 4.4.4.4:0; Local LDP Ident 2.2.2.2:0
        TCP connection: 4.4.4.4.53793 - 2.2.2.2.646
        State: Oper; Msgs sent/rcvd: 117/123; Downstream
        Up time: 01:33:39
        LDP discovery sources:
          Targeted Hello 2.2.2.2 -> 4.4.4.4, active, passive
        Addresses bound to peer LDP Ident:
          34.1.1.4        4.4.4.4  

IOU4#sh mpls ldp neighbor 
    Peer LDP Ident: 3.3.3.3:0; Local LDP Ident 4.4.4.4:0
        TCP connection: 3.3.3.3.646 - 4.4.4.4.49684
        State: Oper; Msgs sent/rcvd: 116/117; Downstream
        Up time: 01:36:07
        LDP discovery sources:
          Ethernet0/3, Src IP addr: 34.1.1.3
        Addresses bound to peer LDP Ident:
          23.1.1.3        34.1.1.3        3.3.3.3         
    Peer LDP Ident: 2.2.2.2:0; Local LDP Ident 4.4.4.4:0
        TCP connection: 2.2.2.2.646 - 4.4.4.4.53793
        State: Oper; Msgs sent/rcvd: 124/118; Downstream
        Up time: 01:34:39
        LDP discovery sources:
          Targeted Hello 4.4.4.4 -> 2.2.2.2, active, passive
        Addresses bound to peer LDP Ident:
          23.1.1.2        2.2.2.2

虽然在IOU2和IOU4上建立了三条伪线,但是IOU2和IOU4之间的LDP邻居关系还是一个。

如下图所示,这是另一个拓扑(PS:没办法,别人画的图好看点于是就拿来用了,而且该拓扑跟本实验拓扑相近)。R2和R4建立了定向的LDP邻居关系,然后建立了两条定向的LDP session伪线。上面一条伪线是给R1和R7用的,下面一条伪线是给R5和R6用的。

AToM伪线是由一对MPLS LSP组成
AToM伪线是由一对MPLS LSP组成

LDP邻居关系建立分两种:

  • 一种是组播的邻居发现(向224.0.0.2的UDP 646端口发送Hello包);
  • 一种是定向的邻居发现(如本次实验中2.2.2.2和4.4.4.4的LDP邻居关系)。

其他相关文章:

再来看看数据面,IOU2和IOU4的LFIB:

IOU2#sh mpls forwarding-table 
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop    
Label      Label      or Tunnel Id     Switched      interface              
2000       Pop Label  3.3.3.3/32       0             Et0/2      23.1.1.3    
2001       Pop Label  34.1.1.0/24      0             Et0/2      23.1.1.3    
2002       3001       4.4.4.4/32       0             Et0/2      23.1.1.3    
2003       No Label   l2ckt(17)        49723         Se2/0      point2point 
2004       No Label   l2ckt(56)        2068          Et0/1      point2point 
2005       No Label   l2ckt(89)        726           Et1/0.8    point2point 

IOU4#sh mpls forwarding-table 
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop    
Label      Label      or Tunnel Id     Switched      interface              
4000       Pop Label  3.3.3.3/32       0             Et0/3      34.1.1.3    
4001       3000       2.2.2.2/32       0             Et0/3      34.1.1.3    
4002       Pop Label  23.1.1.0/24      0             Et0/3      34.1.1.3    
4003       No Label   l2ckt(17)        51580         Se2/0      point2point 
4004       No Label   l2ckt(56)        1038          Se2/1      point2point
4005       No Label   l2ckt(89)        696           Et1/0.9    point2point

如上图所示,在IOU2和IOU4的LFIB中,三条伪线的MPLS出标签都是No Label(弹出所有MPLS标签)。PE(也就是IOU2和IOU4)在将数据包从伪线中转发到自己的CE(客户边界路由器,也就是除IOU2/3/4以外的那些路由器)上时,数据包在PE上确实是要No Label。(PS:看下面的图示更容易理解这句话,我希望你不会看晕…)

mpls-l2vpn-point-to-point-20

但是PE(如IOU2)通过伪线将数据包转发给对端PE(IOU2的对端PE就是IOU4)时,PE(如IOU2)是要为这些数据包打上对端PE为这条伪线分配的MPLS标签的,而你会发现这些MPLS标签在PE(如IOU2)上sh mpls forwarding-table是看不到的。(PS:看下面的图示更容易理解这句话,我希望你不会看晕…)

mpls-l2vpn-point-to-point-topology-21

总而言之,sh mpls forwarding-table是看不到MPLS L2VPN下所有为伪线分配的MPLS标签的,要想查看这些MPLS标签,需要使用的命令是show mpls l2transport binding

IOU2#sh mpls l2transport binding 
  Destination Address: 4.4.4.4,VC ID: 17      // VC ID是17,即IOU1和IOU7之间的伪线
    Local Label:  2003                               // 本端MPLS标签是2003
        Cbit: 1,    VC Type: HDLC,    GroupID: 0     // 链路类型是HDLC
        MTU: 1500,   Interface Desc: n/a
        VCCV: CC Type: CW [1], RA [2]
              CV Type: LSPV [2]
    Remote Label: 4003        // 远端MPLS标签是4003,4xxx开头显然是IOU4为IOU2分配的
        Cbit: 1,    VC Type: HDLC,    GroupID: 0
        MTU: 1500,   Interface Desc: n/a
        VCCV: CC Type: CW [1], RA [2]
              CV Type: LSPV [2]
  Destination Address: 4.4.4.4,VC ID: 56      // VC ID是56,即IOU5和IOU6之间的伪线
    Local Label:  2004
        Cbit: 1,    VC Type: IP,    GroupID: 0
        MTU: 1500,   Interface Desc: n/a
        VCCV: CC Type: CW [1], RA [2]
              CV Type: LSPV [2]
    Remote Label: 4004
        Cbit: 1,    VC Type: IP,    GroupID: 0
        MTU: 1500,   Interface Desc: n/a
        VCCV: CC Type: CW [1], RA [2]
              CV Type: LSPV [2]
  Destination Address: 4.4.4.4,VC ID: 89      // VC ID是89,即IOU8和IOU9之间的伪线
    Local Label:  2005
        Cbit: 1,    VC Type: Ethernet,    GroupID: 0
        MTU: 1500,   Interface Desc: n/a
        VCCV: CC Type: CW [1], RA [2]
              CV Type: LSPV [2]
    Remote Label: 4005
        Cbit: 1,    VC Type: Ethernet,    GroupID: 0
        MTU: 1500,   Interface Desc: n/a
        VCCV: CC Type: CW [1], RA [2]
              CV Type: LSPV [2]

显然,由上面的show命令可知,在MPLS L2VPN中,LDP会为每条伪线分配一个MPLS标签,即一条伪线就是一个FEC

其他相关文章:

详细地跟踪一下数据包:

现在我们以IOU1和IOU7为例,来分析一下,MPLS L2VPN上都打了哪些MPLS标签:

IOU1和IOU7之间的伪线
IOU1和IOU7之间的伪线

当IOU1(10.1.1.1)去ping IOU7(10.1.1.7)时,数据包到达了IOU2,IOU2会为该数据包打上IOU4为该伪线分配的MPLS标签4003:

┏━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
┃ ICMP ┃  D : 10.1.1.7  ┃      HDLC      ┃  Label : 4003  ┃
┃      ┃  S : 10.1.1.1  ┃                ┃                ┃
┗━━━━━━┻━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━┛
(注:上面的图是拿字符画的,手机上一自动换行就乱了,如果出现了变形,请在电脑上观看,下同)

然而,这还没有完,IOU2还要打上去往4.4.4.4的MPLS标签(具体MPLS标签如下图所示):

IOU2#sh ip cef 4.4.4.4
4.4.4.4/32
  nexthop 23.1.1.3 Ethernet0/2 label 3001

最终,数据包会被IOU2打上两层MPLS标签,然后转发给IOU3:

┏━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
┃ ICMP ┃  D : 10.1.1.7  ┃      HDLC      ┃  Label : 4003  ┃  Label : 3001  ┃
┃      ┃  S : 10.1.1.1  ┃                ┃                ┃                ┃
┗━━━━━━┻━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━┛

其他相关文章:

  • 上图所示的数据包的所有报头并没有全部画完,这里只是列举了比较重要的部分,其实还有4字节的伪线控制字段和最外层的Ethernet二层报头:
    | ICMP | IP | HDLC | 伪线控制字段 | 内层MPLS标签 | 外层MPLS标签 | Ethernet |

    如果想了解更多报头细节请看:《【实验】关于MPLS L2VPN MTU的实验》。

数据包到了IOU3上,IOU3查LFIB发现,IOU3需要Pop Label掉一层MPLS标签,然后再将数据包通过Et0/3口转发出去,下一跳是34.1.1.4,也就是转发给IOU4:

IOU3#sh mpls forwarding-table 
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop    
Label      Label      or Tunnel Id     Switched      interface              
3000       Pop Label  2.2.2.2/32       51107         Et0/2      23.1.1.2    
3001       Pop Label  4.4.4.4/32       49620         Et0/3      34.1.1.4 

现在数据包就剩下一层MPLS标签了:

┏━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
┃ ICMP ┃  D : 10.1.1.7  ┃      HDLC      ┃  Label : 4003  ┃
┃      ┃  S : 10.1.1.1  ┃                ┃                ┃
┗━━━━━━┻━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━┛

数据包到了IOU4上,IOU4查LFIB发现,IOU4需要No Label掉所有的MPLS标签,然后再将数据包通过Se2/0口转发出去,下一跳是P2P链路,也就是转发给IOU7:

IOU4#sh mpls forwarding-table 
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop    
Label      Label      or Tunnel Id     Switched      interface              
4000       Pop Label  3.3.3.3/32       0             Et0/3      34.1.1.3    
4001       3000       2.2.2.2/32       0             Et0/3      34.1.1.3    
4002       Pop Label  23.1.1.0/24      0             Et0/3      34.1.1.3    
4003       No Label   l2ckt(17)        87911         Se2/0      point2point 
4004       No Label   l2ckt(56)        1400          Se2/1      point2point 
4005       No Label   l2ckt(89)        1086          Et1/0.9    point2point

数据包最终会以以下这种形式转发给IOU7(不要忘了在IOU4上No Label掉了所有的MPLS标签):

┏━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
┃ ICMP ┃  D : 10.1.1.7  ┃      HDLC      ┃
┃      ┃  S : 10.1.1.1  ┃                ┃
┗━━━━━━┻━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━┛

最后,IOU7收到了这个数据包。

因为IOU1和IOU7连接服务提供商都是用的HDLC封装,那如果两端的客户路由器连接服务提供商所采用的二层封装格式不同呢?

以IOU5和IOU6为例,IOU5连接服务提供商用的是PPP封装,而IOU6连接服务提供商用的是Ethernet封装:

当IOU6(100.1.1.6)去ping IOU5(100.1.1.5)时,IOU2收到的是下面这个数据包:

┏━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
┃ ICMP ┃  D : 100.1.1.5  ┃    Ethernet    ┃
┃      ┃  S : 100.1.1.6  ┃                ┃
┗━━━━━━┻━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━┛

还记得我们曾经在IOU2上配置了一个伪线的类吗?

IOU2(config)#pseudowire-class T56
IOU2(config-pw-class)#encapsulation mpls
IOU2(config-pw-class)#interworking ip

interworking ip的含义就是在伪线里只能传输带有IP三层头部的数据包,所有二层头部将被擦除。也就是说,Ethernet二层头部将会被擦除:

┏━━━━━━┳━━━━━━━━━━━━━━━━━┓
┃ ICMP ┃  D : 100.1.1.5  ┃
┃      ┃  S : 100.1.1.6  ┃
┗━━━━━━┻━━━━━━━━━━━━━━━━━┛

然后,IOU2打上两层MPLS标签,再将数据包转发给IOU3:

┏━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
┃ ICMP ┃  D : 100.1.1.5  ┃  Label : 4004  ┃  Label : 3001  ┃
┃      ┃  S : 100.1.1.6  ┃                ┃                ┃
┗━━━━━━┻━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━┛

IOU3上Pop Label(弹出一层MPLS标签)后,数据包还剩一层MPLS标签,然后转发给IOU4:

┏━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
┃ ICMP ┃  D : 100.1.1.5  ┃  Label : 4004  ┃
┃      ┃  S : 100.1.1.6  ┃                ┃
┗━━━━━━┻━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━┛

数据包到了IOU4上,IOU4查LFIB发现,IOU4需要No Label掉所有的MPLS标签,然后再将数据包通过Se2/1口转发出去,下一跳是P2P链路,也就是转发给IOU5:

IOU4#sh mpls forwarding-table 
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop    
Label      Label      or Tunnel Id     Switched      interface              
4000       Pop Label  3.3.3.3/32       0             Et0/3      34.1.1.3    
4001       3000       2.2.2.2/32       0             Et0/3      34.1.1.3    
4002       Pop Label  23.1.1.0/24      0             Et0/3      34.1.1.3    
4003       No Label   l2ckt(17)        87911         Se2/0      point2point 
4004       No Label   l2ckt(56)        1400          Se2/1      point2point 
4005       No Label   l2ckt(89)        1086          Et1/0.9    point2point

那数据包就会像下面这样转发给IOU5吗?答案是否定的。

┏━━━━━━┳━━━━━━━━━━━━━━━━━┓
┃ ICMP ┃  D : 100.1.1.5  ┃
┃      ┃  S : 100.1.1.6  ┃
┗━━━━━━┻━━━━━━━━━━━━━━━━━┛

因为IOU4和IOU5之间相连的链路采用的是PPP封装,所以IOU4还会打上一个PPP封装的二层头部,然后再将数据包转发给IOU5:

┏━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
┃ ICMP ┃  D : 100.1.1.5  ┃       PPP      ┃
┃      ┃  S : 100.1.1.6  ┃                ┃
┗━━━━━━┻━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━┛

这也就是我在上面所说的:

  • Control Plane:维护PE-PE之间的伪线;
  • Data Plane:完成本地封装与伪线封装的转换

即PE(服务提供商的边界路由器)会通过伪线类中配置的interworking参数转换二层头部。

像IOU8和IOU9之间的伪线,我们配置的interworking参数是ethernet:

IOU2(config)#pseudowire-class T89
IOU2(config-pw-class)#encapsulation mpls
IOU2(config-pw-class)#interworking ethernet

interworking ethernet的含义就是在伪线里只能传输带有Ethernet二层头部的数据包,其他二层头部将会被擦除。

因为IOU8和IOU9之间用的是802.1Q子接口,而802.1Q的封装仅仅只是在Ethernet二层头部上多加了4个字节的802.1Q数据帧,802.1Q的封装还是基于Ethernet二层头部的,所以去除掉那4个字节的802.1Q数据帧后,在伪线里就可以传递Ethernet二层头部了。

当IOU8(200.1.1.8)去ping IOU9(200.1.1.9)时,IOU2收到的是下面这个数据包:

┏━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
┃ ICMP ┃  D : 200.1.1.9  ┃     802.1Q     ┃    Ethernet    ┃
┃      ┃  S : 200.1.1.8  ┃     VID = 8    ┃                ┃
┗━━━━━━┻━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━┛

IOU2在Ethernet二层头部中擦除4个字节的802.1Q数据帧后(原来的Ethernet二层头部还是要保留),再打上两层MPLS标签,然后再将数据包转发给IOU3:

┏━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
┃ ICMP ┃  D : 200.1.1.9  ┃    Ethernet    ┃  Label : 4004  ┃  Label : 3001  ┃
┃      ┃  S : 200.1.1.8  ┃                ┃                ┃                ┃
┗━━━━━━┻━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━┛

数据包在IOU3上Pop Label(弹出一层MPLS标签)后,数据包还剩一层MPLS标签,然后IOU3将数据包转发给IOU4:

┏━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
┃ ICMP ┃  D : 200.1.1.9  ┃    Ethernet    ┃  Label : 4004  ┃
┃      ┃  S : 200.1.1.8  ┃                ┃                ┃
┗━━━━━━┻━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━┛

数据包在IOU4上No Label(弹出所有的MPLS标签)后,IOU4再把4个字节的802.1Q数据帧重新加到数据包中(重新添加802.1Q数据帧这一步不是多余的。因为IOU8连接IOU2的子接口的编号是8,而IOU9连接IOU4的子接口的编号是9,所以802.1Q数据帧是要重新封装到Ethernet二层头部的),然后再把数据包转发给IOU9:

┏━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
┃ ICMP ┃  D : 200.1.1.9  ┃     802.1Q     ┃    Ethernet    ┃
┃      ┃  S : 200.1.1.8  ┃     VID = 9    ┃                ┃
┗━━━━━━┻━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━┛

至此,IOU9就收到从IOU8发过来的ping包了。

如果一端的CE(客户边界路由器)连接服务提供商采用的是Ethernet封装,另一端的CE连接服务提供商采用的是802.1Q子接口封装,那么这里配置的interworking参数也是ethernet。

其他相关文章:

总结:

PE上对本地封装和伪线封装的处理
PE上对本地封装和伪线封装的处理

首先这里需要先说明一下,如果您不知道什么是Like-to-LikeAny-to-Any,请先看一下这篇文章:《L2VPN传统结构

NSP(Native Service Processor,本地服务处理器)会对Like-to-likeAny-to-Any进行不同的伪线封装的处理:

  • Like-to-like:从客户路由器(CE端)接收的数据将会原封不动地转发进伪线;
  • Any-to-Any:从客户路由器(CE端)接收的数据,将擦除伪线规定的数据之外的信息,然后才转发进伪线。

其实这个定义也不是特别严谨,在Like-to-like的环境下,数据包并不是真的原封不动地转发进伪线的,有一个特例:在这个实验中,你会发现IOU8和IOU9也都是相同的802.1Q封装,符合Like-to-like的定义;如果我再把IOU8和IOU9配置成Like-to-like的形式(xconnect x.x.x.x 89 encapsulation mpls),不配置伪线的类。这个时候你会发现在伪线中传输的数据包里,802.1Q数据帧也被擦除了,只保留了Ethernet数据帧,所以并不是真的“原封不动地转发进伪线”。

上述特例中之所以要把802.1Q数据帧擦除掉,我个人觉得这可能是为了解决这个问题:就是两端的客户路由器上,如果802.1Q子接口的编号不一样,那就算把802.1Q数据帧传过去,对端的PE也要重新封装这个802.1Q数据帧,不然就发错子接口了。所以不如就把802.1Q数据帧擦除掉吧。

当然,这只是一个特例,如果两端的客户路由器的封装格式都是Ethernet或者都是HDLC,那数据包确实会原封不动地转发进伪线。

最后,我们对本次实验做个小总结:IOU1和IOU7是Like-to-like;IOU5和IOU6是Any-to-Any;IOU8和IOU9是Any-to-Any(虽然IOU8和IOU9两端的网络类型一致,有点像Like-to-like,但从伪线封装的处理方式和命令配置的方式来看,又是擦除了802.1Q数据帧,又是配置了伪线类,所以在这个实验里我们已经把它们配置成了Any-to-Any)。

测试各条伪线的连通性:

我们还可以使用ping mpls pseudowire 4.4.4.4 xx source 2.2.2.2命令在IOU2上测试各条伪线的连通性:

IOU2#ping mpls pseudowire 4.4.4.4 17 source 2.2.2.2     // 17表示VC ID
Sending 5, 100-byte MPLS Echos to 4.4.4.4, 
     timeout is 2 seconds, send interval is 0 msec:

Codes: '!' - success, 'Q' - request not sent, '.' - timeout,
  'L' - labeled output interface, 'B' - unlabeled output interface, 
  'D' - DS Map mismatch, 'F' - no FEC mapping, 'f' - FEC mismatch,
  'M' - malformed request, 'm' - unsupported tlvs, 'N' - no label entry, 
  'P' - no rx intf label prot, 'p' - premature termination of LSP, 
  'R' - transit router, 'I' - unknown upstream index,
  'X' - unknown return code, 'x' - return code 0

Type escape sequence to abort.
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/101/122 ms

IOU2#ping mpls pseudowire 4.4.4.4 56 source 2.2.2.2
Sending 5, 100-byte MPLS Echos to 4.4.4.4, 
     timeout is 2 seconds, send interval is 0 msec:

Codes: '!' - success, 'Q' - request not sent, '.' - timeout,
  'L' - labeled output interface, 'B' - unlabeled output interface, 
  'D' - DS Map mismatch, 'F' - no FEC mapping, 'f' - FEC mismatch,
  'M' - malformed request, 'm' - unsupported tlvs, 'N' - no label entry, 
  'P' - no rx intf label prot, 'p' - premature termination of LSP, 
  'R' - transit router, 'I' - unknown upstream index,
  'X' - unknown return code, 'x' - return code 0

Type escape sequence to abort.
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 58/109/128 ms

IOU2#ping mpls pseudowire 4.4.4.4 89 source 2.2.2.2
Sending 5, 100-byte MPLS Echos to 4.4.4.4, 
     timeout is 2 seconds, send interval is 0 msec:

Codes: '!' - success, 'Q' - request not sent, '.' - timeout,
  'L' - labeled output interface, 'B' - unlabeled output interface, 
  'D' - DS Map mismatch, 'F' - no FEC mapping, 'f' - FEC mismatch,
  'M' - malformed request, 'm' - unsupported tlvs, 'N' - no label entry, 
  'P' - no rx intf label prot, 'p' - premature termination of LSP, 
  'R' - transit router, 'I' - unknown upstream index,
  'X' - unknown return code, 'x' - return code 0

Type escape sequence to abort.
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 70/113/127 ms

 

其他相关文章:

本文完。如有疑问,欢迎在下方留言;如本文有什么错误,欢迎在下方留言指正,谢谢。

这篇文章对你有帮助吗?

相关文章

5条评论

  1. 今天(2016年11月8日18:18:56)对本文进行了修改,IOU1和IOU7之间是通过HDLC封装连接的服务提供商(SP),而不是之前所描述的通过IP封装,特此更正。

  2. 文章末尾提到:“Like-to-like:从客户路由器(CE端)接收的数据将会原封不动地转发进伪线”。

    其实这里也不是特别严谨,在Like-to-like的环境下,数据包并不是真的原封不动地转发进伪线的,今天(2016年11月12日1:00:26)我发现一个特例:在这个实验中,你会发现IOU8和IOU9也都是相同的802.1Q封装,符合Like-to-like的定义;如果我再把IOU8和IOU9配置成Like-to-like的形式(xconnect x.x.x.x 89 encapsulation mpls),不配置伪线的类。这个时候你会发现在伪线中传输的数据包里,802.1Q数据帧也被擦除了,只保留了Ethernet数据帧,所以并不是真的“原封不动地转发进伪线”。

    上述特例中之所以要把802.1Q数据帧擦除掉,我个人觉得这可能是为了解决这个问题:就是两端的客户路由器上,如果802.1Q子接口的编号不一样,那就算把802.1Q数据帧传过去,对端的PE也要重新封装这个802.1Q数据帧,不然就发错子接口了。所以不如就把802.1Q数据帧擦除掉吧。

    当然,这只是一个特例,如果两端的客户路由器的封装格式都是Ethernet或者都是HDLC,那数据包确实会原封不动地转发进伪线。

  3. 今天(2016年11月23日19:26:05)在这篇文章的 “用一些show命令看一下该实验” 这个部分里添加了一些内容,并更正了一些错误。

    主要添加的内容是关于命令show mpls l2transport binding的,还有两幅图示。

    1. 模拟器软件用的是 GNS3 1.5.2 。但这里用的不是 IOS ,是 IOU ,IOU 的版本跟 GNS3 是一致的,也是 1.5.2 。

Ricky 发表评论 取消回复

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