Cisco跨域三层××× OptionB配置指导

Cisco 跨域三层××× OptionB配置指导
 

1 跨域×××需求产生的背景

随着MPLS ×××解决方案的流行,网络的规模也在不断增加,在运营商的不一样城域网之间,或是同骨干网之间都存在着很是现实的跨越不一样自治域问题,这些都须要一个不一样于自治系统内MPLS ×××体系结构,即跨域的MPLS ×××,为了支持服务提供商之间的×××路由选择信息交换,须要一个新的机制,以即可以穿过提供商间的链路来广播路由前缀和标签信息,跨域×××的出现正是解决这个问题的。
 
目前跨域×××的技术方案主要有三种:
1VRF-TO-VRF(背靠背方式) option A
2MP-EBGP (单跳的MP-EBGP方式) option B
3MULTIHOP-EBGP(多跳的MP-EBGP方式) option C
我在这篇文章中首先讲述OptionB的跨域×××方案,即单跳的MP-EBGP方式,其余两种方式在后续的时间也会发布在个人blog中。

2 OptionB方式跨域×××描述

 
如上图,整个网络中存在3ASAS号分别为200300400,其中AS200AS400之间的×××有互通需求。
 
在这个网络中R2R3R43ASASBR,那么咱们在ASBR之间运行MP-EBGP协议,MP-EBGP将本身AS内的全部的×××信息传递给另一个AS,传递的是私网路由和标签信息,因为MP-EBGP在传递路由时,是要改变路由的下一跳,根据标签分配的原则,当一个FEC的下一跳被改变时,必须在本地更换标签,所以ASBR在收到AS内的×××路由信息,再向外发布时,必须给这些×××路由信息从新分配标签,×××路由信息伴随着新的标签被发布出去,而在ASBR本地,新旧标签造成一个标签的交换操做,这也是BGPnext-hop-self的来历之一。
 
对端的ASBR收到从MP-EBGP来的×××路由信息后,在本地保存,在继续向本身AS内的PE设备扩散,当这个ASBR向域内的MP-IBGP邻居发布路由时,它能够选择不改变路由的下一跳,或是将路由的下一跳改成本身,若是改变了路由的下一跳,同上面的标签分配原则,也须要为这些×××路由从新分配标签,在本地造成标签的交换操做。
 

3 ×××路由信息扩散的关键点

改变下一跳
本文的跨域×××采用的是改变下一跳的设计,即ASBR在于IBGP对等体创建邻居时,将下一跳指向本身,也就是说ASBRIBGP邻居发送×××路由时,会改变×××路由的下一跳指向ASBR,这样的话在ASBR之间不须要运行额外的如LDP之类的信令协议,由MBGP触发标签便可。反之,若是不改变下一跳,那么在ASBR之间是须要运行LDP之类的信令协议的,我的认为这样作虽然能够实现跨域×××的互通,可是不是很标准,因此在本文中均是采用改变下一跳的设计来发布×××路由信息的。
 
×××路由信息的过滤
报文转发时,须要ASBR都要对×××LSP作一次交换。还有一个问题须要注意的是,这种解决方案须要在ASBR上接收本AS内和AS外传过来的全部×××路由,而后在把×××给扩散出去,可是MPLS ×××的特性结构中要求,只有一个PE上有×××匹配一条×××路由时,这条×××路由才会被保存下来,所以对于上述ASBR上须要保存×××路由的需求必须作特殊的配置(由于ASBR上可能根本就没有配置×××),让ASBR把收到的×××路由所有的保存下来,而无论,本地是否有和它匹配的×××。这样的目的能够经过关闭BGP默认的route-target过滤来实现,也能够配置专门的策略来实现对×××路由信息的控制。为了省事起见,我这里采用直接关闭BGP默认的route-target过滤来实现。
因为这种方案须要在ASBR上保存全部的×××路由,所以这自己就是对路由器提出了很高的要求,使ASBR更容易成为故障点。不过只要×××的路由数量不是不少,这种方案不失为一种配置简单且实用的方案。
 

4 数据设计

因为通常的跨域×××配置示例都是两个AS,这里我故意调整成了三个AS,其实也没什么变化,就是多配置一些EBGP邻居而已。
 
