MPLS(Multiprotocol Label Switching)位于TCP/IP协议栈中的链路层和网络层之间,用于向IP层提供连接服务,同时又从链路层得到服务。MPLS以标签交换替代IP转发。
MPLS网络基于标签(Label)进行转发,标签封装在链路层和网络层之间。这样,标签能够被任意的链路层所支持。标签在分组中的封装位置如下图1所示。
图1 MPLS报文格式
MPLS标签是一个短而定长的、只具有本地意义的标识符,用于唯一标识一个分组所属的FEC(Forwarding Equivalence Class,转发等价类)。
在某些情况下,例如要进行负载分担,对应一个FEC可能会有多个入标签,但是一台路由器上,一个标签只能代表一个FEC。标签与ATM的VPI/VCI以及Frame Relay的DLCI类似,是一种连接标识符。标签长度为4个字节,如下图2所示。
二、MPLS报文格式
+0---------------7
| Label value |
+----------------|
| EXP |
+----------------|
| S |
+----------------|
| TTL |
+----------------|
图2 MPLS标签格式
三、MPLS报文示例
Frame 2: 128 bytes on wire (1024 bits), 128 bytes captured (1024 bits)
Arrival Time: Apr 28, 2005 19:34:01.087482000
Epoch Time: 1114688041.087482000 seconds
[Time delta from previous captured frame: 0.005004001 seconds]
[Time delta from previous displayed frame: 0.005004001 seconds]
[Time since reference or first frame: 0.005004001 seconds]
Frame Number: 2
Frame Length: 128 bytes (1024 bits)
Capture Length: 128 bytes (1024 bits)
[Frame is marked: False]
[Frame is ignored: False]
[Protocols in frame: eth:mpls:pwethheuristic:pwethnocw:eth:ip:icmp:data]
[Coloring Rule Name: ICMP]
[Coloring Rule String: icmp || icmpv6]
Ethernet II (VLAN tagged), Src: HuaweiTe_48:90:4e (00:e0:fc:48:90:4e), Dst: HuaweiTe_29:4a:a2 (00:e0:fc:29:4a:a2)
Destination: HuaweiTe_29:4a:a2 (00:e0:fc:29:4a:a2)
Address: HuaweiTe_29:4a:a2 (00:e0:fc:29:4a:a2)
.... ...0 .... .... .... .... = IG bit: Individual address (unicast)
.... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
Source: HuaweiTe_48:90:4e (00:e0:fc:48:90:4e)
Address: HuaweiTe_48:90:4e (00:e0:fc:48:90:4e)
.... ...0 .... .... .... .... = IG bit: Individual address (unicast)
.... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
VLAN tag: VLAN=1, Priority=Excellent Effort
Identifier: 802.1Q Virtual LAN (0x8100)
011. .... .... .... = Priority: Excellent Effort (3)
...0 .... .... .... = CFI: Canonical (0)
.... 0000 0000 0001 = VLAN: 1
Type: MPLS label switched packet (0x8847)
MultiProtocol Label Switching Header, Label: 1024, Exp: 6, S: 0, TTL: 254
MPLS Label: 1024
MPLS Experimental Bits: 6
MPLS Bottom Of Label Stack: 0
MPLS TTL: 254
MultiProtocol Label Switching Header, Label: 102418, Exp: 0, S: 1, TTL: 254
MPLS Label: 102418
MPLS Experimental Bits: 0
MPLS Bottom Of Label Stack: 1
MPLS TTL: 254
Ethernet II (VLAN tagged), Src: HuaweiTe_58:e9:2e (00:e0:fc:58:e9:2e), Dst: HuaweiTe_56:eb:20 (00:e0:fc:56:eb:20)
Destination: HuaweiTe_56:eb:20 (00:e0:fc:56:eb:20)
Address: HuaweiTe_56:eb:20 (00:e0:fc:56:eb:20)
.... ...0 .... .... .... .... = IG bit: Individual address (unicast)
.... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
Source: HuaweiTe_58:e9:2e (00:e0:fc:58:e9:2e)
Address: HuaweiTe_58:e9:2e (00:e0:fc:58:e9:2e)
.... ...0 .... .... .... .... = IG bit: Individual address (unicast)
.... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
VLAN tag: VLAN=8, Priority=Best Effort (default)
Identifier: 802.1Q Virtual LAN (0x8100)
000. .... .... .... = Priority: Best Effort (default) (0)
...0 .... .... .... = CFI: Canonical (0)
.... 0000 0000 1000 = VLAN: 8
Type: IP (0x0800)
Internet Protocol Version 4, Src: 10.0.0.1 (10.0.0.1), Dst: 10.0.0.2 (10.0.0.2)
Version: 4
Header length: 20 bytes
Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00: Not-ECT (Not ECN-Capable Transport))
0000 00.. = Differentiated Services Codepoint: Default (0x00)
.... ..00 = Explicit Congestion Notification: Not-ECT (Not ECN-Capable Transport) (0x00)
Total Length: 84
Identification: 0x0012 (18)
Flags: 0x00
0... .... = Reserved bit: Not set
.0.. .... = Don't fragment: Not set
..0. .... = More fragments: Not set
Fragment offset: 0
Time to live: 255
Protocol: ICMP (1)
Header checksum: 0xab94 [correct]
[Good: True]
[Bad: False]
Source: 10.0.0.1 (10.0.0.1)
Destination: 10.0.0.2 (10.0.0.2)
图3 MPLS报文(含2层标签)
四、MPLS协议栈结构
MPLS消息封装在链路层和网络层之间,用于向IP层提供连接服务,同时又从链路层得到服务。MPLS在二层的类型标识为:Type=MPLS label switched packet (0x8847)。
+-------------------------------+
| IP Header |
+-------------------------------+
| L2 |
+-------------------------------+
| (One or more MPLS labels) |
+ +
| MPLS Label stack |
+-------------------------------+
| L2 |
+-------------------------------+
| L1 |
+-------------------------------+
图4 MPLS L2VPN协议栈结构
+-------------------------------+
| IP Header |
+-------------------------------+
| (One or more MPLS labels) |
+ +
| MPLS Label stack |
+-------------------------------+
| L2 |
+-------------------------------+
| L1 |
+-------------------------------+
图5 MPLS L3VPN协议栈结构
发表评论