MPLS vpn配置--私网静态路由
实验环境:如图,Internet运行OSPF协议使外网互通;两个私网,运行静态路由,与外网建立联系;R2、R4运行扩展IBGP,承载vpn-v4地址族。
配置解析:
1、 按IP地址配置各接口 2、 配置PE1-P-PE2 公网路由 3、 各设备启用ip cef Router (config)#ip cef
4、 在PE1-P-PE2主干接口启用mpls Pe1(config)#int fa0/1 PE1(config-if)#mpls ip 5、 在PE上创建VRF PE1(config)#ip vrf vpna PE1(config-vrf)#rd 100:1
PE1(config-vrf)#route-target 100:1
6、 将PE上与CE相连的接口加入到VRF中 PE1(config)#int fa0/0
PE1(CONFIG-IF)#ip vrf forwarding vpna PE1(config-if)#ip add 192.168.1.1255.255.255.0 PE1(config-if)#no shut 7、 在PE上配置VRF 静态路由
PE1(config)#ip route vrf vpna 1.1.1.1 255.255.255.255 192.168.1.1 8、 配置PE1、PE2 iBGP PE1(config)#router bgp 100
PE1(config-router )#bgp router –id 2.2.2.2 PE1(config-router)#nei 4.4.4.4remote-as 100 PE1(config-router)#nei 4.4.4.4update lo0 PE1(config-router)#no sy PE1(config-router)#no auto
9、 在PE上启用address-familyVPNV4扩展团体属性 PE1(config)#router bgp 100
PE1(config-router)#address-family vpnv4 PE1(config –router )#nei 4.4.4.4acti
PE1(config –router )#nei 4.4.4.4send-community ex 10、在PE上启用address-familyvrf ipv4 vpna PE1(config)#router bgp 100
PE1(config-router)#address-family ipv4 vrfvpna
PE1(config-router-af)#no sy PE1(config-router-af)#no auto
将静态路由重分布到address-familyipv4 vrf vpna中 PE1(config-router-af)#redis static 11、配置CE间的静态路由
CE1(config)#ip route 5.5.5.5255.255.255.255 192.168.1.2
配置步骤: R1# sh run !
hostname R1 ! ip cef !
interface Loopback0
ip address 1.1.1.1 255.255.255.255 !
interface Ethernet0/0
ip address 192.168.1.1 255.255.255.0 !
no ip http server
no ip http secure-server
ip route 5.5.5.5 255.255.255.255 192.168.1.2
R2#sh run !
hostname R2 ! ip cef !
ip vrf vpna rd 100:1
route-target export 100:1 route-target import 100:1 !
interface Loopback0
ip address 2.2.2.2 255.255.255.255 !
interface Ethernet0/0 ip vrf forwarding vpna
ip address 192.168.1.2 255.255.255.0 !
interface Ethernet0/1
ip address 100.1.1.1 255.255.255.252 mpls ip !
router ospf 1
network 2.2.2.2 0.0.0.0 area 0 network 2.2.2.0 0.0.0.255 area 0 network 100.1.1.0 0.0.0.3 area 0 !
router bgp 100 no synchronization bgp router-id 2.2.2.2
neighbor 4.4.4.4 remote-as 100
neighbor 4.4.4.4 update-source Loopback0 no auto-summary !
address-family vpnv4 neighbor 4.4.4.4 activate
neighbor 4.4.4.4 send-community extended exit-address-family !
address-family ipv4 vrf vpna redistribute static