【实验】域间MPLS L2VPN实验 —— Inter-AS option A/option 1(Back to Back)

实验环境:

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

【实验】MPLS L2VPN下,Inter-AS option A/option 1(back to back)
【实验】MPLS L2VPN下,Inter-AS option A/option 1(back to back)

实验需求:

  • IOU1、IOU2和IOU3是一个互联网服务提供商(ISP),IOU4、IOU5和IOU6是另一个互联网服务提供商(ISP);
  • IOU7和IOU8分别通过802.1Q封装连接各自的互联网服务提供商(ISP),IOU7和IOU8之间要实现MPLS L2VPN通信;
  • IOU9通过PPP封装连接自己的互联网服务提供商(ISP),IOU10通过Ethernet封装连接自己的互联网服务提供商(ISP),IOU9和IOU10之间要实现MPLS L2VPN通信;
  • IOU3和IOU4之间(两个互联网服务提供商的边界)通过option A/option 1(Back to Back)的方式进行MPLS L2VPN的互连。

实验步骤:

1、先配置两个互联网服务提供商(ISP)上的IP地址、IGP(OSPF)和MPLS:

IOU1:

conf t
int l 0
ip add 1.1.1.1 255.255.255.255

int e 0/2
ip add 12.1.1.1 255.255.255.0
no sh

router ospf 123
router-id 1.1.1.1

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

ip cef
mpls ip
mpls label pro ldp
mpls ldp ro l 0 fo
mpls label range 1000 1999

int e 0/2
mpls ip

IOU2:

conf t
int l 0
ip add 2.2.2.2 255.255.255.255

int e 0/2
ip add 12.1.1.2 255.255.255.0
no sh

int e 0/3
ip add 23.1.1.2 255.255.255.0
no sh

router ospf 123
router-id 2.2.2.2

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

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

int r e 0/2-3
mpls ip

IOU3:

conf t
int l 0
ip add 3.3.3.3 255.255.255.255

int e 0/3
ip add 23.1.1.3 255.255.255.0
no sh

router ospf 123
router-id 3.3.3.3

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

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

int e 0/3
mpls ip

IOU4:

conf t
int l 0
ip add 4.4.4.4 255.255.255.255

int e 0/2
ip add 45.1.1.4 255.255.255.0
no sh

router ospf 456
router-id 4.4.4.4

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

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

int e 0/2
mpls ip

IOU5:

conf t
int l 0
ip add 5.5.5.5 255.255.255.255

int e 0/2
ip add 45.1.1.5 255.255.255.0
no sh

int e 0/3
ip add 56.1.1.5 255.255.255.0
no sh

router ospf 456
router-id 5.5.5.5

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

ip cef
mpls ip
mpls label pro ldp
mpls ldp ro l 0 fo
mpls label range 5000 5999

int r e 0/2-3
mpls ip

IOU6:

conf t
int l 0
ip add 6.6.6.6 255.255.255.255

int e 0/3
ip add 56.1.1.6 255.255.255.0
no sh

router ospf 456
router-id 6.6.6.6

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

ip cef
mpls ip
mpls label pro ldp
mpls ldp ro l 0 fo
mpls label range 6000 6999

int e 0/3
mpls ip

2、再配置IOU7、IOU8、IOU9和IOU10上的IP地址:

IOU7:

conf t
int e 0/0
no sh
int e 0/0.78
en do 78
ip add 78.1.1.7 255.255.255.0

IOU8:

conf t
int e 0/0
no sh
int e 0/0.78
en do 78
ip add 78.1.1.8 255.255.255.0

IOU9:

conf t
int s 2/0
en ppp
ip add 10.9.1.9 255.255.255.0
no sh

IOU10:

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

3、在IOU1上配置IOU7和IOU9的MPLS L2VPN连接:

IOU1:

int e 0/0
no sh
int e 0/0.78
en do 78
xconnect 3.3.3.3 78 en mpls

pseudowire-class T910
 encapsulation mpls
 interworking ip

int s 2/0
en ppp
xconnect 3.3.3.3 910 pw-class T910
no sh

4、在IOU6上配置IOU8和IOU10的MPLS L2VPN连接:

IOU6:

int e 0/0
no sh
int e 0/0.78
en do 78
xconnect 4.4.4.4 78 en mpls

pseudowire-class T910
 encapsulation mpls
 interworking ip

int e 0/1
no sh
xconnect 4.4.4.4 910 pw-class T910

