多协议标签交换
MPLS位于TCP/IP协议栈中的数据链路层和网络层之间,可以向所有网络层提供服务。
通过在数据链路层和网络层之间增加额外的MPLS头部,基于MPLS头部实现数据快速转发。

术语
- MPLS域(MPLS Domain):一系列连续的运行MPLS的网络设备构成了一个MPLS域。
- LSR(Label Switching Router,标签交换路由器):支持MPLS的路由器(实际上也指支持MPLS的交换机或其他网络设备)。位于MPLS域边缘、连接其它网络的LSR称为边沿路由器LER(Label Edge Router),区域内部的LSR称为核心LSR(Core LSR)。
数据处理方式
- 入站LSR(Ingress LSR):通常是向IP报文中压入MPLS头部并生成MPLS报文的LSR。push
- 中转LSR(Transit LSR):通常是将MPLS报文进行例如标签置换操作,并将报文继续在MPLS域中转发的LSR。
- 出站LSR(Egress LSR):通常是将MPLS报文中MPLS头部移除,还原为IP报文的LSR。pop
FEC 转发等价类
为哪一类东西去分标签,默认是32位的主机路由
LSP,标签交换路径
标签报文穿越MPLS网络到达目的地所走的路径。
栈与队列
MPLS支持一层或多层标签头部,这些标签头部的有序集合被称为标签栈(Label Stack)。

- 栈:先进后出;队列:先进先出
- 栈底位为1,表示后面没有mpls标签,为0则说明后面还有mpls标签
- 离IP头部最近的为栈底,离以太最近的是栈顶
标签空间

MPLS标签

- 标签(Label):用于携带标签值,长度20bit。
- EXP(Experimental Use):主要用于CoS(Class of Service),长度3bit。
- S(Bottom of Stack):栈底位,用于指示该标签头部是否为最后一层标签,长度1bit。如果该字段为1,则表示当前标签头部为栈底;如果该字段为0,则表示当前标签头部之后依然还有其他标签头部。
- TTL(Time To Live):用于当网络出现环路时,防止标签报文被无限制转发,与IP报文头部中的TTL具有相同的意义,长度8bit。
MPLS标签的处理
压入(push),标签交换(swap),标签弹出(pop)
- 标签交换针对栈顶标签
- 标签弹出一次只能处理一层,可以循环弹出
基本配置

案例

R2:

R3:

R4:

控制平面与转发平面

LSP建立方式

MPLS标签转发

Ingress LSR的处理

Transit LSR的处理

Egreee LSR的处理
