【实验】静态分配MPLS标签

实验环境:

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

【实验】静态分配MPLS标签
【实验】静态分配MPLS标签

实验步骤:

1、先完成基础配置(IP地址和IGP):

IOU1:

conf t
int l 0
ip add 1.1.1.1 255.255.255.255

int e 0/0
ip add 12.1.1.1 255.255.255.0
no sh

router isis 1
net 49.0001.0000.0000.0001.00
is-type level-1
pass l 0
adv pass

int r e 0/0
ip router isis 1

IOU2:

conf t
int l 0
ip add 2.2.2.2 255.255.255.255

int e 0/0
ip add 12.1.1.2 255.255.255.0
no sh

int e 0/1
ip add 23.1.1.2 255.255.255.0
no sh

router isis 1
net 49.0001.0000.0000.0002.00
is-type level-1
pass l 0
adv pass

int r e 0/0 , e 0/1
ip router isis 1

IOU3:

conf t
int l 0
ip add 3.3.3.3 255.255.255.255

int e 0/0
ip add 34.1.1.3 255.255.255.0
no sh

int e 0/1
ip add 23.1.1.3 255.255.255.0
no sh

router isis 1
net 49.0001.0000.0000.0003.00
is-type level-1
pass l 0
adv pass

int r e 0/0 , e 0/1
ip router isis 1

IOU4:

conf t
int l 0
ip add 4.4.4.4 255.255.255.255

int e 0/0
ip add 34.1.1.4 255.255.255.0
no sh

int e 0/1
ip add 45.1.1.4 255.255.255.0
no sh

router isis 1
net 49.0001.0000.0000.0004.00
is-type level-1
pass l 0
adv pass

int r e 0/0 , e 0/1
ip router isis 1

IOU5:

conf t
int l 0
ip add 5.5.5.5 255.255.255.255

int e 0/0
ip add 56.1.1.5 255.255.255.0
no sh

int e 0/1
ip add 45.1.1.5 255.255.255.0
no sh

router isis 1
net 49.0001.0000.0000.0005.00
is-type level-1
pass l 0
adv pass

int r e 0/0 , e 0/1
ip router isis 1

IOU6:

conf t
int l 0
ip add 6.6.6.6 255.255.255.255

int e 0/0
ip add 56.1.1.6 255.255.255.0
no sh

router isis 1
net 49.0001.0000.0000.0006.00
is-type level-1
pass l 0
adv pass

int r e 0/0
ip router isis 1

2、接着完成MPLS的配置:

IOU2:

mpls ip
mpls label protocol ldp
mpls ldp router-id Loopback0 force
mpls label range 2000 2999 static 20 29

int e 0/1
mpls ip

IOU3:

mpls ip
mpls label protocol ldp
mpls ldp router-id Loopback0 force
mpls label range 3000 3999 static 30 39

router isis 1
mpls ldp autoconfig

IOU4:

mpls ip
mpls label protocol ldp
mpls ldp router-id Loopback0 force
mpls label range 4000 4999 static 40 49

router isis 1
mpls ldp autoconfig

IOU5:

mpls ip
mpls label protocol ldp
mpls ldp router-id Loopback0 force
mpls label range 5000 5999 static 50 59

int e 0/1
mpls ip

命令mpls label range 5000 5999 static 50 59表示MPLS动态标签的范围在5000到5999之间,静态标签的范围在50和59之间。

3、最后,静态分配MPLS标签:

IOU2:

mpls static binding ipv4 1.1.1.1 255.255.255.255 input 22

IOU3:

mpls static binding ipv4 1.1.1.1 255.255.255.255 input 33
mpls static binding ipv4 1.1.1.1 255.255.255.255 output 23.1.1.2 22

IOU4:

mpls static binding ipv4 1.1.1.1 255.255.255.255 input 44
mpls static binding ipv4 1.1.1.1 255.255.255.255 output 34.1.1.3 33