5、配置在IOU3和IOU4上的MPLS L2VPN的域间option A/option 1连接,即back to back(背靠背方式):

所谓back to back(背靠背方式)的意思就是让IOU3把IOU4当做自己的客户路由器,让IOU4把IOU3当做自己的客户路由器。

IOU3:

int e 0/0
no sh
int e 0/0.78
en do 78
xconnect 1.1.1.1 78 en mpls

pseudowire-class T910
encapsulation mpls
interworking ip

int e 0/0.910
en do 910
xconnect 1.1.1.1 910 pw-class T910

IOU4:

int e 0/0
no sh
int e 0/0.78
en do 78
xconnect 6.6.6.6 78 en mpls

pseudowire-class T910
encapsulation mpls
interworking ip

int e 0/0.910
en do 910
xconnect 6.6.6.6 910 pw-class T910

测试:

【实验】MPLS L2VPN下,Inter-AS option A/option 1(back to back)
【实验】MPLS L2VPN下,Inter-AS option A/option 1(back to back)

back to back(背靠背)的方式还是很简单的,现在我们来测试一下IOU7和IOU8之间的连通性:

IOU7#p 78.1.1.8                      // 如果通不了就稍等一下,可能MPLS标签还没有分配好
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 78.1.1.8, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 2/2/3 ms

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

通了!通过traceroute可以看到,IOU7以为它跟IOU8是直连的。

我们再来测试一下IOU9和IOU10之间的连通性:

IOU9#p 10.9.1.10
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.9.1.10, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)

呃,没通,看了一下接口,协议down了,这很有可能是模拟器的问题:

IOU9#sh int s 2/0
Serial2/0 is up, line protocol is down 
  Hardware is M4T
  Internet address is 10.9.1.9/24
  MTU 1500 bytes, BW 1544 Kbit/sec, DLY 20000 usec, 
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation PPP, LCP ACKsent, crc 16, loopback not set
  Keepalive set (10 sec)
......

测试一下910这条伪线,发现910这条伪线有点问题,请求发不出去,可能是对端的路由器没有给IOU1和IOU4发MPLS标签:

IOU1#ping mpls pseudowire 3.3.3.3 910
Sending 5, 100-byte MPLS Echos to 3.3.3.3, 
     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.
QQQQQ
Success rate is 0 percent (0/5)

IOU4#ping mpls pseudowire 6.6.6.6 910 
Sending 5, 100-byte MPLS Echos to 6.6.6.6, 
     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.
QQQQQ
Success rate is 0 percent (0/5)

78那条伪线是OK的:

IOU1#ping mpls pseudowire 3.3.3.3 78 
Sending 5, 100-byte MPLS Echos to 3.3.3.3, 
     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 = 34/100/118 ms

IOU4#ping mpls pseudowire 6.6.6.6 78  
Sending 5, 100-byte MPLS Echos to 6.6.6.6, 
     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 = 11/106/132 ms

在IOU1上show mpls l2transport binding可以看到,910这条伪线确实没有远程MPLS标签,也就是说IOU3没有给IOU1发(IOU4上也是没有远程MPLS标签):

IOU1#sh mpls l2transport binding     
  Destination Address: 3.3.3.3,VC ID: 78
    Local Label:  1002
        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: 3003
        Cbit: 1,    VC Type: Ethernet,    GroupID: 0
        MTU: 1500,   Interface Desc: n/a
        VCCV: CC Type: CW [1], RA [2]
              CV Type: LSPV [2]
  Destination Address: 3.3.3.3,VC ID: 910
    Local Label:  1003
        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: unassigned

IOU4#sh mpls l2transport binding 
  Destination Address: 6.6.6.6,VC ID: 78
    Local Label:  4003
        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: 6000
        Cbit: 1,    VC Type: Ethernet,    GroupID: 0
        MTU: 1500,   Interface Desc: n/a
        VCCV: CC Type: CW [1], RA [2]
              CV Type: LSPV [2]
  Destination Address: 6.6.6.6,VC ID: 910
    Local 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]
    Remote Label: unassigned

然鹅!见证奇迹的时刻到了!在IOU6上show mpls l2transport binding,会发现IOU6是给910伪线分配了MPLS标签的。你再回IOU4上面看,你将会发现IOU4也有MPLS标签了= =:

IOU6#sh mpls l2transport binding 
  Destination Address: 4.4.4.4,VC ID: 78
    Local Label:  6000
        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: 4003
        Cbit: 1,    VC Type: Ethernet,    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: 910
    Local Label:  6004
        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]

