mpls基础配置与解析

您所在的位置:网站首页 mpls和ldp基本配置实验报告 mpls基础配置与解析

mpls基础配置与解析

#mpls基础配置与解析| 来源: 网络整理| 查看: 265

实验目的​​​​​​​

1、理解MPLS LDP 的标签分配、分发、关联。

2、理解OSPF 作为底层协议对标签的影响。

3、掌握MPLS 的配置流程及校验方式。

实验拓扑

接口ip配置

R1(config)#interface e0/0 R1(config-if)#ip address 12.12.12.1 255.255.255.0 R1(config-if)#no shutdown R1(config)#interface loopback 0 R1(config-if)#ip address 10.10.10.10 255.255.255.0 R2(config)#interface e0/0 R2(config-if)#ip address 12.12.12.2 255.255.255.0 R2(config-if)#no shutdown R2(config-if)#interface e0/1 R2(config-if)#ip address 23.23.23.2 255.255.255.0 R2(config-if)#no shutdown R2(config)#interface loopback 0 R2(config-if)#ip address 2.2.2.2 255.255.255.0 R3(config)#interface e0/1 R3(config-if)#ip address 23.23.23.3 255.255.255.0 R3(config-if)#no shutdown R3(config-if)#interface e0/0 R3(config-if)#ip address 34.34.34.3 255.255.255.0 R3(config-if)#no shutdown R3(config)#interface loopback 0 R3(config-if)#ip address 3.3.3.3 255.255.255.0 R4(config)#interface e0/0 R4(config-if)#ip address 34.34.34.4 255.255.255.0 R4(config-if)#no shutdown R4(config-if)#interface e0/1 R4(config-if)#ip address 45.45.45.4 255.255.255.0 R4(config-if)#no shutdown R4(config)#interface loopback 0 R4(config-if)#ip address 4.4.4.4 255.255.255.0 R5(config)#interface e0/1 R5(config-if)#ip address 45.45.45.5 255.255.255.0 R5(config-if)#no shutdown R5(config-if)#interface e0/0 R5(config-if)#ip address 56.56.56.5 255.255.255.0 R5(config-if)#no shutdown R5(config)#interface loopback 0 R5(config-if)#ip address 5.5.5.5 255.255.255.0 R6(config)#interface e0/0 R6(config-if)#ip address 56.56.56.6 255.255.255.0 R6(config-if)#no shutdown R6(config)#interface loopback 0 R6(config-if)#ip address 60.60.60.60 255.255.255.0

完成R2 R3 R4 R5的底层协议OSPF 配置

R2(config)#router ospf 1 R2(config-router)#router-id 2.2.2.2 R2(config-router)#network 2.2.2.2 0.0.0.0 area 0 R2(config-router)#network 23.23.23.2 0.0.0.0 area 0 R3(config)#router ospf 1 R3(config-router)#router-id 3.3.3.3 R3(config-router)#network 3.3.3.3 0.0.0.0 area 0 R3(config-router)#network 23.23.23.3 0.0.0.0 area 0 R3(config-router)#network 34.34.34.3 0.0.0.0 area 0 R4(config)#router ospf 1 R4(config-router)#router-id 4.4.4.4 R4(config-router)#network 4.4.4.4 0.0.0.0 area 0 R4(config-router)#network 34.34.34.4 0.0.0.0 area 0 R4(config-router)#network 45.45.45.4 0.0.0.0 area 0 R5(config)#router ospf 1 R5(config-router)#router-id 5.5.5.5 R5(config-router)#network 5.5.5.5 0.0.0.0 area 0 R5(config-router)#network 45.45.45.5 0.0.0.0 area 0

观察参与OSPF 的LOOPBACK 接口路由条目状态。