Loopback地址202.1.1.X/32X=123456,即路由器序号;
接口地址80.X.Y.Z/24X/Y=路由器序号,Z12,路由器序号小的为1,大的为2
IGPPE-P-PE之间部署OSPFLDPASBR之间不起用任何IGP,只创建MEBGP邻居;
ASR1R2AS号为200R3AS号为300R4R6AS号为400
VrfR1上配置两个vrf
     Vrf20 RD=100:20  RT=100:20  路由为 10.0.30 .0/24
     Vrf30 RD=100:30  RT=100:30  路由为 10.0.30 .0/24
     配置为不一样***相同的路由是客观验证一下***路由地址重叠的状况。
    R6上配置两个vrf
     Vrf20 RD=100:20  RT=100:20  路由为60.0.20.0/24
     Vrf30 RD=100:30  RT=100:30  路由为60.0.30.0/24
验证:从R6ping R1上的vrf地址,在R4-R5之间的链路上抓包。
      分析报文的标签嵌套状况,正常状况应该是:
      R1-R6方向的报文应该是两层标签,
      R6-R1方向的报文应该是一层标签。
 

5 详细配置

为了节约版本,只罗列出6台路由器的相关配置,其余无关配置均不贴出来。
[R1]
   
R1#        
R1#show run
!
version 12.4
!
hostname R1
!
ip cef     
!
!
ip vrf vrf10
 rd 100:10 
 route-target export 100:10    
 route-target import 100:10    
!
ip vrf vrf20
 rd 100:20 
 route-target export 100:20    
 route-target import 100:20    
!
ip vrf vrf30
 rd 100:30 
 route-target export 100:30    
 route-target import 100:30    
!
interface Loopback0  
 ip address 202.1.1.1 255.255.255.255    
!
interface Ethernet4/0
 ip address 80.1.2.1 255.255.255.0       
 duplex full
 mpls ip   
!
interface Ethernet4/6
 ip vrf forwarding vrf20       
 ip address 10.0.30 .1 255.255.255.0      
 duplex half
!
interface Ethernet4/7
 ip vrf forwarding vrf30       
 ip address 10.0.30 .1 255.255.255.0      
 duplex half
!
router ospf 1        
 log-adjacency-changes
 network 80.1.2.0 0.0.0 .255 area 0       
 network 202.1.1.1 0.0.0 .0 area 0        
!
router bgp 200       
 no synchronization  
 bgp log-neighbor-changes       
 neighbor 202.1.1.2 remote-as 200        
 neighbor 202.1.1.2 update-source Loopback0        
 no auto-summary     
 !
 address-family ***v4
 neighbor 202.1.1.2 activate   
 neighbor 202.1.1.2 send-community extended        
 exit-address-family 
 !
 address-family ipv4 vrf vrf30 
 redistribute connected        
 no synchronization  
 exit-address-family 
 !
 address-family ipv4 vrf vrf20 
 redistribute connected        
 no synchronization  
 exit-address-family 
 !
 address-family ipv4 vrf vrf10 
 no synchronization  
 exit-address-family 
!
end   
 
[R2]
 
R2#show run
!
version 12.4
!
hostname R2
!
ip cef     
!
interface Loopback0  
 ip address 202.1.1.2 255.255.255.255    
!
interface Ethernet4/0
 ip address 80.1.2.2 255.255.255.0       
 duplex full
 mpls ip   
!
interface Ethernet4/1
 ip address 80.2.3.1 255.255.255.0       
 duplex full
!
router ospf 1        
 log-adjacency-changes
 network 80.1.2.0 0.0.0 .255 area 0       
 network 202.1.1.2 0.0.0 .0 area 0         
!
router bgp 200       
 no synchronization  
 no bgp default route-target filter      
 bgp log-neighbor-changes      
 neighbor 80.2.3.2 remote-as 300
 neighbor 202.1.1.1 remote-as 200        
 neighbor 202.1.1.1 update-source Loopback0         
 no auto-summary     
 !
 address-family ***v4
 neighbor 80.2.3.2 activate    
 neighbor 80.2.3.2 send-community extended
 neighbor 202.1.1.1 activate   
 neighbor 202.1.1.1 send-community extended        
 neighbor 202.1.1.1 next-hop-self         
 exit-address-family 
