VRF概念(VPN Routing&Forwarding,VPN路由转发表);常用于MPLS VPN场景。
在引入VRF之后,一台路由器有N+1张路由表(其中1为全局路由表,而N为N个VPN分别对应的VRF路由表),可以把VRF理解为虚拟路由器。

拓扑说明: AB两公司各有两个分部都通过一家ISP互联,现ISP采用一台设备模拟中间MPLS VPN网络,要求两公司私网通过VRF互通,互不干扰。
配置:
A1
hostname A1
interface Loopback0
ip address 11.1.1.1 255.255.255.255
//配置环回口模拟下挂私网网段
interface GigabitEthernet0/0
ip address 10.0.1.1 255.255.255.0
//配置与ISP互联接口地址
router rip
version 2
network 10.0.0.0
network 11.0.0.0
no auto-summary
//配置RIP协议与ISP VRF建立邻居
A2配置
hostname A2
interface Loopback0
ip address 22.1.1.1 255.255.255.255
interface GigabitEthernet0/0
ip address 10.0.2.1 255.255.255.0
router rip
version 2
network 10.0.0.0
network 22.0.0.0
no auto-summary
B1配置
hostname B1
interface Loopback0
ip address 33.1.1.1 255.255.255.255
interface GigabitEthernet0/0
ip address 10.0.3.1 255.255.255.0
router rip
version 2
network 10.0.0.0
network 33.0.0.0
no auto-summary
B2配置
hostname B2
interface Loopback0
ip address 44.1.1.1 255.255.255.255
interface GigabitEthernet0/0
ip address 10.0.4.1 255.255.255.0
router rip
version 2
network 10.0.0.0
network 44.0.0.0
no auto-summary
ISP 配置
hostname ISP
ip vrf A
ip vrf B
//配置两个VRF对应A B 两公司
interface GigabitEthernet0/0
ip vrf forwarding A
ip address 10.0.1.2 255.255.255.0
interface GigabitEthernet0/1
ip vrf forwarding B
ip address 10.0.3.2 255.255.255.0
interface GigabitEthernet0/2
ip vrf forwarding A
ip address 10.0.2.2 255.255.255.0
interface GigabitEthernet0/3
ip vrf forwarding B
ip address 10.0.4.2 255.255.255.0
//接口绑定对用VRF,配置互联地址
router rip
version 2
no auto-summary
address-family ipv4 vrf B
network 10.0.0.0
no auto-summary
exit-address-family
address-family ipv4 vrf A
network 10.0.0.0
no auto-summary
exit-address-family
//配置RIP协议,在address-family ipv4 vrf XX下宣告VRF路由。
配置完成后在ISP上检查
VRF及其绑定接口

公网路由表无信息

VRF路由表正常

在客户机上产看路由表,有对应分部的路由,互通正常,两公司路由独立。