R2#show ip ospf interface loopback 0 Loopback0 is up, line protocol is up Internet Address 2.2.2.2/24, Area 0, Attached via Network Statement Process ID 1, Router ID 2.2.2.2, Network Type LOOPBACK, Cost: 1 Topology-MTID Cost Disabled Shutdown Topology Name 0 1 no no Base Loopback interface is treated as a stub Host R3#show ip route ospf Gateway of last resort is not set 2.0.0.0/32 is subnetted, 1 subnets O 2.2.2.2 [110/11] via 23.23.23.2, 00:04:41, Ethernet0/1 4.0.0.0/32 is subnetted, 1 subnets O 4.4.4.4 [110/11] via 34.34.34.4, 00:00:05, Ethernet0/0 5.0.0.0/32 is subnetted, 1 subnets O 5.5.5.5 [110/21] via 34.34.34.4, 00:03:09, Ethernet0/0 45.0.0.0/24 is subnetted, 1 subnets O 45.45.45.0 [110/20] via 34.34.34.4, 00:05:21, Ethernet0/0

如上现象表明LOOPBACK接口是被当作主机学习的。

R1(config)#router bgp 1 R1(config-router)#bgp router-id 1.1.1.1 R1(config-router)#neighbor 12.12.12.2 remote-as 2345 R1(config-router)#network 10.10.10.0 mask 255.255.255.0 R2(config)#router bgp 2345 R2(config-router)#bgp router-id 2.2.2.2 R2(config-router)#neighbor 12.12.12.1 remote-as 1 R2(config-router)#neighbor 5.5.5.5 remote-as 2345 R2(config-router)#neighbor 5.5.5.5 update-source loopback 0 R2(config-router)#neighbor 5.5.5.5 next-hop-self R5(config)#router bgp 2345 R5(config-router)#bgp router-id 5.5.5.5 R5(config-router)#neighbor 56.56.56.6 remote-as 6 R5(config-router)#neighbor 2.2.2.2 remote-as 2345 R5(config-router)#neighbor 2.2.2.2 update-source loopback 0 R5(config-router)#neighbor 2.2.2.2 next-hop-self R6(config)#router bgp 6 R6(config-router)#bgp router-id 6.6.6.6 R6(config-router)#neighbor 56.56.56.5 remote-as 2345 R6(config-router)#network 60.60.60.0 mask 255.255.255.0

R1 R6 校验BGP 转发表及路由表,并且利用PING 做测试。

R1#show ip bgp Network Next Hop Metric LocPrf Weight Path *> 10.10.10.0/24 0.0.0.0 0 32768 i *> 60.60.60.0/24 12.12.12.2 0 2345 6 i R1#show ip route bgp Gateway of last resort is not set 60.0.0.0/24 is subnetted, 1 subnets B 60.60.60.0 [20/0] via 12.12.12.2, 00:00:33 R6#show ip bgp Network Next Hop Metric LocPrf Weight Path *> 10.10.10.0/24 56.56.56.5 0 2345 1 i *> 60.60.60.0/24 0.0.0.0 0 32768 i R6#show ip route bgp Gateway of last resort is not set 10.0.0.0/24 is subnetted, 1 subnets B 10.10.10.0 [20/0] via 56.56.56.5, 00:02:15 R6#ping 10.10.10.10 source 60.60.60.60 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.10.10.10, timeout is 2 seconds: Packet sent with a source address of 60.60.60.60 ..... Success rate is 0 percent (0/5) //如上现象表明因为存在路由黑洞,导致路由的可见而不可达。

R2 R3 R4 R5 完成MPLS 的配置:

R2(config)#mpls label protocol ldp R2(config)#mpls label range 200 299 R2(config)#mpls ldp router-id loopback 0 R2(config)#interface e0/1 R2(config-if)#mpls ip R3(config)#mpls label protocol ldp R3(config)#mpls label range 300 399 R3(config)#mpls ldp router-id loopback 0 R3(config)#interface range e0/0-1 R3(config-if-range)#mpls ip R4(config)#mpls label protocol ldp R4(config)#mpls label range 400 499 R4(config)#mpls ldp router-id loopback 0 R4(config)#interface range e0/0-1 R4(config-if-range)#mpls ip R5(config)#mpls label protocol ldp R5(config)#mpls label range 500 599 R5(config)#mpls ldp router-id loopback 0 R5(config)#interface e0/1 R5(config-if)#mpls ip