IOU4#sh mpls l2transport binding 
  Destination Address: 6.6.6.6,VC ID: 78
    Local Label:  4003
        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: 6000
        Cbit: 1,    VC Type: Ethernet,    GroupID: 0
        MTU: 1500,   Interface Desc: n/a
        VCCV: CC Type: CW [1], RA [2]
              CV Type: LSPV [2]
  Destination Address: 6.6.6.6,VC ID: 910
    Local 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]
    Remote Label: 6004
        Cbit: 1,    VC Type: IP,    GroupID: 0
        MTU: 1500,   Interface Desc: n/a
        VCCV: CC Type: CW [1], RA [2]
              CV Type: LSPV [2]

不仅如此,IOU1上也突然有910伪线的远程MPLS标签了(如果IOU1上还没有MPLS标签就稍等一下,可能是MPLS标签还没有传过来,等一会儿就好了;或者去IOU3上show mpls l2transport binding看看):

IOU1#sh mpls l2transport binding
  Destination Address: 3.3.3.3,VC ID: 78
    Local Label:  1002
        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: 3003
        Cbit: 1,    VC Type: Ethernet,    GroupID: 0
        MTU: 1500,   Interface Desc: n/a
        VCCV: CC Type: CW [1], RA [2]
              CV Type: LSPV [2]
  Destination Address: 3.3.3.3,VC ID: 910
    Local Label:  1003
        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: 3004
        Cbit: 1,    VC Type: IP,    GroupID: 0
        MTU: 1500,   Interface Desc: n/a
        VCCV: CC Type: CW [1], RA [2]
              CV Type: LSPV [2]

这里总结一下这个bug:这个实验我做了很多遍,我发现只要在一个PE(IOU1/3/4/6)上show mpls l2transport binding,这个PE就会给对端的PE发910伪线的MPLS标签。比如,现在在IOU1上show mpls l2transport binding,IOU1就会给IOU3发910伪线的MPLS标签;在IOU6上show mpls l2transport binding,IOU6就会给IOU4发910伪线的MPLS标签。

所以!如果你发现IOU9和IOU10之间ping不通,你干脆就在所有的PE(IOU1/3/4/6)上show mpls l2transport binding,这样就没问题了!!

如下图所示,我用的IOU的版本号是15.4(1)T,如果用15.5或更高版本的IOU不知道会不会出现这个问题:

IOU1#sh version 
Cisco IOS Software, Linux Software (I86BI_LINUX-ADVENTERPRISEK9-M),
Version 15.4(1)T, DEVELOPMENT TEST SOFTWARE
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2013 by Cisco Systems, Inc.
Compiled Sat 23-Nov-13 03:28 by prod_rel_team

ROM: Bootstrap program is Linux

IOU1 uptime is 8 minutes
System returned to ROM by reload at 0
System image file is "unix:/opt/gns3/images/IOU/i86bi_linux-adventerprisek9-ms.
154-1.T_Ant"
Last reload reason: Unknown reason



This product contains cryptographic features and is subject to United
States and local country laws governing import, export, transfer and
use. Delivery of Cisco cryptographic products does not imply
third-party authority to import, export, distribute or use encryption.
Importers, exporters, distributors and users are responsible for
compliance with U.S. and local country laws. By using this product you
agree to comply with applicable laws and regulations. If you are unable
to comply with U.S. and local laws, return this product immediately.

A summary of U.S. laws governing Cisco cryptographic products may be found at:
http://www.cisco.com/wwl/export/crypto/tool/stqrg.html

If you require further assistance please contact us by sending email to
export@cisco.com.

Linux Unix (Intel-x86) processor with 367096K bytes of memory.
Processor board ID 2048003
8 Ethernet interfaces
8 Serial interfaces
256K bytes of NVRAM.



Configuration register is 0x0

我们再来测试一下IOU9和IOU10之间的连通性:

IOU9#p 10.9.1.10 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.9.1.10, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)

IOU9#p 10.9.1.10
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.9.1.10, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)

ping了两次还是没有通,不过没关系!去IOU10上ping一下就通了:

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

回IOU9再ping一下也通了:

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

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

而且通过traceroute可以看到,IOU9以为它跟IOU10是直连的。

总而言之,这很有可能是IOU自带的bug,实验最终是做成功了。如果有知道这是为什么的朋友可以在下方留言,大家相互交流一下。

数据包的报头结构追踪:

【实验】MPLS L2VPN下,Inter-AS option A/option 1(back to back)
【实验】MPLS L2VPN下,Inter-AS option A/option 1(back to back)