!
end    
 
[R3]
R3#show run
!
version 12.4
!
hostname R3
!
ip cef     
!
no mpls ip 
!
interface Loopback0  
 ip address 202.1.1.3 255.255.255.255    
!
interface Ethernet4/1
 ip address 80.2.3.2 255.255.255.0        
 duplex full
!
interface Ethernet4/2
 ip address 80.3.4.1 255.255.255.0       
 duplex half
!
router bgp 300       
 no synchronization  
 no bgp default route-target filter      
 bgp log-neighbor-changes      
 neighbor 80.2.3.1 remote-as 200
 neighbor 80.3.4.2 remote-as 400
 no auto-summary     
 !
 address-family ***v4
 neighbor 80.2.3.1 activate    
 neighbor 80.2.3.1 send-community extended
 neighbor 80.3.4.2 activate    
 neighbor 80.3.4.2 send-community extended
 exit-address-family 
!
end        
 
 [R4]
R4#show run
!
version 12.4
!
hostname R4
!
ip cef     
!
interface Loopback0  
 ip address 202.1.1.4 255.255.255.255    
!
interface Ethernet4/2
 ip address 80.3.4.2 255.255.255.0       
 duplex half
!
interface Ethernet4/3
 ip address 80.4.5.1 255.255.255.0       
 duplex half
 mpls ip   
!
router ospf 1        
 log-adjacency-changes
 network 80.3.4.0 0.0.0 .255 area 0       
 network 80.4.5.0 0.0.0 .255 area 0       
 network 202.1.1.4 0.0.0 .0 area 0        
!
router bgp 400       
 no synchronization  
 no bgp default route-target filter      
 bgp log-neighbor-changes      
 neighbor 80.3.4.1 remote-as 300
 neighbor 202.1.1.6 remote-as 400        
 neighbor 202.1.1.6 update-source Loopback0        
 no auto-summary     
 !
 address-family ***v4
 neighbor 80.3.4.1 activate    
 neighbor 80.3.4.1 send-community extended
 neighbor 202.1.1.6 activate   
 neighbor 202.1.1.6 send-community extended        
 neighbor 202.1.1.6 next-hop-self        
 exit-address-family 
!
end        
 
[R5]
R5#show run
!
version 12.4
!
hostname R5
!
ip cef     
!
interface Loopback0  
 ip address 202.1.1.5 255.255.255.255    
!
interface Ethernet4/0
 ip address 80.5.6.1 255.255.255.0       
 duplex half
 mpls ip   
!
interface Ethernet4/3
 ip address 80.4.5.2 255.255.255.0       
 duplex half
 mpls ip   
!
router ospf 1        
 log-adjacency-changes
 network 80.4.5.0 0.0.0 .255 area 0       
 network 80.5.6.0 0.0.0 .255 area 0       
 network 202.1.1.5 0.0.0 .0 area 0        
!
end  
 
[R6]
R6#show run
!
version 12.4
!
hostname R6
!
ip cef     
!
ip vrf vrf10
 rd 100:10 
 route-target export 100:10    
 route-target import 100:10    
!
ip vrf vrf20
 rd 100:20 
 route-target export 100:20    
 route-target import 100:20    
!
ip vrf vrf30
 rd 100:30 
 route-target export 100:30    
 route-target import 100:30    
!
interface Loopback0  
 ip address 202.1.1.6 255.255.255.255    
!
interface Ethernet4/0
 ip address 80.5.6.2 255.255.255.0       
 duplex half
 mpls ip   
!
interface Ethernet4/6
 ip vrf forwarding vrf20       
 ip address 60.0.20.1 255.255.255.0      
 duplex half
!
interface Ethernet4/7
 ip vrf forwarding vrf30       
 ip address 60.0.30.1 255.255.255.0       
 duplex half
!
router ospf 1        
 log-adjacency-changes
 network 80.5.6.0 0.0.0 .255 area 0       
 network 202.1.1.6 0.0.0 .0 area 0        