R2 R3 R4 R5 校验LDP 邻居的发现和邻接的建立。

R2#show mpls ldp discovery Local LDP Identifier: 2.2.2.2:0 Discovery Sources: Interfaces: Ethernet0/1 (ldp): xmit/recv LDP Id: 3.3.3.3:0 //如上现象表明R2 E0/1 口启用LDP,并且发现了RID 为3.3.3.3 R3 R3#show mpls ldp discovery Local LDP Identifier: 3.3.3.3:0 Discovery Sources: Interfaces: Ethernet0/0 (ldp): xmit/recv LDP Id: 4.4.4.4:0 Ethernet0/1 (ldp): xmit/recv LDP Id: 2.2.2.2:0 R4#show mpls ldp discovery Local LDP Identifier: 4.4.4.4:0 Discovery Sources: Interfaces: Ethernet0/0 (ldp): xmit/recv LDP Id: 3.3.3.3:0 Ethernet0/1 (ldp): xmit/recv LDP Id: 5.5.5.5:0 R5#show mpls ldp discovery Local LDP Identifier: 5.5.5.5:0 Discovery Sources: Interfaces: Ethernet0/1 (ldp): xmit/recv LDP Id: 4.4.4.4:0 R2#show mpls ldp neighbor Peer LDP Ident: 3.3.3.3:0; Local LDP Ident 2.2.2.2:0 TCP connection: 3.3.3.3.46036 - 2.2.2.2.646 State: Oper; Msgs sent/rcvd: 15/14; Downstream Up time: 00:04:04 LDP discovery sources: Ethernet0/1, Src IP addr: 23.23.23.3 Addresses bound to peer LDP Ident: 34.34.34.3 23.23.23.3 3.3.3.3 //state是Oper代表邻接关系建立完毕, //Address bound to peer LDP Ident;列出来的都是绑定地址 R3#show mpls ldp neighbor Peer LDP Ident: 2.2.2.2:0; Local LDP Ident 3.3.3.3:0 TCP connection: 2.2.2.2.646 - 3.3.3.3.46036 State: Oper; Msgs sent/rcvd: 15/16; Downstream Up time: 00:04:47 LDP discovery sources: Ethernet0/1, Src IP addr: 23.23.23.2 Addresses bound to peer LDP Ident: 12.12.12.2 23.23.23.2 2.2.2.2 Peer LDP Ident: 4.4.4.4:0; Local LDP Ident 3.3.3.3:0 TCP connection: 4.4.4.4.33572 - 3.3.3.3.646 State: Oper; Msgs sent/rcvd: 14/14; Downstream Up time: 00:03:54 LDP discovery sources: Ethernet0/0, Src IP addr: 34.34.34.4 Addresses bound to peer LDP Ident: 34.34.34.4 45.45.45.4 4.4.4.4

查看R2 R3 R4 R5的LIB。

