A-A+

isp mpls专线的实现技术和配置命令行

2016年01月28日 站长资讯 暂无评论

背景两家公司通过同一个isp接入,完成mpls vpn专线使各个公司能够访问内部网络。

忘了一点,如果mpls协议的底层协议是ospf。需要将lo 设置成32位地址,这边我将R6 R7设置位32为R1 R5 24没有问题。

本文还是个人笔记,如有错误请各位大神指正。摘抄已注明出处,如果有问题,单聊我,我会进行处理。

拓扑如上:

ip:RX-RY: RX: XY.1.1.X L0:X.X.X.X RY:XY.1.1.Y L0:Y.Y.Y.Y

首先配置R2-R3-R4 isp网络。这边使用ospf协议保证isp网络互通,使用bgp协议(VRf)进行传递私网路由,使用mpls标签进行快速转发。

  1. R2:  
  2. os 1   
  3. net 23.1.1.2 0.0.0.0 a 0  
  4. net 2.2.2.2 0.0.0.0 a 0  
  5. R3:  
  6. os 1  
  7. net 23.1.1.3 0.0.0.0 a 0  
  8. net 3.3.3.3 0.0.0.0 a 0  
  9. net 34.1.1.3 0.0.0.0 a 0  
  10. R4:  
  11. os 1   
  12. net 34.1.1.4 0.0.0.0 a 0  
  13. net 4.4.4.4 0.0.0.0 a 0  

完成上述配置,R2,R3,R4已经能够建立ospf邻居,ok这边因为主要是讲mpls,所以就不加ospf区域验证之类的了。

然后开启mpls

R2-R4

ip cef

int 所有公网接口 mpls ip 注:不包括和公司路由对接的接口如R2只在S1/2开启mpls ip

mpls label range 200 299 / 300 399 / 400 499 便于排错 开启标签范围

完成上述配置,可以通过sh mpls for 查看lable

  1. R3#sh mpls forwarding-table   
  2. Local  Outgoing    Prefix            Bytes tag  Outgoing   Next Hop      
  3. tag    tag or VC   or Tunnel Id      switched   interface                
  4. 300    Pop tag     4.4.4.4/32        7647       Se1/1      point2point    
  5. 301    Pop tag     2.2.2.2/32        6009       Se1/0      point2point    

然后是R2 R4 开启mp-bgp 用于传递vrf路由(关于vrf技术,你可以认为把一台路由器当成多台路由器进行使用,主要区别各个虚拟路由器使用单独的路由表)

  1. R2 :  
  2. router b 2  
  3.  bgp router-id 2.2.2.2  
  4.  no bgp default ipv4-unicast  
  5.  neighbor 4.4.4.4 remote-as 4  
  6.  neighbor 4.4.4.4 ebgp-multihop 255  
  7.  neighbor 4.4.4.4 update-source Loopback0  
  8.  address-family vpnv4  
  9.   neighbor 4.4.4.4 activate  
  10.   neighbor 4.4.4.4 send-community extended  //默认开启,因为需要传递私网路由。所以要加属性  
  11.  exit-address-family  

R4:

跟R2差不多就是改一下地址

查看结果用sh ip bgp vpnv4 all su

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd

2.2.2.2 4 2 95 85 19 0 0 01:14:46 3

下面就是重点了:

  1. R2:  
  2. ip vrf b  
  3.  rd 2:2   //  
  4.  route-target export 2:2  
  5.  route-target import 2:2  
  6. !           
  7. ip vrf gongsia  
  8.  rd 1:1     
  9.  route-target export 1:1  
  10.  route-target import 1:1  
  11. RD (Route Distinguisher)  

用于标识PE上不同VPN实例,其主要作用是实现VPN实例之间地址复用,与IP地址一起构成12 Bytes的VPNv4地址。

RD与路由一起被携带在BGP Update报文中发送给对端。

RD不具有选路能力,不影响路由的发送与接受。

RD用来区分本地VRF,本地有效。

RT (Route Target)

RT是VPNv4路由携带的一个重要属性,它决定VPN路由的收发和过滤,PE依靠RT属性区分不同VPN之间路由。

当从VRF表中导出VPN路由时,要用Export RT对VPN路由进行标记。

当往VRF表中导入VPN路由时,只有所带RT标记与VRF表中任意一个Import RT相符的路由才会被导入到VRF表中。

----来自http://blog.sina.com.cn/s/blog_6a6b6f1a0100yzv5.html

分别把和公司A,公司b的接口加入的相关的vrf 下:

R2

interface Serial1/1

ip vrf forwarding b

//熟悉了之后先把接口加到vrf下再配置地址,否则你会发现介入vrf后没地址了

interface Serial1/0

ip vrf forwarding gongsia

R4做相同配置

下面是如何保证公司路由和isp的vrf进行路由的交换以及和公司分部的路由交换配置:

R6-R2 R7-R4