我们先追踪IOU7和IOU8之间的数据包,Ricky会在IOU1的e 0/0口IOU1的e 0/2口IOU4的e 0/0口IOU6的e 0/3口IOU6的e 0/0口用Wireshark抓取数据包,然后在IOU7上ping 78.1.1.8。

注意:接着往下看Wireshark的截图前,我建议您实验拓扑和Wireshark的截图对照着看,不然您会晕的。比如:先把上面的实验拓扑保存到电脑里一份,然后在电脑上打开实验拓扑,实验拓扑和Wireshark的截图对照着看。

其他相关文章:

  • 如果您想了解MPLS L2VPN环境下,两层MPLS标签具体是如何变化的,请看:《【实验】MPLS L2VPN下,Point-to-Point的AToM实验》,您现在正在看的这篇文章不会描述得那么详细了,仅仅只是截图后简单地看一下现象。
  • 如果您想了解MPLS L2VPN环境下,数据包的报头具体都有哪些,数据包的MTU大小又是如何变化的,请看:《【实验】关于MPLS L2VPN MTU的实验》,您现在正在看的这篇文章也不会描述得那么详细了。

1、在IOU7上ping 78.1.1.8时,IOU1的e 0/0口上的抓包:

IOU7上ping 78.1.1.8,IOU1的e 0/0口上的抓包
IOU7上ping 78.1.1.8,IOU1的e 0/0口上的抓包

如上图所示,这是IOU7给IOU1发送的数据包的报头结构。如果要画个简图的话,是如下这个样子的:

| FCS | ICMP | IP | 802.1Q | Ethernet |

2、在IOU7上ping 78.1.1.8时,IOU1的e 0/2口上的抓包:

IOU7上ping 78.1.1.8,IOU1的e 0/2口上的抓包
IOU7上ping 78.1.1.8,IOU1的e 0/2口上的抓包

如上图所示,这是IOU1给IOU2发送的数据包的报头结构。IOU1会抹去802.1Q数据帧,同时打上两层MPLS标签和一个伪线控制字段,再打上最外层的Ethernet二层头部(因为IOU1/2/3/4/5/6之间的链路都是Ethernet,所以在这之间传递的数据包总会有一个最外层的Ethernet二层头部,关于最外层的这一层Ethernet二层头部下面不再赘述),然后将数据包发送给IOU2。如果要画个简图的话,是如下这个样子的:

| FCS | ICMP | IP | Ethernet | 伪线控制字段 | 内层MPLS标签 | 外层MPLS标签 | Eth |

IOU2收到这个数据包后,会Pop Label(弹出一层MPLS标签),然后将数据包转发给IOU3。如果在IOU2和IOU3之间的链路上抓取数据包,数据包的报头结构应该是这样的:

| FCS | ICMP | IP | Ethernet | 伪线控制字段 | 内层MPLS标签 | Ethernet |

3、在IOU7上ping 78.1.1.8时,IOU4的e 0/0口上的抓包:

IOU7上ping 78.1.1.8,IOU4的e 0/0口上的抓包
IOU7上ping 78.1.1.8,IOU4的e 0/0口上的抓包

如上图所示,这是IOU3给IOU4发送的数据包的报头结构。因为IOU3会把IOU4当做自己的客户路由器(背靠背方式),所以IOU3收到这个数据包后,会剥离最外层的Ethernet二层头部,No Label(弹出所有MPLS标签),删除伪线控制字段,然后重新打上802.1Q数据帧,再转发给IOU4。如果要画个简图的话,是如下这个样子的:

| FCS | ICMP | IP | 802.1Q | Ethernet |

IOU4收到这个数据包后,IOU4会抹去802.1Q数据帧,同时打上两层MPLS标签和一个伪线控制字段,再打上最外层的Ethernet二层头部,然后将数据包发送给IOU5。如果在IOU4和IOU5之间的链路上抓取数据包,数据包的报头结构应该是这样的:

| FCS | ICMP | IP | Ethernet | 伪线控制字段 | 内层MPLS标签 | 外层MPLS标签 | Eth |

4、在IOU7上ping 78.1.1.8时,IOU6的e 0/3口上的抓包:

IOU7上ping 78.1.1.8,IOU6的e 0/3口上的抓包
IOU7上ping 78.1.1.8,IOU6的e 0/3口上的抓包

如上图所示,IOU5收到这个数据包后,会Pop Label(弹出一层MPLS标签),然后将数据包转发给IOU6。如果要画个简图的话,是如下这个样子的:

