一個VRF可擁有多個接口,每個接口只能屬於一個VRF
把VRF路由表引入到VPNV4路由表
如果是VRF的靜態路由或IGP路由,那麼需要在BGP的VRF地址族重分佈
相應的還需要把BGP重分佈到IGP中
使用R1 R3 R4 R6 R7進行組網:
IGP使用OSPF
1、IGP
lo 口使用32位
LDP配置,完成R1 R3 R4 MPLS IP配置
2、VRF配置
R1(config)#ip vrf cisco
R1(config-vrf)#rd 100:1
R1(config-vrf)#route-target 100:100
R1(config)#interface ethernet 0/1
R1(config-if)#ip vrf forwarding cisco
*Oct 31 08:59:08.249: %LINK-3-UPDOWN: Interface Ethernet0/1, changed state to up
*Oct 31 08:59:09.254: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/1, changed state to up
R1(config-if)#ip add 16.1.1.1 255.255.255.0
R4以命名的方式配置VRF,需要增加ipv4地址族下面的配置:
R4(config)#vrf definition cisco
R4(config-vrf)#address-family ipv4
R4(config-vrf-af)#rd 100:1
R4(config-vrf-af)#route-target 100:100
R4(config)#interface ethernet 0/0
R4(config-if)#vrf forwarding cisco
R4(config-if)#ip address 47.1.1.4 255.255.255.0
3、配置VPNV4
R1(config)#router bgp 100
R1(config-router)#no bgp default ipv4-unicast ---關掉BGP默認的承載ipv4單播的能力
R1(config-router)# neighbor 44.1.1.1 remote-as 100
R1(config-router)# neighbor 44.1.1.1 up lo 0
R1(config-router)#address-family ipv4
R1(config-router-af)#neighbor 44.1.1.1 activate ----進入vpnv4地址族激活鄰居
4、完成客戶路由和PE之間的路由交換
R4和R7之間使用EIGRP
R4(config)#router eigrp 90
R4(config-router-af)#no auto-summary
R4(config-router)#address-family ipv4 vrf cisco autonomous-system 90--此處才是真正的AS號碼和CE相同
R4(config-router-af)#network 47.1.1.0 0.0.0.255
R4(config)#router eigrp 90
R4(config-router)#address-family ipv4 vrf cisco autonomous-system 90
R4(config-router-af)#redistribute bgp 100 metric 1000 100 255 1 1500--把BGP路由進入到VRF更新給客戶端
R4(config)#router bgp 100
R4(config-router)#address-family ipv4 vrf cisco
R4(config-router-af)#redistribute eigrp 90 ---重分佈eigrp90
R6(config)#ip route 77.1.1.1 255.255.255.255 e0/1 16.1.1.1
R1(config)#ip route vrf cisco 66.1.1.1 255.255.255.255 e0/1 16.1.1.6
R1(config)#router bgp 100
R1(config-router)#address-family ipv4 vrf cisco
R1(config-router-af)#redistribute static ---注入靜態路由
此時R4 VRF可以學到R6的路由
R4已經把BGP路由注入到VRF,R7通過EIGRP可以學到R6的路由:
此時R6和R7之間lo0可以實現互通:
R7#traceroute 66.1.1.1 sou lo 0
Type escape sequence to abort.
Tracing the route to 66.1.1.1
VRF info: (vrf in name/id, vrf out name/id)
1 47.1.1.4 0 msec 1 msec 0 msec
2 34.1.1.3 [MPLS: Labels 16/19 Exp 0] 1 msec 1 msec 0 msec----16是外層標籤是LDP為去往11.1.1.1分配的;16是R1的BGP為VPN路由66.1.1.1分配的
3 16.1.1.1 [MPLS: Label 19 Exp 0] 1 msec 0 msec 0 msec
4 16.1.1.6 1 msec * 2 msec
R1#show ip bgp vpnv4 all 66.1.1.1
R1#show ip route vrf cisco 16.1.1.0 查看:
歡迎關注和轉發,更多精彩內容下期繼續分享!
閱讀更多 專注分享網絡技術 的文章