在CE和PE之间,PE接入有多个客户,常会启用VRF,可以使得与CE之间的路由限制在一定范围内,既充分利用了PE的资源,又得以限制私网路由在公网上的传播。
一、拓朴如下:

二、配置步骤如下:
1、CE 配业务地址 1.1.1.1/32、和 PE 的直连地址 172.1.1.1/24,正常起 ospf
2、PE 起 VRF c1; 绑定到和 CE 的接口上,配 ip 地址 172.1.1.2/24; 为VRF 起 ospf 进程
三、主要配置命令:
[PE]:
ip vpn-instance c1 #起vrf
ipv4-family
#
interface GigabitEthernet0/0/0 #将vrf绑定到接口上
ip binding vpn-instance c1
ip address 172.1.1.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.1.23.2 255.255.255.0
#
interface LoopBack0
ip address 2.2.2.2 255.255.255.255
#
ospf 1 vpn-instance c1 #为vrf(vpn-instance)起ospf进程
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 172.1.1.0 0.0.0.255
#
四、测试:
ping测试:

查看 vrf 路由表:
