本文解决核心问题是单一CE节点到PE节点指定VRF的BGP建邻居。
整体网络拓扑上图所示,PE汇聚路由已与边缘客户路由建邻,指派10.10.10.0/24网段。重点:其中PE端上与CE端互联的端口必须已指定到创建好的vrf或netns上,该工作需要LinuxShell中执行iproute2命令。
1.PE
汇聚路由BGP设置入下图所示
router bgp 100
bgp router-id 10.10.20.2
!
router bgp 100 vrf vrf1
bgp router-id 10.10.10.1
neighbor 10.10.10.2 remote-as 50
!
address-family ipv4 unicast
rd vpn export 100:10
rt vpn both 100:10
exit-address-family
!
2.CE
边缘路由BGP设置入下图所示
router bgp 50
bgp router-id 10.10.10.2
network 192.168.1.0/24
neighbor 10.10.10.1 remote-as 100
!
3.查询BGP联通
#通过如下命令,确认BGP建立连接状态;其中00:19:34后面的数字1,代表接收的路由条目;
$show ip bgp vrf vrf1 summary
IPv4 Unicast Summary:
BGP router identifier 10.10.10.1, local AS number 100 vrf-id 1
BGP table version 1
RIB entries 1, using 184 bytes of memory
Peers 1, using 20 KiB of memory
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
10.10.10.2 4 50 24 23 0 0 0 00:19:34 1
Total number of neighbors 1
#通过如下命令,确定转发到vrf1中的路由
$show ip bgp vrf vrf1
BGP table version is 1, local router ID is 10.10.10.1, vrf id 1
Default local pref 100, local AS 100
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 192.168.1.0/24 10.10.10.2 0 0 50 i
Displayed 1 routes and 1 total paths