| FCS | ICMP | IP | Ethernet | 伪线控制字段 | 内层MPLS标签 | Ethernet |

5、在IOU7上ping 78.1.1.8时,IOU6的e 0/0口上的抓包:

IOU7上ping 78.1.1.8,IOU6的e 0/0口上的抓包
IOU7上ping 78.1.1.8,IOU6的e 0/0口上的抓包

如上图所示,这是IOU6给IOU8发送的数据包的报头结构。因为IOU8是IOU6的客户路由器,所以IOU6收到这个数据包后,会剥离最外层的Ethernet二层头部,No Label(弹出所有MPLS标签),删除伪线控制字段,然后重新打上802.1Q数据帧,再转发给IOU8。如果要画个简图的话,是如下这个样子的:

| FCS | ICMP | IP | 802.1Q | Ethernet |

这样,数据包就转发到目的地了。

为什么802.1Q数据帧删去后又打了回来?

回答:这个实验环境看得还不是很明显,因为在这个实验环境下,78伪线上的802.1Q子接口的编号都是78。

如果IOU1和IOU7之间的子接口编号修改为7,IOU3和IOU4之间的子接口编号修改为78,IOU6和IOU8之间的子接口编号修改为8。那么这个时候802.1Q数据帧就需要在相应的路由器上进行重新封装了。因为不同链路上的子接口编号不同,所以数据包在经过不同链路的子接口时,802.1Q数据帧里携带的VLAN ID的值就需要做相应的修改,这样数据包才能正确地发送过去。

当然啦,当数据包从IOU1传递到IOU3和从IOU4传递到IOU6时,均没有经过子接口,自然也就不需要802.1Q数据帧了。

【实验】MPLS L2VPN下,Inter-AS option A/option 1(back to back)
【实验】MPLS L2VPN下,Inter-AS option A/option 1(back to back)

接下来,我们追踪IOU9和IOU10之间的数据包,Ricky会在IOU1的s 2/0口IOU1的e 0/2口IOU4的e 0/0口IOU6的e 0/3口IOU6的e 0/1口用Wireshark抓取数据包,然后在IOU9上ping 10.9.1.10。

1、在IOU9上ping 10.9.1.10时,IOU1的s 2/0口上的抓包:

在IOU9上ping 10.9.1.10时,IOU1的s 2/0口上的抓包
在IOU9上ping 10.9.1.10时,IOU1的s 2/0口上的抓包

如上图所示,这是IOU9给IOU1发送的数据包的报头结构。如果要画个简图的话,是如下这个样子的:

| FCS | ICMP | IP | PPP |

2、在IOU9上ping 10.9.1.10时,IOU1的e 0/2口上的抓包:

在IOU9上ping 10.9.1.10时,IOU1的e 0/2口上的抓包
在IOU9上ping 10.9.1.10时,IOU1的e 0/2口上的抓包

如上图所示,这是IOU1给IOU2发送的数据包的报头结构。IOU1会抹去PPP二层头部(因为在IOU1上,910这条伪线配置了参数:interworking ip,interworking ip的意思是除了IP三层头部以外,其他二层头部都要被抹去),同时打上两层MPLS标签和一个伪线控制字段,再打上最外层的Ethernet二层头部,然后将数据包发送给IOU2。如果要画个简图的话,是如下这个样子的:

| FCS | ICMP | IP | 伪线控制字段 | 内层MPLS标签 | 外层MPLS标签 | Ethernet |

这里需要注意的是,Wireshark把这个数据包识别错了,最内层不是Ethernet和Data,而是IP和ICMP。

通过上面的截图我们可以知道,“Ethernet二层头部”(其实是IP头部)是以45 00 00 64 00 0a开始的。

如下图所示,这是这个ping包刚从IOU9发给IOU1时的样子(就是上上一个截图)。你会发现,下面这个数据包的IP头部也是以45 00 00 64 00 0a开始的,而且后面的字节也都一样。所以这里可以判断,上面那个截图中,Wireshark错把最内层的IP和ICMP识别成了Ethernet和Data。

在IOU9上ping 10.9.1.10时,IOU1的s 2/0口上的抓包
在IOU9上ping 10.9.1.10时,IOU1的s 2/0口上的抓包

IOU2收到这个数据包后,会Pop Label(弹出一层MPLS标签),然后将数据包转发给IOU3。如果在IOU2和IOU3之间的链路上抓取数据包,数据包的报头结构应该是这样的:

