1. Topology
CE1------[R1(PE1)---R2(P)---R3(ASBR1)]------[R4(ASBR2)----R5(PE2)]----------CE2
                              [AS 100]                                              [AS 200]

2. 基本原理
    PE与ASBR之间不需要建立IBGP邻居,只是ASBR之间建立EBGP,PE之间建立MP-EBGP邻居。PE之间的可达性,是将ASBR将BGP路由重新分发到IGP中来保证的。
3. 标签分配过程
    ×××私网标签由PE1直接分配给PE2;
    到 PE1 Loopback接口地址的公网标签逐跳分发。需要说明的是,公网标签在域内是由LDP来分发的,在域间是由MP-EBGP来分发的。
4. 标签转发过程
    非常简单,和MP-IBGP MPLS ×××的转发过程一样
    
5. 特点
    ASBR 上不需要感知×××的存在,只需要PE来维护×××路由和私网标签转发表。
    
6. 各LSR上的相关表项
- R1 (PE1 in AS 100)
C3600-R1#show ip bgp ***v4 all labels                                          
   Network          Next Hop      In label/Out label                            
Route Distinguisher: 100:1 (***-a)                                              
   10.16.1.0/24     0.0.0.0         20/aggregate(***-a)
  
C3600-R1#show mpls forwarding-table                                            
Local  Outgoing    Prefix            Bytes tag  Outgoing   Next Hop            
tag    tag or VC   or Tunnel Id      switched   interface                              
20     Aggregate   10.16.1.0/24[V]   5752                                
C3600-R1#show ip cef vrf ***-a 10.16.1.0 255.255.255.0                          
10.16.1.0/24, version 7, epoch 0, attached, connected                          
0 packets, 0 bytes                                                              
  tag information set                                                          
    local tag: 20                                                              
  via FastEthernet1/0, 0 dependencies                                          
    valid glean adjacency                                                      
    tag rewrite with , , tags imposed: {}                                

- R2 (P in AS 100)
P路由器感知不到××× LSP,所以只需要关注公网LSP
C3600-R2#sho mpls forwarding-table                                              
Local  Outgoing    Prefix            Bytes tag  Outgoing   Next Hop            
tag    tag or VC   or Tunnel Id      switched   interface                      
16     Pop tag     1.1.1.1/32        31006      Fa0/0      172.16.12.1                            
- R3 (ASBR1 in AS 100)
ASBR不感知×××的存在
实际上,这个公网标签都是由LDP分配的,但 BGP会使用该标签继续分配给EBGP邻居                
C3600-R3#show mpls forwarding-table                                            
Local  Outgoing    Prefix            Bytes tag  Outgoing   Next Hop            
tag    tag or VC   or Tunnel Id      switched   interface                                
17     16          1.1.1.1/32        3984       Fa0/0      172.16.23.2            
可以看出,BGP分配的这个公网标签是来自LDP 的                                                      
C3600-R3#show ip bgp labels                                                    
Network          Next Hop         In Label/Out Label                            
1.1.1.1/32       172.16.23.2      17/nolabel                                    
C3600-R3#show ip bgp 1.1.1.1                                                    
BGP routing table entry for 1.1.1.1/32, version 5                              
Paths: (1 available, best #1, table Default-IP-Routing-Table)                  
  Advertised to update-groups:                                                  
     1                                                                          
  Local                                                                        
    172.16.23.2 from 0.0.0.0 (3.3.3.3)                                          
      Origin IGP, metric 3, localpref 100, weight 32768, valid, sourced, local,
best                                                                            
      mpls labels in/out 17(from LDP)/nolabel
- R4 (ASBR2 in AS 200)
这个公网标签都是由EBGP分配的
C3600-R4#show mpls forwarding-table                                            
Local  Outgoing    Prefix            Bytes tag  Outgoing   Next Hop            
tag    tag or VC   or Tunnel Id      switched   interface                            
18     17          1.1.1.1/32        4395       Fa0/0      172.16.34.3          
                                                      
C3600-R4#show ip bgp labels                                                    
Network          Next Hop         In Label/Out Label                            
1.1.1.1/32       172.16.34.3      18/17                                                                        
                                                                                                                          
C3600-R4#show ip bgp 1.1.1.1                                                    
BGP routing table entry for 1.1.1.1/32, version 4                              
Paths: (1 available, best #1, table Default-IP-Routing-Table)                  
  Not advertised to any peer                                                    
  100                                                                          
    172.16.34.3 from 172.16.34.3 (3.3.3.3)                                      
      Origin IGP, metric 3, localpref 100, valid, external, best                
      mpls labels in/out 18/17
- R5 (PE2 in AS 200)
C3600-R5#show mpls forwarding-table                                            
Local  Outgoing    Prefix            Bytes tag  Outgoing   Next Hop            
tag    tag or VC   or Tunnel Id      switched   interface                          
20     18          1.1.1.1/32        0          Fa0/0      172.16.45.4          
                                                                        
C3600-R5#show ip bgp ***v4 all labels                                          
   Network          Next Hop      In label/Out label                            
Route Distinguisher: 100:1 (***-a)                                              
   10.16.1.0/24     1.1.1.1         nolabel/20                                                        
                                                      
C3600-R5#show ip cef vrf ***-a 10.16.1.0 255.255.255.0                          
10.16.1.0/24, version 8, epoch 0, cached adjacency 172.16.45.4                  
0 packets, 0 bytes                                                              
  tag information set                                                          
    local tag: ×××-route-head                                                  
    fast tag rewrite with Fa0/0, 172.16.45.4, tags imposed: {18 20}            
  via 1.1.1.1, 0 dependencies, recursive                                        
    next hop 172.16.45.4, FastEthernet0/0 via 1.1.1.1/32                        
    valid cached adjacency                                                      
    tag rewrite with Fa0/0, 172.16.45.4, tags imposed: {18 20}

C3600-R5#traceroute vrf ***-a 10.16.1.1                                        
                                                                                
Type escape sequence to abort.                                                  
Tracing the route to 10.16.1.1                                                  
                                                                                
  1 172.16.45.4 [MPLS: Labels 18/20 Exp 0] 180 msec 244 msec 308 msec          
  2 172.16.34.3 [MPLS: Labels 17/20 Exp 0] 220 msec 500 msec 252 msec          
  3 172.16.23.2 [MPLS: Labels 16/20 Exp 0] 216 msec 224 msec 244 msec          
  4 10.16.1.1 [MPLS: Label 20 Exp 0] 280 msec 356 msec *  
7. 额外配置
在实现Option C时,需要在ASBR上做一些额外的配置,让EBGP邻居之间发布公网标签
neighbor 172.16.34.4 route-map Rec_200 in                                      
neighbor 172.16.34.4 route-map Adv_200 out                                    
neighbor 172.16.34.4 send-label  

route-map Rec_200 permit 10                                                    
  match ip address prefix-list Rec_200                                          
  match mpls-label                                                              
route-map Adv_200 permit 10                                                    
  match ip address prefix-list Adv_200                                          
  set mpls-label
  
ip prefix-list Adv_200 seq 10 permit 1.1.1.1/32                                
ip prefix-list Rec_200 seq 10 permit 5.5.5.5/32
如果要为所有的公网地址都发送标签,可以不用配置route-map,只需要一条”neighbor 172.16.34.4 send-label“就搞定了。