1.实验目的:

通过本次实验学会MPLS的基本配置,理解标签转发规则。


2.实验拓朴:

<?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

mpls组件 mpls怎么配置_R3



说明:R2、R4作为PE,R1、R5、R6、R7作为CE,R2、R3、R4使用MPLS


3.实验步骤:



1.基本配置:配置接口地址,使用Ping保证每个路由器之间的连通性。IP配置规则:两个路由器编号作为网络号,编号小的为1,编号大的为2如R3与R4之间,R3 s1/1:34.1.1.1/24 ,R4 s1/0:34.1.1.2/24。每个路由器启用环回口,地址为全编号,如R1:<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />1.1.1.1/24.


2.R2 S1/1~R4S1/0网段运行OSPF。

3.在R2s1/1、R3s1/0、S1/1和R4s1/1上开启MPLS:
 
  
R2(config)#int s1/1 
    
 
   
R2(config-if)#mpls ip
 
   
 
    
 
 
   
R3(config)#int s1/0 
    
 
   
R3(config-if)#mpls ip 
    
 
   
R3(config-if)#int s1/1 
    
 
   
R3(config-if)#mpls ip
 
   
 
    
 
 
   
R4(config)#int s1/1 
    
 
   
R4(config-if)#mpls ip
 
  
在配置中会出现:
 
  
R2(config-if)# 
    
 
   
*Aug 25 16:44:10.967: %LDP-5-NBRCHG: TDP Neighbor 3.3.3.3:0 is UP
 
  
说明LDP邻居起来,配置成功。(其实MPLS的配置确实挺简单的^_^)
 
  
4.查看配置情况:
 
  
查看FLIB: 
   
 
  
R2#show mpls forwarding-table 
 
   
Local  Outgoing    Prefix            Bytes tag  Outgoing   Next Hop     
    
 
   
tag    tag or VC   or Tunnel Id      switched   interface               
    
 
   
16     Pop tag     34.1.1.0/24       0          Se1/1      point2point   
    
 
   
17     Untagged    3.3.3.3/32        0          Se1/1      point2point   
    
 
   
18     17          4.4.4.4/32        0          Se1/1      point2point


有个很奇怪的问题,为什么对3.3.3.3/32是Untagged而34.1.1.0/24是Pop tag?两条路由对R2来说是等效的!



再看标签的绑定:

R2#show mpls ldp bindings  
    
 
   
  tib entry: 2.2.2.0/24, rev 2 
    
 
   
        local binding:  tag: imp-null 
    
 
   
  tib entry: 2.2.2.2/32, rev 11 
    
 
   
        remote binding: tsr: 3.3.3.3:0, tag: 16 
    
 
   
  tib entry: 3.3.3.0/24, rev 12 
    
 
   
        remote binding: tsr: 3.3.3.3:0, tag: imp-null 
    
 
   
  tib entry: 3.3.3.3/32, rev 6 
    
 
   
        local binding:  tag: 16 
    
 
   
  tib entry: 4.4.4.4/32, rev 10 
    
 
   
        local binding:  tag: 18 
    
 
   
        remote binding: tsr: 3.3.3.3:0, tag: 17 
    
 
   
  tib entry: 23.1.1.0/24, rev 4 
    
 
   
        local binding:  tag: imp-null 
    
 
   
        remote binding: tsr: 3.3.3.3:0, tag: imp-null 
    
 
   
  tib entry: 34.1.1.0/24, rev 8 
    
 
   
        local binding:  tag: 17 
    
 
   
        remote binding: tsr: 3.3.3.3:0, tag: imp-null
 
  
又增加了一个问题为什么有两条对loopback0的路由?一条为2.2.2.0/24,另一条为2.2.2.2/32?
 
  
R2#show ip route
 
   
     2.0.0.0/24 is subnetted, 1 subnets 
    
 
   
C       2.2.2.0 is directly connected, Loopback0 
    
 
   
R3#show ip route
 
   
   2.0.0.0/32 is subnetted, 1 subnets
 
   
 O       2.2.2.2 [110/1563] via 23.1.1.1, 00:04:45, Serial1/0

在R2上直连的2.2.2.0掩码为24,而在R3上为32?想想OSPF对环回口的处理。



在R2上对直连接口未分发label,而R2又从R3上收到了关于2.2.2.2/32的标签16,R2发给R3的标签是关于2.2.2.0/24,而R3上无此条路由,同时R3未收到R2上关于2.2.2.2/32的标签,所以在R3上显示为Untagged,同理R2上显示的3.3.3.3/32也是Untagged.


现在进路由器的环回口添加: ip ospf network point-to-point!


现在看看:

R2#show mpls forwarding-table  
    
 
   
Local  Outgoing    Prefix            Bytes tag  Outgoing   Next Hop     
    
 
   
tag    tag or VC   or Tunnel Id      switched   interface               
    
 
   
17     Pop tag     34.1.1.0/24       0          Se1/1      point2point   
    
 
   
19     Pop tag     3.3.3.0/24        0          Se1/1      point2point   
    
 
   
20     19          4.4.4.0/24        0          Se1/1      point2point



总结:



1.       MPLS的配置很简单,但其原理、标签分发方式等知识点却相当多,需要很深入的了解。


2.       标签的分发是基于FEC(Forwarding Equivalent Class,转发等价类),只要相同的路由条目才能进行标签的交换,上面实验中,没在端口配置ip ospf network point-to-point时,标签的分发出现问题,原因就是两条路由非FEC。

https://blog.51cto.com/hyhgd/195706