拓扑说明:
SR-MPLS BE标签分配原则:
- 下游设备不会直接为上游设备分配标签,而是将参与标签计算的信息,通过扩展OSPF传递至上游设备;
- 上游根据10类LSA中type4类获悉SRGB,从type7来获取下游唯一标识的前缀地址信息和 index值,从而计算出下游设备的node sid;
- SR-MPLS BE中adjacency sid没有实际意义,该sid是通过10类LSA中type8携带。
- 若下游设备为Egress节点,则仍然存在PHP机制。
关键配置说明:
- SR区域仍然需要使能MPLS功能,原因在于SR-MPLS中扩展的ISG分配的标签还是MPLS范围内的有效标签;
- SGRB范围建议SR区域路由配置一致,实验中便于观察,则设置不同的区间范围。
- ospf prefix-sid 命令;
//命令用来配置Loopback接口IP地址的Prefix SID。
//如果配置的是index-value,则对外发布的前缀SID就是index-value;
//如果配置的是sid-value,则对外发布的前缀SID值=sid-value-SRGB起始值。
//只有在Loopback接口上配置32位掩码的IP地址时,Prefix SID才能生效
//只对Loopback接口的主IP地址生效。
//如果Prefix SID值超过SRGB范围,Prefix SID不会被发布。
//对于同一个OSPF进程,标签相对值不能重复配置,上游设备根据index-value+SRGB计算得到node SID。
转发表项
<PE1>display bgp vpnv4 all routing-table 10.1.20.0
BGP local router ID : 150.1.1.1
Local AS number : 100
Total routes of Route Distinguisher(100:13): 1
BGP routing table entry information of 10.1.20.0/24:
Label information (Received/Applied): 48120/NULL
From: 150.1.3.3 (150.1.3.3)
Route Duration: 0d01h17m59s
Relay IP Nexthop: 155.1.12.2
Relay IP Out-Interface: Ethernet1/0/1
Relay Tunnel Out-Interface: Ethernet1/0/1
Original nexthop: 150.1.3.3
Qos information : 0x0
Ext-Community: RT <100 : 13>
AS-path 65502, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, b
est, select, pre 255, IGP cost 2
Not advertised to any peer yet
<PE1>display ip routing-tabl vpn-instance A 10.1.20.0 verbose
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole
route
------------------------------------------------------------------------------
Routing Table : A
Summary Count : 1
Destination: 10.1.20.0/24
Protocol: IBGP Process ID: 0
Preference: 255 Cost: 0
NextHop: 150.1.3.3 Neighbour: 150.1.3.3
State: Active Adv Relied Age: 00h41m27s
Tag: 0 Priority: low
Label: 48120 QoSInfo: 0x0
IndirectID: 0x10000A3 Instance:
RelayNextHop: 155.1.12.2 Interface: Ethernet1/0/1
TunnelID: 0x000000002900002004 Flags: RD
<PE1>display tunnel-info all
Tunnel ID Type Destination
Status
--------------------------------------------------------------------------------
--------
0x000000002900002003 srbe-lsp 150.1.2.2
UP
0x000000002900002004 srbe-lsp 150.1.3.3
UP
<PE1>display segment-routing prefix mpls forwarding
Segment Routing Prefix MPLS Forwarding Information
--------------------------------------------------------------
Role : I-Ingress, T-Transit, E-Egress, I&T-Ingress And Transit
Prefix Label OutLabel Interface NextHop Role MPLSMtu Mtu State
-----------------------------------------------------------------------------------------------------------------
150.1.1.1/32 16001 NULL Loop0 127.0.0.1 E --- 1500 Active
150.1.2.2/32 16002 3 Eth1/0/1 155.1.12.2 I&T --- 1500 Active
150.1.3.3/32 16003 17003 Eth1/0/1 155.1.12.2 I&T --- 1500 Active
Total information(s): 3
<P>display segment-routing prefix mpls forwarding
Segment Routing Prefix MPLS Forwarding Information
--------------------------------------------------------------
Role : I-Ingress, T-Transit, E-Egress, I&T-Ingress And Transit
Prefix Label OutLabel Interface NextHop Role MPLSMtu Mtu State
-----------------------------------------------------------------------------------------------------------------
150.1.1.1/32 17001 3 Eth1/0/0 155.1.12.1 I&T --- 1500 Active
150.1.2.2/32 17002 NULL Loop0 127.0.0.1 E --- 1500 Active
150.1.3.3/32 17003 3 Eth1/0/1 155.1.23.3 I&T --- 1500 Active
结果与抓包
PC>ping 10.1.20.10
Ping 10.1.20.10: 32 data bytes, Press Ctrl_C to break
From 10.1.20.10: bytes=32 seq=1 ttl=123 time=109 ms
From 10.1.20.10: bytes=32 seq=2 ttl=123 time=94 ms
From 10.1.20.10: bytes=32 seq=3 ttl=123 time=78 ms
From 10.1.20.10: bytes=32 seq=4 ttl=123 time=78 ms
From 10.1.20.10: bytes=32 seq=5 ttl=123 time=78 ms
--- 10.1.20.10 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 78/87/109 ms
<CE1>tracert -v -a 10.1.10.1 10.1.20.10
traceroute to 10.1.20.10(10.1.20.10), max hops: 30 ,packet length: 40,press CTRL_C to break
1 10.1.1.1 40 ms 40 ms 40 ms
2 155.1.12.2[MPLS Label=17003/48120 Exp=0/0 S=0/1 TTL=1/1] 50 ms 30 ms 50 ms
3 10.1.2.3 40 ms 50 ms 30 ms
4 10.1.2.10 50 ms 50 ms 30 ms
5 10.1.20.10 < AS=65502 > 60 ms 60 ms 70 ms
PE2的e1/0/0抓包如下:
repuest报文:
Frame 6: 78 bytes on wire (624 bits), 78 bytes captured (624 bits) on interface 0
Ethernet II, Src: 38:13:ea:02:01:01 (38:13:ea:02:01:01), Dst: 38:13:ea:03:01:00 (38:13:ea:03:01:00)
MultiProtocol Label Switching Header, Label: 48120, Exp: 0, S: 1, TTL: 125
Internet Protocol Version 4, Src: 10.1.10.10, Dst: 10.1.20.10
Internet Control Message Protocol
reply报文:
Frame 7: 82 bytes on wire (656 bits), 82 bytes captured (656 bits) on interface 0
Ethernet II, Src: 38:13:ea:03:01:00 (38:13:ea:03:01:00), Dst: 38:13:ea:02:01:01 (38:13:ea:02:01:01)
MultiProtocol Label Switching Header, Label: 17001, Exp: 0, S: 0, TTL: 126
MultiProtocol Label Switching Header, Label: 48121, Exp: 0, S: 1, TTL: 126
Internet Protocol Version 4, Src: 10.1.20.10, Dst: 10.1.10.10
Internet Control Message Protocol