现场SWB上接口绑定三个不同的VPN实例,SWA和SWB建立BGP邻居,需要实现SWA和SWC可以互通,SWA和SWD也可以互通。
VRF3引入了vrf1和vrf2的路由,bgp-vrf3里引入直连或network,SWA都收不到SWC和SWD的路由(192.168.1.0和192.168.2.0网段)。
SWB主要配置:
#
ip vpn-instance vrf1
route-distinguisher 100:100
#
ip vpn-instance vrf2
route-distinguisher 200:200
#
ip vpn-instance vrf3
route-distinguisher 300:300
#
address-family ipv4
route-replicate from vpn-instance vrf1 protocol direct
route-replicate from vpn-instance vrf2 protocol direct
#
#
bgp 100
#
ip vpn-instance vrf3
peer 192.168.3.1 as-number 100
#
address-family ipv4 unicast
import-route direct
network 192.168.1.0 255.255.255.0
peer 192.168.3.1 enable
#
#
interface GigabitEthernet1/0/1
port link-mode route
ip binding vpn-instance vrf3
ip address 192.168.3.254 255.255.255.0
#
interface GigabitEthernet1/0/2
port link-mode route
ip binding vpn-instance vrf1
ip address 192.168.1.254 255.255.255.0
#
interface GigabitEthernet1/0/3
port link-mode route
ip binding vpn-instance vrf2
ip address 192.168.2.254 255.255.255.0
#
SWA主要配置:
#
bgp 100
peer 192.168.3.254 as-number 100
#
address-family ipv4 unicast
peer 192.168.3.254 enable
#
SWA上学习不到192.168.1.0和192.168.2.0网段的路由:
<SWA>dis ip routing-table
Destinations : 13 Routes : 13
Destination/Mask Proto Pre Cost NextHop Interface
192.168.3.0/24 Direct 0 0 192.168.3.1 GE1/0/1
192.168.3.0/32 Direct 0 0 192.168.3.1 GE1/0/1
192.168.3.1/32 Direct 0 0 127.0.0.1 InLoop0
192.168.3.255/32 Direct 0 0 192.168.3.1 GE1/0/1
<SWA>dis bgp routing-table ipv4
Total number of routes: 1
BGP local router ID is 2.2.2.2
Status codes: * - valid, > - best, d - dampened, h - history
s -
suppressed, S - stale, i - internal, e - external
a -
additional-path
Origin: i - IGP, e - EGP, ? - incomplete
Network
NextHop MED LocPrf
PrefVal Path/Ogn
* >i 192.168.3.0 192.168.3.254
0 100 0
?
1、用route-replicate命令引入的路由无法在BGP里面传递,所以需要用RT、RD值的方式引入路由,在BGP中传播;不同VPN实例需要互访,必须保证访问实例的出方向RT值和被访问实例的入方向RT值相同;否则路由是不会加入对应VPN路由表的。
2、修改后发现依然SWA依然无法学习到SWC和SWD的路由。
此时,再次查看SWA的路由:发现SWA的路由表里面没有SWC和SWD的路由,但是在BGP路由表中,SWC和SWD的地址是学习到的,但是状态为未生效状态。
Destinations : 13 Routes : 13
Destination/Mask Proto Pre Cost NextHop Interface
192.168.3.0/24 Direct 0 0 192.168.3.1 GE1/0/1
192.168.3.0/32 Direct 0 0 192.168.3.1 GE1/0/1
192.168.3.1/32 Direct 0 0 127.0.0.1 InLoop0
192.168.3.255/32 Direct 0 0 192.168.3.1 GE1/0/1
Total number of routes: 3
BGP local router ID is 2.2.2.2
Status codes: * - valid, > - best, d - dampened, h - history
s - suppressed, S - stale, i - internal, e - external
a - additional-path
Origin: i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn
i 192.168.1.0 192.168.1.254 0 100 0 ?
i 192.168.2.0 192.168.2.254 0 100 0 ? //没有*说明没有生效
* >i 192.168.3.0 192.168.3.254 0 100 0 ?
这时候发现BGP路由中,192.168.1.0的下一跳地址是 192.168.1.254,和SWA不是直连网段的,而是SWB和SWC互联的路由。此时,需要用 peer 192.168.3.1 next-hop-local修改路由下一跳,使得路由变成直连下一跳地址。
#
ip vpn-instance vrf3
peer 192.168.3.1 as-number 100
#
address-family ipv4 unicast
import-route direct
peer 192.168.3.1 enable
peer 192.168.3.1 next-hop-local
此时查看SWA上的BGP路由表发现路由生效,也可以正常学习到192.168.1.0和192.16.2.0网段luy。
Total number of routes: 3
BGP local router ID is 2.2.2.2
Status codes: * - valid, > - best, d - dampened, h - history
s - suppressed, S - stale, i - internal, e - external
a - additional-path
Origin: i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn
* >i 192.168.1.0 192.168.3.254 0 100 0 ?
* >i 192.168.2.0 192.168.3.254 0 100 0 ?
* >i 192.168.3.0 192.168.3.254 0 100 0 ?
Destinations : 15 Routes : 15
Destination/Mask Proto Pre Cost NextHop Interface
192.168.1.0/24 BGP 255 0 192.168.3.254 GE1/0/1
192.168.2.0/24 BGP 255 0 192.168.3.254 GE1/0/1
192.168.3.0/24 Direct 0 0 192.168.3.1 GE1/0/1
192.168.3.0/32 Direct 0 0 192.168.3.1 GE1/0/1
192.168.3.1/32 Direct 0 0 127.0.0.1 InLoop0
192.168.3.255/32 Direct 0 0 192.168.3.1 GE1/0/1
1、需要RT、RD值的方式引入路由,才能在BGP中传递,不能使用route-replicate方式。
2、用 peer 192.168.3.1 next-hop-local修改下一跳地址,修改后需要reset BGP进程,让BGP重新建立学习路由。
【附】
SWB上主要配置:
#
ip vpn-instance vrf1
route-distinguisher 100:100
vpn-target 100:100 300:300 import-extcommunity
vpn-target 100:100 export-extcommunity
#
ip vpn-instance vrf2
route-distinguisher 200:200
vpn-target 200:200 import-extcommunity
vpn-target 200:200 export-extcommunity
#
ip vpn-instance vrf3
route-distinguisher 300:300
vpn-target 100:100 200:200 300:300 import-extcommunity
vpn-target 300:300 export-extcommunity
#
#
bgp 100
#
ip vpn-instance vrf1
#
address-family ipv4 unicast
import-route direct
#
ip vpn-instance vrf2
#
address-family ipv4 unicast
import-route direct
#
ip vpn-instance vrf3
peer 192.168.3.1 as-number 100
#
address-family ipv4 unicast
import-route direct
peer 192.168.3.1 enable
peer 192.168.3.1 next-hop-local
#
SWA上主要配置:
#
bgp 100
peer 192.168.3.254 as-number 100
#
address-family ipv4 unicast
peer 192.168.3.254 enable
#
该案例暂时没有网友评论
✖
案例意见反馈
亲~登录后才可以操作哦!
确定你的邮箱还未认证,请认证邮箱或绑定手机后进行当前操作