首页 > 代码库 > Juniper MPLS Static LSP
Juniper MPLS Static LSP
MPLS Static LSP
1、配置接口去接收和处理MPLS帧
user@R1#setinterface ge-1/0/0 unit 0 family inet family mpls
2、指定哪个接口运行MPLS
user@R1#setprotocols mpls interface ge-1/0/0.0
或
user@R1#setprotocols mpls interface all
3、验证MPLS接口配置
user@R1>show mpls interface
Interface state (x: extended)
ge-1/0/5.0 up <none>
ge-1/0/6.0 up <none>
4、配置static LSPs
命名:每条Static LSP应该被给出一个唯一的名称,并且名称在路径上所有路由应该保存一致。
标签值:staticLSPs预留的标签范围在1000000和1048575之间.剩下的标签空间用于动态标签分发协议。
如果设计需要,标签0(显式null)也允许在倒数第二跳。如果使用TC bits来传递Class ofService信息,这是很有用的。
a、在ingress路由配置static LSP
user@R1#setprotocols mpls static-label-switch-path <lsp-name> ingress next-hop <address of next-hop router> to <lsp endpoint> push <label>
b、在transit路由器配置staticLSP,指定传入标签和转发动作,可以swap带着label 0(explicit null)或倒数第二跳弹出(pop)。
user@R2#setprotocols mpls static-label-switch-path <lsp-name> transit<incoming-label> next-hop <address of next-hop router> swap<outgoing label>
在Transitrouter操作模式下查看命令:
查看LSP状态:show mplsstatic-lsp name <LSP-name> transit extensive
查看标签交换表:show route table mpls.0
c、,如果做倒数第二跳弹出,那么在egress router就不需要配置。
5、路由表汇总
在juniper路由器上配置staticLSP直接影响到两张表,
mpls.0表(labelswitchingtable):传入标签和转发动作之间的映射
inet.3表:用于跟踪LSP 入站点
注意inet.0 和inet.6表分别用于IPv4和IPv6转发不受Static LSP配置的影响,这意味这Juniper路由器默认不会使用MPLS转发IPv4和IPv6流量。
6、staticLSP作为静态路由的下一跳
user@R1#setrouting-options static route <destination-prefix> static-lsp-next-hop<LSP-name>
静态标签j交换路径用于转发的一种非常简单的方法是创建静态LSP作为静态路由的吓一跳。然后,静态路由将被安装到inet.0表,并将用于转发流量。还有其他的方法(稍后讨论)将前缀与标签交换路径关联起来用于转发。然而,LSP下跳的静态路由有几个优点,包括容易设置特定于路由的属性的可能性,以及静态路由易于操作和重新分配策略的事实。
备注:对于point-to-point接口(e.g.,SONET/SDH)你可以使用接口名称作为下一跳而不是ip address。
MPLS Packet Forwarding实验:
R1
set logical-systems r1 interfaces ge-0/0/0 unit 12 vlan-id 12
set logical-systems r1 interfaces ge-0/0/0 unit 12 family inet address 10.1.12.1/30
set logical-systems r1 interfaces ge-0/0/0 unit 12 family mpls
set logical-systems r1 interfaces lo0 unit 1 family inet address 1.1.1.1/32
set logical-systems r1 protocols mpls static-label-switched-path r1-to-r4 ingress next-hop10.1.12.2
set logical-systems r1 protocols mpls static-label-switched-path r1-to-r4 ingress to 4.4.4.4
set logical-systems r1 protocols mpls static-label-switched-path r1-to-r4 ingress push 1000014
set logical-systems r1 protocols mpls interface ge-0/0/0.12
set logical-systems r1 routing-options static route 4.4.4.4/32 static-lsp-next-hop r1-to-r4
R2
set logical-systems r2 interfaces ge-0/0/1 unit 12 vlan-id 12
set logical-systems r2 interfaces ge-0/0/1 unit 12 family inet address 10.1.12.2/30
set logical-systems r2 interfaces ge-0/0/1 unit 12 family mpls
set logical-systems r2 interfaces ge-0/0/1 unit 23 vlan-id 23
set logical-systems r2 interfaces ge-0/0/1 unit 23 family inet address 10.1.23.1/30
set logical-systems r2 interfaces ge-0/0/1 unit 23 family mpls
set logical-systems r2 protocols mpls static-label-switched-path r1-to-r4 transit 1000014 next-hop10.1.23.2
set logical-systems r2 protocols mpls static-label-switched-path r1-to-r4 transit 1000014 swap1000024
set logical-systems r2 protocols mpls static-label-switched-path r4-to-r1 transit 1000031 next-hop10.1.12.1
set logical-systems r2 protocols mpls static-label-switched-path r4-to-r1 transit 1000031 pop
set logical-systems r2 protocols mpls interface ge-0/0/1.12
set logical-systems r2 protocols mpls interface ge-0/0/1.23
R3
set logical-systems r3 interfaces ge-0/0/2 unit 23 vlan-id 23
set logical-systems r3 interfaces ge-0/0/2 unit 23 family inet address 10.1.23.2/30
set logical-systems r3 interfaces ge-0/0/2 unit 23 family mpls
set logical-systems r3 interfaces ge-0/0/2 unit 34 vlan-id 34
set logical-systems r3 interfaces ge-0/0/2 unit 34 family inet address 10.1.34.1/30
set logical-systems r3 interfaces ge-0/0/2 unit 34 family mpls
set logical-systems r3 protocols mpls static-label-switched-path r1-to-r4 transit 1000024 next-hop10.1.34.2
set logical-systems r3 protocols mpls static-label-switched-path r1-to-r4 transit 1000024 pop
set logical-systems r3 protocols mpls static-label-switched-path r4-to-r1 transit 1000041 next-hop10.1.23.1
set logical-systems r3 protocols mpls static-label-switched-path r4-to-r1 transit 1000041 swap1000031
set logical-systems r3 protocols mpls interface ge-0/0/2.23
set logical-systems r3 protocols mpls interface ge-0/0/2.34
R4
set logical-systems r4 interfaces ge-0/0/3 unit 34 vlan-id 34
set logical-systems r4 interfaces ge-0/0/3 unit 34 family inet address 10.1.34.2/30
set logical-systems r4 interfaces ge-0/0/3 unit 34 family mpls
set logical-systems r4 interfaces lo0 unit 4 family inet address 4.4.4.4/32
set logical-systems r4 protocols mpls static-label-switched-path r4-to-r1 ingress next-hop10.1.34.1
set logical-systems r4 protocols mpls static-label-switched-path r4-to-r1 ingress to 1.1.1.1
set logical-systems r4 protocols mpls static-label-switched-path r4-to-r1 ingress push 1000041
set logical-systems r4 protocols mpls interface ge-0/0/3.34
set logical-systems r4 routing-options static route 1.1.1.1/32 static-lsp-next-hop r4-to-r1
测试结果
R1:
root@vMX-1:r1>show mpls static-lsp ingress extensive
Ingress LSPs:
LSPname: r1-to-r4,To: 4.4.4.4
State: Up
Nexthop: 10.1.12.2 Via ge-0/0/0.12
LabelOperation: Push, Outgoing-label: 1000014
Created: Sat Aug 5 09:25:14 2017
Bandwidth: 0 bps
Statistics: Packets 2442, Bytes 204776
Total 1, displayed1, Up 1, Down 0
root@vMX-1:r1>show route table inet.0 protocol static
inet.0: 14destinations, 14 routes (14 active, 0 holddown, 0 hidden)
+ = Active Route, -= Last Active, * = Both
4.4.4.4/32 *[Static/5] 02:18:53
> to 10.1.12.2 viage-0/0/0.12, Push 1000014
root@vMX-1:r1>ping 4.4.4.4 source 1.1.1.1
PING 4.4.4.4(4.4.4.4): 56 data bytes
64 bytes from4.4.4.4: icmp_seq=0 ttl=62 time=9.630 ms
64 bytes from4.4.4.4: icmp_seq=1 ttl=62 time=5.994 ms
64 bytes from4.4.4.4: icmp_seq=2 ttl=62 time=14.861 ms
64 bytes from4.4.4.4: icmp_seq=3 ttl=62 time=3.858 ms
64 bytes from4.4.4.4: icmp_seq=4 ttl=62 time=2.675 ms
^C
--- 4.4.4.4 pingstatistics ---
5 packetstransmitted, 5 packets received, 0% packet loss
round-tripmin/avg/max/stddev = 2.675/7.404/14.861/4.416 ms
本文出自 “高哥一曲” 博客,请务必保留此出处http://zoran.blog.51cto.com/2938959/1953942
Juniper MPLS Static LSP