R2#show mpls ldp bindings lib entry: 2.2.2.0/24, rev 2 local binding: label: imp-null //此处本地直连网络2.2.2.0/24获得的本地标签为imp-null(显性空)其实就是POP lib entry: 2.2.2.2/32, rev 17 remote binding: lsr: 3.3.3.3:0, label: 300 lib entry: 3.3.3.0/24, rev 18 remote binding: lsr: 3.3.3.3:0, label: imp-null lib entry: 3.3.3.3/32, rev 4 local binding: label: 200 lib entry: 4.4.4.4/32, rev 6 local binding: label: 201 remote binding: lsr: 3.3.3.3:0, label: 301 lib entry: 5.5.5.5/32, rev 8 local binding: label: 202 remote binding: lsr: 3.3.3.3:0, label: 302 lib entry: 12.12.12.0/24, rev 10 local binding: label: imp-null lib entry: 23.23.23.0/24, rev 12 local binding: label: imp-null remote binding: lsr: 3.3.3.3:0, label: imp-null lib entry: 34.34.34.0/24, rev 14 local binding: label: 203 remote binding: lsr: 3.3.3.3:0, label: imp-null lib entry: 45.45.45.0/24, rev 16 local binding: label: 204 remote binding: lsr: 3.3.3.3:0, label: 303 R3#show mpls ldp bindings lib entry: 2.2.2.0/24, rev 15 remote binding: lsr: 2.2.2.2:0, label: imp-null //如上条目其实是R2共享的网络标签信息 lib entry: 2.2.2.2/32, rev 2 local binding: label: 300 remote binding: lsr: 4.4.4.4:0, label: 400 //R3 以主机路由2.2.2.2的形式学习了R2 loop back网络, //并且分配了本地标签300,同时发现了R4共享相同前缀的远程标签 lib entry: 3.3.3.0/24, rev 4 local binding: label: imp-null lib entry: 3.3.3.3/32, rev 16 remote binding: lsr: 2.2.2.2:0, label: 200 remote binding: lsr: 4.4.4.4:0, label: 401 lib entry: 4.4.4.0/24, rev 18 remote binding: lsr: 4.4.4.4:0, label: imp-null lib entry: 4.4.4.4/32, rev 6 local binding: label: 301 remote binding: lsr: 2.2.2.2:0, label: 201 lib entry: 5.5.5.5/32, rev 8 local binding: label: 302 remote binding: lsr: 2.2.2.2:0, label: 202 remote binding: lsr: 4.4.4.4:0, label: 402 lib entry: 12.12.12.0/24, rev 17 remote binding: lsr: 2.2.2.2:0, label: imp-null lib entry: 23.23.23.0/24, rev 10 local binding: label: imp-null remote binding: lsr: 2.2.2.2:0, label: imp-null remote binding: lsr: 4.4.4.4:0, label: 403 lib entry: 34.34.34.0/24, rev 12 local binding: label: imp-null remote binding: lsr: 2.2.2.2:0, label: 203 remote binding: lsr: 4.4.4.4:0, label: imp-null lib entry: 45.45.45.0/24, rev 14 local binding: label: 303 remote binding: lsr: 2.2.2.2:0, label: 204 remote binding: lsr: 4.4.4.4:0, label: imp-null //此刻根据标签关联的原则,我们认为R3上2.2.2.2无法正常的关联到远程标签, //所以远程标签应该为UNTAG R4#show mpls ldp bindings lib entry: 2.2.2.2/32, rev 2 local binding: label: 400 remote binding: lsr: 3.3.3.3:0, label: 300 remote binding: lsr: 5.5.5.5:0, label: 500 //R4和R3一样以主机路由形式学习了R2 loop back0 网络信息, //并且分配的本地标签为400,同时收到了R3与R5分发的相同前缀远程标签。 lib entry: 3.3.3.0/24, rev 15 remote binding: lsr: 3.3.3.3:0, label: imp-null lib entry: 3.3.3.3/32, rev 4 local binding: label: 401 remote binding: lsr: 5.5.5.5:0, label: 501 lib entry: 4.4.4.0/24, rev 6 local binding: label: imp-null lib entry: 4.4.4.4/32, rev 16 remote binding: lsr: 3.3.3.3:0, label: 301 remote binding: lsr: 5.5.5.5:0, label: 502 lib entry: 5.5.5.0/24, rev 17 remote binding: lsr: 5.5.5.5:0, label: imp-null lib entry: 5.5.5.5/32, rev 8 local binding: label: 402 remote binding: lsr: 3.3.3.3:0, label: 302 lib entry: 23.23.23.0/24, rev 10 local binding: label: 403 remote binding: lsr: 3.3.3.3:0, label: imp-null remote binding: lsr: 5.5.5.5:0, label: 503 lib entry: 34.34.34.0/24, rev 12 local binding: label: imp-null remote binding: lsr: 3.3.3.3:0, label: imp-null remote binding: lsr: 5.5.5.5:0, label: 504 lib entry: 45.45.45.0/24, rev 14 local binding: label: imp-null remote binding: lsr: 3.3.3.3:0, label: 303 remote binding: lsr: 5.5.5.5:0, label: imp-null lib entry: 56.56.56.0/24, rev 18 remote binding: lsr: 5.5.5.5:0, label: imp-null //根据标签关联机制,我们认为R4上2.2.2.2的本地标签为400,远端标签应该是R3提供的300 R5#show mpls ldp bindings lib entry: 2.2.2.2/32, rev 2 local binding: label: 500 remote binding: lsr: 4.4.4.4:0, label: 400 //如上现象表明R5和R3 R4 一样以主机路由形式学习了R2 loopback 0口网络, //并且给予本地标签为500,同时收到了来自于R4的相同前缀远程标签400 lib entry: 3.3.3.3/32, rev 4 local binding: label: 501 remote binding: lsr: 4.4.4.4:0, label: 401 lib entry: 4.4.4.0/24, rev 17 remote binding: lsr: 4.4.4.4:0, label: imp-null lib entry: 4.4.4.4/32, rev 6 local binding: label: 502 lib entry: 5.5.5.0/24, rev 8 local binding: label: imp-null lib entry: 5.5.5.5/32, rev 18 remote binding: lsr: 4.4.4.4:0, label: 402 lib entry: 23.23.23.0/24, rev 10 local binding: label: 503 remote binding: lsr: 4.4.4.4:0, label: 403 lib entry: 34.34.34.0/24, rev 12 local binding: label: 504 remote binding: lsr: 4.4.4.4:0, label: imp-null lib entry: 45.45.45.0/24, rev 14 local binding: label: imp-null remote binding: lsr: 4.4.4.4:0, label: imp-null lib entry: 56.56.56.0/24, rev 16 local binding: label: imp-null //根据标签关联机制,R5上2.2.2.2网络的本地标签500远端标签400