IOU5:

mpls static binding ipv4 1.1.1.1 255.255.255.255 output 45.1.1.4 44

命令mpls static binding ipv4 1.1.1.1 255.255.255.255 output 45.1.1.4 44表示为1.1.1.1 255.255.255.255这条IPv4路由分配静态的出标签,下一跳地址为45.1.1.4,出标签的编号为44。

上述命令中的input和output表示的是数据面中数据流的方向。同时配置output时是要指定下一跳地址的,配置input则不需要。

至于静态标签怎么分配,请看下面的示意图:

MPLS标签静态分配示意图
MPLS标签静态分配示意图
  • 对于R5来说,需要静态分配一个出标签为44的标签;
  • 对于R4来说,需要静态分配一个出标签为33的标签,和一个入标签为44的标签;
  • 对于R3来说,需要静态分配一个出标签为22的标签,和一个入标签为33的标签;
  • 对于R2来说,需要静态分配一个入标签为22的标签。

实验结果:

现在标签绑定表出现了一些变化,静态标签和动态标签都存在的时候,以静态标签为准。

IOU3#sh mpls ldp bindings 
  lib entry: 1.1.1.1/32, rev 20
        local binding:  label: 33
        remote binding: lsr: 4.4.4.4:0, label: 44
        remote binding: lsr: 2.2.2.2:0, label: 22
  lib entry: 2.2.2.2/32, rev 8
        local binding:  label: 3000
        remote binding: lsr: 2.2.2.2:0, label: imp-null
        remote binding: lsr: 4.4.4.4:0, label: 4002
  lib entry: 3.3.3.3/32, rev 2
        local binding:  label: imp-null
        remote binding: lsr: 2.2.2.2:0, label: 2001
        remote binding: lsr: 4.4.4.4:0, label: 4000
  lib entry: 4.4.4.4/32, rev 12
        local binding:  label: 3001
        remote binding: lsr: 4.4.4.4:0, label: imp-null
        remote binding: lsr: 2.2.2.2:0, label: 2002
  lib entry: 5.5.5.5/32, rev 16
        local binding:  label: 3003
        remote binding: lsr: 2.2.2.2:0, label: 2003
        remote binding: lsr: 4.4.4.4:0, label: 4001
  lib entry: 6.6.6.6/32, rev 18
        local binding:  label: 3004
        remote binding: lsr: 2.2.2.2:0, label: 2004
        remote binding: lsr: 4.4.4.4:0, label: 4004
  lib entry: 12.1.1.0/24, rev 9
        remote binding: lsr: 2.2.2.2:0, label: imp-null
  lib entry: 23.1.1.0/24, rev 6
        local binding:  label: imp-null
        remote binding: lsr: 2.2.2.2:0, label: imp-null
  lib entry: 34.1.1.0/24, rev 4
        local binding:  label: imp-null
        remote binding: lsr: 4.4.4.4:0, label: imp-null
  lib entry: 45.1.1.0/24, rev 14
        remote binding: lsr: 4.4.4.4:0, label: imp-null

现在我们测试一下,看静态标签是否配置成功。

IOU6#traceroute 1.1.1.1 source 6.6.6.6
Type escape sequence to abort.
Tracing the route to 1.1.1.1
VRF info: (vrf in name/id, vrf out name/id)
  1 56.1.1.5 0 msec 1 msec 0 msec
  2 45.1.1.4 [MPLS: Label 44 Exp 0] 2 msec 1 msec 2 msec
  3 34.1.1.3 [MPLS: Label 33 Exp 0] 1 msec 2 msec 2 msec
  4 23.1.1.2 [MPLS: Label 22 Exp 0] 1 msec 2 msec 1 msec
  5 12.1.1.1 1 msec 2 msec 1 msec
IOU6#

没问题,实验完成。

这篇文章对你有帮助吗?

相关文章

发表评论?

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