这边我们采用的是ospf协议进行互通

这边首先要指导,R2 和R4 已经使用了os 1 。

这边我们使用ospf 10 进行互联,基本配置就不贴了。重点是R2和R4的ospf 进程要写:

  1. R2:  
  2. router ospf 10 vrf gongsia  //ospf进程需要写入vrf中,eigrp需要指定进程号  
  3.  log-adjacency-changes  
  4.  redistribute bgp 2 subnets  //这边是用于将私网路由重分布到bgp 中进行传递路由  
  5.  network 26.1.1.2 0.0.0.0 area 0  
  6. ip route vrf b 1.1.1.0 255.255.255.0 Serial1/1  公司b我们通过静态路由写,也要写入vrf中  
  7. route b 2  
  8.  address-family ipv4 vrf gongsia  
  9.   redistribute ospf 10 vrf gongsia  //分别在不同bgp vrf下重分布相应的和ce端路由协议  
  10.   no synchronization  
  11.  exit-address-family       
  12.  !  
  13.  address-family ipv4 vrf b  
  14.   redistribute static     
  15.   no synchronization  
  16.  exit-address-family  
  17. R4:  
  18. R4#sh run | s ospf  
  19. router ospf 10 vrf gongsia  
  20.  router-id 47.1.1.4  
  21.  log-adjacency-changes  
  22.  redistribute bgp 4 subnets  
  23.  network 47.1.1.4 0.0.0.0 area 0  
  24. router ospf 1  
  25.  log-adjacency-changes  
  26.  network 4.4.4.4 0.0.0.0 area 0  
  27.  network 34.1.1.4 0.0.0.0 area 0  
  28.   redistribute ospf 10 vrf gongsia  
  29. R4#sh run | s bgp  
  30.  redistribute bgp 4 subnets  
  31. router bgp 4  
  32.  bgp router-id 4.4.4.4  
  33.  no bgp default ipv4-unicast  
  34.  bgp log-neighbor-changes  
  35.  neighbor 2.2.2.2 remote-as 2  
  36.  neighbor 2.2.2.2 ebgp-multihop 255  
  37.  neighbor 2.2.2.2 update-source Loopback0  
  38.  !  
  39.  address-family vpnv4  
  40.   neighbor 2.2.2.2 activate  
  41.   neighbor 2.2.2.2 send-community extended  
  42.  exit-address-family  
  43.  !  
  44.  address-family ipv4 vrf gongsia  
  45.   redistribute ospf 10 vrf gongsia  
  46.   no synchronization  
  47.  exit-address-family  
  48.  !  
  49.  address-family ipv4 vrf b  
  50.   redistribute static  
  51.   no synchronization  
  52.  exit-address-family  

R3只要开启mpls功能即可,不要其他配置。

查看mpls 邻居,以及lable标签

  1. R4#sh mpls ldp bindings   
  2.   tib entry: 2.2.2.2/32, rev 8  
  3.         local binding:  tag: 401  
  4.         remote binding: tsr: 3.3.3.3:0, tag: 301  
  5.   tib entry: 3.3.3.3/32, rev 6  
  6.         local binding:  tag: 400  
  7.         remote binding: tsr: 3.3.3.3:0, tag: imp-null  
  8.   tib entry: 4.4.4.4/32, rev 4  
  9.         local binding:  tag: imp-null  
  10.         remote binding: tsr: 3.3.3.3:0, tag: 300  
  11.   tib entry: 23.1.1.0/24, rev 10  
  12.         local binding:  tag: 402  
  13.         remote binding: tsr: 3.3.3.3:0, tag: imp-null  
  14.   tib entry: 34.1.1.0/24, rev 3  
  15.         local binding:  tag: imp-null  
  16.         remote binding: tsr: 3.3.3.3:0, tag: imp-null  
  17. R4#sh mpls ldp  
  18. R4#sh mpls ldp ne  
  19. R4#sh mpls ldp neighbor   
  20.     Peer LDP Ident: 3.3.3.3:0; Local LDP Ident 4.4.4.4:0  
  21.         TCP connection: 3.3.3.3.646 - 4.4.4.4.60420  
  22.         State: Oper; Msgs sent/rcvd: 109/110; Downstream  
  23.         Up time: 01:30:04  http://www.xiaoxiongboke.com/  
  24.         LDP discovery sources:  
  25.           Serial1/0, Src IP addr: 34.1.1.3  
  26.         Addresses bound to peer LDP Ident:  
  27.           23.1.1.3        3.3.3.3         34.1.1.3      
  28. R5#ping 1.1.1.1 so 5.5.5.5  //最后ping的时候需要加源  
  29.    
  30. Type escape sequence to abort.  
  31. Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:  
  32. Packet sent with a source address of 5.5.5.5   
  33. !!!!!  
  34. Success rate is 100 percent (5/5), round-trip min/avg/max = 140/160/184 ms  
标签:

给我留言