!
router bgp 400       
 no synchronization  
 bgp log-neighbor-changes      
 neighbor 202.1.1.4 remote-as 400        
 neighbor 202.1.1.4 update-source Loopback0        
 no auto-summary     
 !
 address-family ***v4
 neighbor 202.1.1.4 activate   
 neighbor 202.1.1.4 send-community extended        
 exit-address-family 
 !
 address-family ipv4 vrf vrf30 
 redistribute connected        
 no synchronization  
 exit-address-family 
 !
 address-family ipv4 vrf vrf20 
 redistribute connected        
 no synchronization  
 exit-address-family 
 !
 address-family ipv4 vrf vrf10 
 redistribute connected        
 no synchronization  
 exit-address-family 
!
end        
 

6 调试信息

查看各个BGP邻居上的私网路由和标签信息
[R1]
R1#show bgp ***v4 uni all      
BGP table version is 15, local router ID is 202.1.1.1        
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,  
    r RIB-failure, S Stale     
Origin codes: i - IGP, e - EGP, ? - incomplete     
 
   NetworkNext Hop  Metric LocPrf Weight Path      
Route Distinguisher: 100:20 (default for vrf vrf20)
*> 10.0.30 .0/24     0.0.0 .0        0         32768 ?
*>i60.0.20.0/24     202.1.1.2      0    100      0 300 400 ? 
Route Distinguisher: 100:30 (default for vrf vrf30)
*> 10.0.30 .0/24     0.0.0 .0        0         32768 ?
*>i60.0.30.0/24     202.1.1.2      0    100      0 300 400 ? 
 
R1#show bgp ***v4 uni all labels
   NetworkNext Hop      In label/Out label
Route Distinguisher: 100:20 (vrf20)      
   10.0.30 .0/24     0.0.0 .0         17/aggregate(vrf20)      
   60.0.20.0/24     202.1.1.2       nolabel/23     
Route Distinguisher: 100:30 (vrf30)      
   10.0.30 .0/24     0.0.0 .0         18/aggregate(vrf30)      
   60.0.30.0/24     202.1.1.2       nolabel/22     
 
[R2]
R2#show bgp ***v4 uni all      
BGP table version is 9, local router ID is 202.1.1.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,  
    r RIB-failure, S Stale     
Origin codes: i - IGP, e - EGP, ? - incomplete     
 
   NetworkNext Hop  Metric LocPrf Weight Path      
Route Distinguisher: 100:20    
*>i 10.0.30 .0/24     202.1.1.1      0    100      0 ?
*> 60.0.20.0/24     80.2.3.2 0 300 400 ? 
Route Distinguisher: 100:30    
*>i 10.0.30 .0/24     202.1.1.1      0    100      0 ?
*> 60.0.30.0/24     80.2.3.2 0 300 400 ? 
 
R2#show bgp ***v4 uni all labels
   NetworkNext Hop      In label/Out label
Route Distinguisher: 100:20    
   10.0.30 .0/24     202.1.1.1       18/17
   60.0.20.0/24     80.2.3.2        23/20
Route Distinguisher: 100:30    
   10.0.30 .0/24     202.1.1.1       19/18
   60.0.30.0/24     80.2.3.2        22/21
 
[R3]
R3#show bgp ***v4 uni all      
BGP table version is 5, local router ID is 202.1.1.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,  
    r RIB-failure, S Stale     
Origin codes: i - IGP, e - EGP, ? - incomplete     
 
   NetworkNext Hop  Metric LocPrf Weight Path      
Route Distinguisher: 100:20    
*> 10.0.30 .0/24     80.2.3.1 0 200 ?     
*> 60.0.20.0/24     80.3.4.2 0 400 ?     
Route Distinguisher: 100:30    
*> 10.0.30 .0/24     80.2.3.1 0 200 ?     
*> 60.0.30.0/24     80.3.4.2 0 400 ?     
 
R3#show bgp ***v4 uni all labels
   NetworkNext Hop      In label/Out label
Route Distinguisher: 100:20    
   10.0.30 .0/24     80.2.3.1        19/18
   60.0.20.0/24     80.3.4.2        20/22