| FCS | ICMP | IP | 伪线控制字段 | 内层MPLS标签 | Ethernet |

3、在IOU9上ping 10.9.1.10时,IOU4的e 0/0口上的抓包:

在IOU9上ping 10.9.1.10时,IOU4的e 0/0口上的抓包
在IOU9上ping 10.9.1.10时,IOU4的e 0/0口上的抓包

如上图所示,这是IOU3给IOU4发送的数据包的报头结构。因为IOU3会把IOU4当做自己的客户路由器(背靠背方式),所以IOU3收到这个数据包后,会剥离最外层的Ethernet二层头部,No Label(弹出所有MPLS标签),删除伪线控制字段,然后打上802.1Q数据帧(这里之所以打上了802.1Q数据帧,是因为关于910这条伪线,在IOU3和IOU4之间是通过802.1Q子接口进行连接的)和最外层的Ethernet二层头部,再转发给IOU4。如果要画个简图的话,是如下这个样子的:

| FCS | ICMP | IP | 802.1Q | Ethernet |

IOU4收到这个数据包后,IOU4会抹去最外层的Ethernet二层头部和802.1Q数据帧(因为在IOU4上,910这条伪线配置了参数:interworking ip,interworking ip的意思是除了IP三层头部以外,其他二层头部都要被抹去),同时打上两层MPLS标签和一个伪线控制字段,再打上最外层的Ethernet二层头部,然后将数据包发送给IOU5。如果在IOU4和IOU5之间的链路上抓取数据包,数据包的报头结构应该是这样的:

| FCS | ICMP | IP | 伪线控制字段 | 内层MPLS标签 | 外层MPLS标签 | Ethernet |

4、在IOU9上ping 10.9.1.10时,IOU6的e 0/3口上的抓包:

在IOU9上ping 10.9.1.10时,IOU6的e 0/3口上的抓包
在IOU9上ping 10.9.1.10时,IOU6的e 0/3口上的抓包

如上图所示,IOU5收到这个数据包后,会Pop Label(弹出一层MPLS标签),然后将数据包转发给IOU6。如果要画个简图的话,是如下这个样子的:

| FCS | ICMP | IP | 伪线控制字段 | 内层MPLS标签 | Ethernet |

同样,Wireshark在这里也把这个数据包识别错了,最内层不是Ethernet和Data,而是IP和ICMP。

细心的朋友可能会发现,上面数据包的“Ethernet二层头部”(其实是IP头部)是以45 00 00 64 00 19开始的。而上上一个截图中IP头部却是以45 00 00 64 00 0a开始的,下面的截图中IP头部又是以45 00 00 64 00 1e开始的,怎么都不一样?

其实这些截图我都不是一次性截完的,ping了很多次,也分了好多次去截。因为IPv4报头中第五和第六个字节所代表的含义是Identifier(标识符),所以你看到的00 1900 0a00 1e代表的都是Identifier(标识符)。不同的数据包中,Identifier(标识符)确实是会不同的。如果您不了解IPv4的报文结构,请看:《IPv4和IPv6报头格式说明》。

45 00 00 64 00前面这一段你也能看出它是IP报头,你也能在IP报头中找到相应的源IP地址(0a 09 01 09)和目的IP地址(0a 09 01 0a),所以这里的描述是没有错的,Wireshark确实是识别错了。而且你还可以仔细观察一下,IOU的MAC地址都是以aa bb cc开始的,如果是Ethernet报头的话,并没有看到aa bb cc这样的MAC地址。

5、在IOU9上ping 10.9.1.10时,IOU6的e 0/1口上的抓包:

在IOU9上ping 10.9.1.10时,IOU6的e 0/1口上的抓包
在IOU9上ping 10.9.1.10时,IOU6的e 0/1口上的抓包

如上图所示,这是IOU6给IOU10发送的数据包的报头结构。因为IOU10是IOU6的客户路由器,所以IOU6收到这个数据包后,会剥离最外层的Ethernet二层头部,No Label(弹出所有MPLS标签),删除伪线控制字段,然后重新打上Ethernet二层头部(这里之所以打上了Ethernet二层头部,是因为在IOU6和IOU10之间的网络类型就是Ethernet),再转发给IOU10。如果要画个简图的话,是如下这个样子的:

| FCS | ICMP | IP | Ethernet |

这样,数据包就转发到目的地了。

 

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

 

其他相关文章:

这篇文章对你有帮助吗?

相关文章

发表评论?

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