我们分析出来的R2 R3 R4 R5 关于R2 LOOPBACK 0 的标签关联信息如下:

R2

R3

R4

R5

Local Lable

Rremote Lable

LL

RL

LL

RL

LL

pop

x

300

UNTAG

400

300

500

400

校验R3 R4 R5的标签转发信息库,验证步骤7的分析结果。

R3#show mpls forwarding-table Local Outgoing Prefix Bytes Label Outgoing Next Hop Label Label or Tunnel Id Switched interface 300 No Label 2.2.2.2/32 1597 Et0/1 23.23.23.2 //如上现象表明R3 本地2.2.2.2 LL 是300 RL 是UNTAG(NO LABEL) 301 No Label 4.4.4.4/32 0 Et0/0 34.34.34.4 302 402 5.5.5.5/32 1704 Et0/0 34.34.34.4 303 Pop Label 45.45.45.0/24 0 Et0/0 34.34.34.4 R4#show mpls forwarding-table Local Outgoing Prefix Bytes Label Outgoing Next Hop Label Label or Tunnel Id Switched interface 400 300 2.2.2.2/32 1721 Et0/0 34.34.34.3 //如上现象表明R4 本地2.2.2.2 LL 是400 RL 是300 401 No Label 3.3.3.3/32 0 Et0/0 34.34.34.3 402 No Label 5.5.5.5/32 1705 Et0/1 45.45.45.5 403 Pop Label 23.23.23.0/24 0 Et0/0 34.34.34.3 R5#show mpls forwarding-table Local Outgoing Prefix Bytes Label Outgoing Next Hop Label Label or Tunnel Id Switched interface 500 400 2.2.2.2/32 0 Et0/1 45.45.45.4 //如上现象表明R5 本地2.2.2.2 LL 是500 RL 是400 501 401 3.3.3.3/32 0 Et0/1 45.45.45.4 502 No Label 4.4.4.4/32 0 Et0/1 45.45.45.4 503 403 23.23.23.0/24 0 Et0/1 45.45.45.4 504 Pop Label 34.34.34.0/24 0 Et0/1 45.45.45.4

如上现象证明我们的分析是正确的。

利用PING 命令验证连通性

R6#ping 10.10.10.10 source 60.60.60.60 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.10.10.10, timeout is 2 seconds: Packet sent with a source address of 60.60.60.60 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms //如上现象表明MPLS 工作,连通性已经完成。



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3