MPBGP是在BGP-4 基础上的扩展,分为三种:ipv4--ipv4、ipv6---ipv6、ipv6--ipv4、ipv4--ipv6
本文主要介绍:ipv6---ipv4(在 建立ipv6 的BGP邻居上传递ipv4的路由)
实验拓扑:
R1:
router bgp 100
bgp router-id 1.1.1.1
bgp log-neighbor-changes
no bgp default ipv4-unicast
neighbor 10.1.1.2 remote-as 200
neighbor 2022::2 remote-as 200
!
address-family ipv4
network 1.1.1.1 mask 255.255.255.255 && 要传递路由
neighbor 2022::2 activate && 由于在ipv6 的BGP邻居上传递ipv4路由,所以要在此激活ipv6 邻居
neighbor 2022::2 route-map 22 in && R1 通过ipv6 的bgp 邻居会学习到 2.2.2.2 网段的路由
&& 但是该路由的下一跳,地址为ipv6 地址压缩后的,是错我的,所以这里要通过route-map 修改 为正确的。
exit-address-family
!
route-map 22 permit 10
match ip address 22
set ip next-hop 10.1.1.2
!
!
access-list 22 permit 2.2.2.2
R2:
router bgp 200
bgp log-neighbor-changes
no bgp default ipv4-unicast
neighbor 2022::1 remote-as 100
!
address-family ipv4
network 2.2.2.2 mask 255.255.255.255 && 要传递的路由
neighbor 2022::1 activate && 在ipv6 的BGP邻居上传递ipv4的路由,需要在此激活
neighbor 2022::1 route-map 11 in && 从邻居学习到1.1.1.1 网段的路由下一跳修改为ipv4的
exit-address-family
route-map 11 permit 10
match ip address 11
set ip next-hop 10.1.1.1
!
!
access-list 11 permit 1.1.1.1
R1#show ip bgp ipv4 unicast
BGP table version is 5, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.1/32 0.0.0.0 0 32768 i
*> 2.2.2.2/32 10.1.1.2 0 0 200 i
R1#
说明:1)如果下一跳没变过来,可以用clear ipv4 unicast * soft 强制在此交换路由、
2) show ip bgp summay 查看邻居
3) show bgp ipv4 unicast 查看bgp 路由