Route Distinguisher: 100:30    
   10.0.30 .0/24     80.2.3.1        18/19
   60.0.30.0/24     80.3.4.2        21/23
 
 
[R4]
R4#show bgp ***v4 uni all      
BGP table version is 9, local router ID is 202.1.1.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,  
    r RIB-failure, S Stale     
Origin codes: i - IGP, e - EGP, ? - incomplete     
 
   NetworkNext Hop  Metric LocPrf Weight Path      
Route Distinguisher: 100:20    
*> 10.0.30 .0/24     80.3.4.1 0 300 200 ? 
*>i60.0.20.0/24     202.1.1.6      0    100      0 ?
Route Distinguisher: 100:30    
*> 10.0.30 .0/24     80.3.4.1 0 300 200 ? 
*>i60.0.30.0/24     202.1.1.6      0    100      0 ?
 
R4#show bgp ***v4 uni all labels
   NetworkNext Hop      In label/Out label
Route Distinguisher: 100:20    
   10.0.30 .0/24     80.3.4.1        25/19
   60.0.20.0/24     202.1.1.6       22/20
Route Distinguisher: 100:30    
   10.0.30 .0/24     80.3.4.1        24/18
   60.0.30.0/24     202.1.1.6       23/21
 
 
[R6]
R6#show bgp ***v4 uni all      
BGP table version is 15, local router ID is 202.1.1.6        
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,  
    r RIB-failure, S Stale     
Origin codes: i - IGP, e - EGP, ? - incomplete      
 
   NetworkNext Hop  Metric LocPrf Weight Path      
Route Distinguisher: 100:20 (default for vrf vrf20)
*>i 10.0.30 .0/24     202.1.1.4      0    100      0 300 200 ? 
*> 60.0.20.0/24     0.0.0 .0        0         32768 ?
Route Distinguisher: 100:30 (default for vrf vrf30)
*>i 10.0.30 .0/24     202.1.1.4      0    100      0 300 200 ? 
*> 60.0.30.0/24     0.0.0 .0        0         32768 ?
 
R6#show bgp ***v4 uni all labels
   NetworkNext Hop      In label/Out label
Route Distinguisher: 100:20 (vrf20)       
   10.0.30 .0/24     202.1.1.4       nolabel/25     
   60.0.20.0/24     0.0.0 .0         20/aggregate(vrf20)      
Route Distinguisher: 100:30 (vrf30)      
   10.0.30 .0/24     202.1.1.4       nolabel/24     
   60.0.30.0/24     0.0.0 .0         21/aggregate(vrf30)      
 
从上面的标签信息能够明显的看出MBGP×××路由触发的标签状况,即在跨域的时候报文中是靠这些标签指导转发的,也从侧面印证了前文中[改变下一跳]中所描述的×××路由触发标签分配的状况。
 
查看实际的mpls标签转发表
[R1]
R1#show mpls forwarding-table  
Local  Outgoing    Prefix  Bytes tag  Outgoing   Next Hop    
tag    tag or VC   or Tunnel Id      switched   interface    
16     Pop tag     202.1.1.2/32      0Et4/0      80.1.2.2    
17     Aggregate   10.0.30 .0/24[V]   0   
18     Aggregate   10.0.30 .0/24[V]   0   
 
[R2]
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     202.1.1.1/32      0Et4/0      80.1.2.1    
17     Pop tag     80.2.3.2/32       0Et4/1      80.2.3.2    
18     17    100:20: 10.0.30 .0/24    \         0Et4/0      80.1.2.1    
19     18    100:30: 10.0.30 .0/24    \         0Et4/0      80.1.2.1    
22     21    100:30:60.0.30.0/24    \         0Et4/1      80.2.3.2    
23     20    100:20:60.0.20.0/24    \         0Et4/1      80.2.3.2    
 
[R3]
R3#show mpls forwarding-table  
Local  Outgoing    Prefix  Bytes tag  Outgoing   Next Hop    
tag    tag or VC   or Tunnel Id      switched   interface    
16     Pop tag     80.2.3.1/32       0Et4/1      80.2.3.1    
17     Pop tag     80.3.4.2/32       0Et4/2      80.3.4.2    
18     19    100:30: 10.0.30 .0/24    \         0Et4/1      80.2.3.1    
19     18    100:20: 10.0.30 .0/24    \         0Et4/1      80.2.3.1    
20     22    100:20:60.0.20.0/24    \         0Et4/2      80.3.4.2    
21     23    100:30:60.0.30.0/24    \         0Et4/2      80.3.4.2    
 
