架构图:
R2/R5基本配置:
ip vpn-instance xaf ipv4-family route-distinguisher 100:1 vpn-target 100:1 export-extcommunity vpn-target 200:1 import-extcommunity # bgp 100 undo default ipv4-unicast peer 10.1.5.5 as-number 100 peer 10.1.5.5 connect-interface LoopBack0 # ipv4-family unicast undo synchronization undo peer 10.1.5.5 enable # ipv4-family vpnv4 policy vpn-target peer 10.1.5.5 enable # ipv4-family vpn-instance xaf # ospf 20 router-id 10.1.2.2 area 0.0.0.0 network 10.1.2.2 0.0.0.0 network 10.1.23.2 0.0.0.0 |
ip vpn-instance xaf ipv4-family route-distinguisher 200:1 vpn-target 200:1 export-extcommunity vpn-target 100:1 import-extcommunity # bgp 100 undo default ipv4-unicast peer 10.1.2.2 as-number 100 peer 10.1.2.2 connect-interface LoopBack0 # ipv4-family unicast undo synchronization undo peer 10.1.2.2 enable # ipv4-family vpnv4 policy vpn-target peer 10.1.2.2 enable # ipv4-family vpn-instance xaf # ospf 20 router-id 10.1.5.5 area 0.0.0.0 network 10.1.5.5 0.0.0.0 network 10.1.45.5 0.0.0.0 |
1、静态路由
[R2]ip route-static vpn-instance xaf 10.1.1.1 32 10.1.12.1
[R5]ip route-static vpn-instance xaf 10.1.6.6 32 10.1.56.6
R2/R5:
bgp 100
ipv4-family vpn-instance xaf
import-route static
[R1]ip route-static 0.0.0.0 0.0.0.0 10.1.12.2
[R6]ip route-static 0.0.0.0 0.0.0.0 10.1.56.5
数据平面
1、第一层标签MP-BGP分配的,为VPNV4路由分配;
2、以R5为参考点,R2为R1过来的路由信息分配标签给R5;
3、在R5上,收到VPNV4的路由信息。
<R5>dis bgp vpnv4 all routing-table label
BGP Local router ID is 10.1.45.5
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total number of routes from all PE: 2
Route Distinguisher: 100:1
Network NextHop In/Out Label
*>i 10.1.1.1 10.1.2.2 NULL/1029 R2分的标签(出标签,令居分配给我的)
Route Distinguisher: 200:1
Network NextHop In/Out Label
*> 10.1.6.6 10.1.56.6 1029/NULL
VPN-Instance xaf, Router ID 10.1.45.5:
Total Number of Routes: 1
Network NextHop In/Out Label
*>i 10.1.1.1 10.1.2.2 NULL/1029
同理:
<R2>dis bgp vpnv4 all routing-table label
BGP Lo