MPLS 第一话 :传统IP路由的局限性
这个暑假开始啃MPLS,内容很多,动不动就8,9台路由器,标签交换的一环接一环很容易晕,不过,MPLS真的很很有意思。当你能够搞定MPLS的时候,再看OSPF,ISIS,BGP真的有点大山望小山了。因为MPSL就是要在BGP的基础上来搭建的,如果BGP搞不定的话,学MPLS会比较吃力。
今天在51CTO上找MPLS的资料,发现大家写的这方面的博客很少(相对于IGP)。正好,我也正要花大力气来搞MPLS了,在博客上记录下自己的每天的小进步,给自己一点压力,更是学习的动力。从今天起我会勤奋的更新我的博客!呵呵
好,下面的这个小实验旨在说明MPLS与传统IP路由间的一个鲜明的不同。作为开篇,其中的技术细节没有细细讲明。在后续的博客中,我会慢慢的来啃。
拓扑:
R1->R2->R3->R4->R5连成一条直线
描述:
AS1:R1 AS234:R2,R4 AS5:R5
AS234内部运行OSPF;在R2,R4将OSPF重发布进BGP;
R2<--->R4之间使用loopback 0建立iBGP peer;R1<--->R2,R4<--->R5之间建立eBGP peer;
R1发布1.1.1.1进BGP,R5发布5.5.5.5进BGP;
基础 配置:
R1:
R1#sh ip int brief
Interface IP-Address OK? Method Status Protocol
Serial0/0 12.1.1.1 YES manual up up
Loopback0 1.1.1.1 YES manual up up
R1#sh run | b router bgp
router bgp 1
no synchronization
bgp router-id 1.1.1.1
bgp log-neighbor-changes
network 1.1.1.1 mask 255.255.255.255
neighbor 12.1.1.2 remote-as 234
no auto-summary
R2:
R2#sh ip int brief
Interface IP-Address OK? Method Status Protocol
Serial0/0 12.1.1.2 YES manual up up
Serial0/1 23.1.1.2 YES manual up up
Loopback0 2.2.2.2 YES manual up up
R2#sh run | b router ospf
router ospf 10
router-id 2.2.2.2
log-adjacency-changes
passive-interface Loopback0
network 2.2.2.2 0.0.0.0 area 0
network 23.1.1.2 0.0.0.0 area 0
!
router bgp 234
no synchronization
bgp router-id 2.2.2.2
bgp log-neighbor-changes
redistribute ospf 10
neighbor 4.4.4.4 remote-as 234
neighbor 4.4.4.4 update-source Loopback0
neighbor 4.4.4.4 next-hop-self
neighbor 12.1.1.1 remote-as 1
no auto-summary
!
R3:
R3#sh ip int brief
Interface IP-Address OK? Method Status Protocol
Serial0/1 23.1.1.3 YES manual up up
Serial0/2 34.1.1.3 YES manual up up
Loopback0 3.3.3.3 YES manual up up
R3#sh run | b router ospf
router ospf 10
router-id 3.3.3.3
log-adjacency-changes
passive-interface Loopback0
network 3.3.3.3 0.0.0.0 area 0
network 23.1.1.3 0.0.0.0 area 0
network 34.1.1.3 0.0.0.0 area 0
!
R4,R5略
1. 邻居关系正常建立
R1#sh ip b s
(….OMITED)
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
12.1.1.2 4 234 12 7 9 0 0 00:03:46 7
2. 路由正常学习
R1#sh ip b
(….OMITED)
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.1/32 0.0.0.0 0 32768 i
*> 2.2.2.2/32 12.1.1.2 0 0 234 ?
*> 3.3.3.3/32 12.1.1.2 65 0 234 ?
*> 4.4.4.0/24 12.1.1.2 0 234 ?
*> 4.4.4.4/32 12.1.1.2 129 0 234 ?
*> 5.5.5.5/32 12.1.1.2 0 234 5 i
*> 23.1.1.0/24 12.1.1.2 0 0 234 ?
*> 34.1.1.0/24 12.1.1.2 128 0 234 ?
3. 检测
R1#
R1#tra
Protocol [ip]:
Target IP address: 5.5.5.5
Source address: 1.1.1.1
Numeric display [n]:
Timeout in seconds [3]:
Probe count [3]:
Minimum Time to Live [1]:
Maximum Time to Live [30]: 10
Port Number [33434]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Type escape sequence to abort.
Tracing the route to 5.5.5.5
1 12.1.1.2 72 msec 56 msec 60 msec
2 * * *
3 * *
(…..OMITED)
从上面的trace结果结合拓扑我们可以判断出数据包到达R3出现连通性问题
4. 排错
R3:
R3(config)#acce 100 per icmp host 1.1.1.1 host 5.5.5.5 echo
R3(config)#acce 100 deny ip an an
R3(config)#do deb ip pack 100
IP packet debugging is on for access list 100
R1: R1#ping 5.5.5.5 sou l0 re 1
Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 5.5.5.5, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1
.
Success rate is 0 percent (0/1)
R3#
*Mar 1 00:20:51.191: IP: s=1.1.1.1 (Serial0/1), d=5.5.5.5, len 100, unroutable
原因是R3上没有路由。
5. 分析
这就是传统IP路由的特点,也可以说是局限所在,即数据包的传递是一跳一跳向前传递的,中间的路由器在解包的时候查看第三层的SIP和DIP,如果DIP没有在自己的路由表里面,那么他就不知道如何路由了。R3此时就是这种情况,他成了一个路由黑洞。下面是R3的路由表
R3#sh ip rou
(….OMITED)
Gateway of last resort is not set
34.0.0.0/24 is subnetted, 1 subnets
C 34.1.1.0 is directly connected, Serial0/2
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/65] via 23.1.1.2, 00:19:27, Serial0/1
3.0.0.0/32 is subnetted, 1 subnets
C 3.3.3.3 is directly connected, Loopback0
4.0.0.0/32 is subnetted, 1 subnets
O 4.4.4.4 [110/65] via 34.1.1.4, 00:19:27, Serial0/2
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, Serial0/1
6. 解决问题
传统路由的特点带来的问题不仅仅是中间路由器必须知道所有路由外,还带来相关的一些问题。例如中间路由的路由表十分庞大,对内存和CPU的要求很高,网络不稳定造成所有的路由器都必须随之更新路由信息,网络改造困难,等等。
针对这些问题,MPLS技术出现了。
MPLS中文译作多协议标签交换,关键词是标签交换。简单说就是MPLS技术在数据包的第二层包头和第三层包头再插入一个4字节的“标签”,所以人们常说MPLS是一个2.5层的技术。这个标签的功能就是实现路由。当然MPLS不仅仅解决了路由的问题,他的魅力在于在此基础上引入的新技术:MPLS ×××,TE,MPLS QoS。
7. 配置MPLS
下面我们在骨干网上启用MPLS。
R2:
ip cef
mpls label range 200 299
mpls label protocol ldp
interface Serial0/1
description **--->R3:S0/1**
ip address 23.1.1.2 255.255.255.0
mpls ip
serial restart-delay 0
R3:
ip cef
mpls label range 300 399
mpls label protocol ldp
interface Serial0/1
description **--->R2:S0/1**
ip address 23.1.1.3 255.255.255.0
mpls ip
serial restart-delay 0
!
interface Serial0/2
description **--->R4:S0/1**
ip address 34.1.1.3 255.255.255.0
mpls ip
serial restart-delay 0
R4:
ip cef
mpls label range 400 499
mpls label protocol ldp
!
interface Serial0/1
description **--->R3:S0/2**
ip address 34.1.1.4 255.255.255.0
mpls ip
serial restart-delay 0
8. 查看邻居建立
R3#sh 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.60404
State: Oper; Msgs sent/rcvd: 17/17; Downstream
Up time: 00:07:52
LDP discovery sources:
Serial0/1, Src IP addr: 23.1.1.2
Addresses bound to peer LDP Ident:
12.1.1.2 23.1.1.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.22870 - 3.3.3.3.646
State: Oper; Msgs sent/rcvd: 16/17; Downstream
Up time: 00:07:07
LDP discovery sources:
Serial0/2, Src IP addr: 34.1.1.4
Addresses bound to peer LDP Ident:
34.1.1.4 45.1.1.4 4.4.4.4
如上所示,R3与R2,R4成功建立了LDP对等体。
9. 鲜明的比较
下面再来看看能不能R1与R5之间是不是能通了。
R1#ping 5.5.5.5 sou l0
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 5.5.5.5, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 24/125/216 ms
通了!
看看R3上还没有debug输出
R3#sh debugging
Generic IP:
IP packet debugging is on for access list 100
显示为空。
10.R3是如何解决这个传统IP路由的问题的
在R3上开启DEBUG观察MPLS的
R3#deb mpls pack
MPLS packet debugging is on
在R1上对R5发送一个ping包
R1#ping 5.5.5.5 sou l0 re 1
Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 5.5.5.5, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1
!
Success rate is 100 percent (1/1), round-trip min/avg/max = 196/196/196 ms
观察R3上的输出
R3#
*Mar 1 00:53:12.427: MPLS: Se0/1: recvd: CoS=0, TTL=254, Label(s)=301
*Mar 1 00:53:12.427: MPLS: Se0/2: xmit: (no label)
*Mar 1 00:53:12.535: MPLS: Se0/2: recvd: CoS=0, TTL=254, Label(s)=300
*Mar 1 00:53:12.535: MPLS: Se0/1: xmit: (no label)
上面的一大段就是R3解决路由问题的方法,呵呵,看不明白的话我们就一起慢慢学习吧!
转载于:https://blog.51cto.com/edges/398169