[R4]
R4#show mpls forwarding-table  
Local  Outgoing    Prefix  Bytes tag  Outgoing   Next Hop    
tag    tag or VC   or Tunnel Id      switched   interface    
16     Pop tag     80.3.4.1/32       0Et4/2      80.3.4.1    
17     Pop tag     80.5.6.0/24       0Et4/3      80.4.5.2    
18     Pop tag     202.1.1.5/32      0Et4/3      80.4.5.2    
19     18    202.1.1.6/32      0Et4/3      80.4.5.2    
22     18    100:20:60.0.20.0/24    \         0Et4/3      80.4.5.2    
23     18    100:30:60.0.30.0/24    \         0Et4/3      80.4.5.2    
24     18    100:30: 10.0.30 .0/24    \         0Et4/2      80.3.4.1    
25     19    100:20: 10.0.30 .0/24    \         0Et4/2      80.3.4.1    
 
[R5]
R5#show mpls forwarding-table  
Local  Outgoing    Prefix  Bytes tag  Outgoing   Next Hop    
tag    tag or VC   or Tunnel Id      switched   interface    
16     Pop tag     80.3.4.0/24       0Et4/3      80.4.5.1    
17     Pop tag     202.1.1.4/32      73         Et4/3      80.4.5.1    
18     Pop tag     202.1.1.6/32      8236       Et4/0      80.5.6.2    
 
[R6]
R6#show mpls forwarding-table  
Local  Outgoing    Prefix  Bytes tag  Outgoing   Next Hop    
tag    tag or VC   or Tunnel Id      switched   interface    
16     Pop tag     80.4.5.0/24       0Et4/0      80.5.6.1    
17     16    80.3.4.0/24       0Et4/0      80.5.6.1    
18     17    202.1.1.4/32      0Et4/0      80.5.6.1    
19     Pop tag     202.1.1.5/32      0Et4/0      80.5.6.1    
20     Aggregate   60.0.20.0/24[V]   0   
21     Aggregate   60.0.30.0/24[V]   0   
 
从上面的信息咱们看出,在ASBR上可以明显的看到×××V4的路由信息对应的标签转发项。
 
公网标签和私网标签
前面提到从R6ping R1上的vrf地址,在R4-R5之间的链路上抓包。而后分析报文的标签嵌套状况,正常状况应该是:     
R1-R6方向的报文应该是两层标签,公网标签+私网标签;
R6-R1方向的报文应该是一层标签,公网标签被弹出,只剩余私网标签。
能够经过下面的抓包图片进行验证:
R1-R6方向的两层标签
 
 
R6-R1方向的一层标签
 
 
根据朋友的提醒,在此增长从R6到R1的私网路由trace信息,能够清楚的看到沿途标签信息的变化:
R6#traceroute vrf vrf30
Protocol [ip]:   
Target IP address: 10.0.30.1 
Source address: 60.0.30.1    
Numeric display [n]:   
Resolve AS number in (G)lobal table, (V)RF or(N)one [G]:   
Timeout in seconds [3]:
Probe count [3]: 
Minimum Time to Live [1]:    
Maximum Time to Live [30]:   
Port Number [33434]:   
Loose, Strict, Record, Timestamp, Verbose[none]:
Type escape sequence to abort.
Tracing the route to 10.0.30.1
  1 80.5.6.1 [MPLS: Labels 17/21 Exp 0] 180 msec 224 msec 144 msec  2 80.4.5.1 [MPLS: Label 21 Exp 0] 156 msec 208 msec 192 msec      3 80.3.4.1 [MPLS: Label 18 Exp 0] 180 msec 272 msec 236 msec      4 80.2.3.1 [MPLS: Label 19 Exp 0] 164 msec 192 msec 364 msec      5 10.0.30.1 220 msec 196 msec *
相关文章
相关标签/搜索