IPv4 32 位 全局公網
VPNV4 96位 64位RD+32位客戶路由
VRF 32位 客戶的路由接入
R3(config)#int lo 1
R3(config-if)#ip add 8.8.8.8 255.255.255.255 ----R3配置IP模擬器互聯網公網IP
我們計劃R6(分支)訪問R3的lo0的互聯網先經過R8(總部)再訪問R3互聯網
R3和R2之間激活BGP單播鄰居用於傳遞互聯網路由
1、R3和R2之間激活BGP單播鄰居傳遞互聯網路由,R2配置靜態路由並引入BGP
R3(config)#router bgp 100
R3(config-router)#neighbor 22.1.1.1 remote-as 100
R3(config-router)#neighbor 22.1.1.1 update-source lo 0
R3(config-router)#address-family ipv4
R3(config-router-af)#neighbor 22.1.1.1 activate
R2(config)#router bgp 100
R2(config-router)#address-family 33.1.1.1 activ
R2(config-router)#address-family ipv4
R2(config-router-af)#neighbor 33.1.1.1 activate
R2(config)#ip route 66.1.1.1 255.255.255.255 serial 1/0
R2(config)#router bgp 100
R2(config-router)#address-family ipv4
R2(config-router-af)#redistribute static
此時R3回城R6的數據包是可達的。
2、R6從PE R2得到默認路由
R2(config)#router ospf 110 vrf cisco
R2(config-router)#default-information originate always
3、R2和R8訪問8.8.8.8
R2(config)#ip route vrf cisco 8.8.8.8 255.255.255.255 88.1.1.1----下一跳到VRF的路由R8
R5(config)#router ospf 110 vrf cisco
R5(config-router)#default-information originate always --R5下發默認路由到R8
R5(config)#ip route vrf cisco 8.8.8.8 255.255.255.255 33.1.1.1 global --訪問8.8.8.8下一跳為全局路由表中存在的地址,global把VRF路由引入到下一跳全局存在的地址
==================================================
客戶端運行BGP
R2:router bgp 100
address-family ipv4 vrf cisco
network 2.2.2.2 mask 255.255.255.255
neighbor 26.1.1.6 remote-as 200
neighbor 26.1.1.6 activate
R6#sho run | s bgp
router bgp 200
bgp log-neighbor-changes
network 4.4.4.4 mask 255.255.255.255
network 6.6.6.6 mask 255.255.255.255
network 7.7.7.7 mask 255.255.255.255
network 9.9.9.9 mask 255.255.255.255
network 66.1.1.1 mask 255.255.255.255
neighbor 26.1.1.2 remote-as 100
R2(config-router-af)#neighbor 26.1.1.6 maximum-prefix 4 --接收最大4條路由
R6(config)#router bgp 200
R6(config-router)#network 4.4.4.4 ma 255.255.255.255--發佈的4.4.4.4,R2告警
R6再增加一個環回口併發布進BGP
R6(config-router)#network 9.9.9.9 ma 255.255.255.255
超出4條路由鄰居down掉:
R2(config-router-af)#neighbor 26.1.1.6 maximum-prefix 4 warning-only --只彈警告
P設備(R3)通常不用於控制層面,除非VPNV4的RR
減少配置,降低PE設備的壓力
R3#sho run | s bgp
router bgp 100
bgp log-neighbor-changes
no bgp default ipv4-unicast
neighbor 22.1.1.1 remote-as 100
neighbor 22.1.1.1 update-source Loopback0
neighbor 44.1.1.1 remote-as 100
neighbor 44.1.1.1 update-source Loopback0
neighbor 55.1.1.1 remote-as 100
neighbor 55.1.1.1 update-source Loopback0
address-family ipv4
neighbor 22.1.1.1 activate
exit-address-family
address-family vpnv4
neighbor 22.1.1.1 activate
neighbor 22.1.1.1 send-community extended
neighbor 22.1.1.1 route-reflector-client
neighbor 44.1.1.1 activate
neighbor 44.1.1.1 send-community extended
neighbor 44.1.1.1 route-reflector-client
neighbor 55.1.1.1 activate
neighbor 55.1.1.1 send-community extended
neighbor 55.1.1.1 route-reflector-client
R2#sho run | s bgp
redistribute bgp 100 subnets
router bgp 100
bgp log-neighbor-changes
no bgp default ipv4-unicast
neighbor 33.1.1.1 remote-as 100
neighbor 33.1.1.1 update-source Loopback0
neighbor 55.1.1.1 remote-as 100
neighbor 55.1.1.1 update-source Loopback0
!
address-family ipv4
redistribute static
neighbor 33.1.1.1 activate
exit-address-family
!
address-family vpnv4
neighbor 33.1.1.1 activate
neighbor 33.1.1.1 send-community extended
exit-address-family
!
address-family ipv4 vrf cisco
network 2.2.2.2 mask 255.255.255.255
redistribute ospf 110 match internal external 1 external 2 nssa-external 1 nssa-external 2
neighbor 26.1.1.6 remote-as 200
neighbor 26.1.1.6 activate
neighbor 26.1.1.6 as-override ---EBGP默認不會接收與本AS一樣的路由,改寫AS與本AS一樣為100
另外一種方法在R4使用Allowas-in允許接收與本身相同AS的路由
R7(config-router)#neighbor 47.1.1.4 allowas-in 1
SOO用於防環
============================================
R4(config)#access-list 10 permit 6.6.6.6 0.0.0.0
R4(config)#route-map IMPORT
R4(config-route-map)#match ip address 10
R4(config)#ip vrf cisco
R4(config-vrf)#import map IMPORT ---在收到所有的VPNV4路由之後進行過濾,本質是對放入的VRF路由條目進行過濾,R7此時只通過R4接收6.6.6.6的路由
R4(config)#route-map EXPORT
R4(config-route-map)#match ip address 10
R4(config-route-map)#set extcommunity rt 44:44 additive --增加RT
R4(config)#ip vrf cisco
R4(config-vrf)#export map EXPORT
如果對方R7的RT的import設置44:44或25:25,都可以收取R4的路由!
歡迎關注和轉發,更多精彩內容下期繼續分享!
閱讀更多 專注分享網絡技術 的文章