MPLS VPN

一、路由器角色
PE:网络边缘路由器 连接用户设备和骨干网核心路由器
1、负责VPN业务接入,处理VPN-IPV4路由
2、使用VRF对VPN客户进行隔离,
3、通过与客户设备CE进行路由协议,以便获取客户路由,并将路由生成VPNv4前缀放入MPLS VPN骨干网传递到对端PE
CE:用户网络边缘路由器 和提供服务的网络商设备相连
1、不知道VPN的存在
2、把VPN客户的路由通告给PE,从PE上学习同一个VPN下其他路由器的路由
P:骨干网核心路由器 和P或者PE相连
1、高速转发数据
2、弹标签贴标签

注意:PE之间通过MP-BGP传递路由

二、概念
VRF:虚拟路由表转发 用来解决IP地址冲突的问题
MP-BGP:BGP-4的多协议扩展,原本的BGP协议只能管理IPV4的信息,这个能支持如ipv6这样的其他协议,本质还是一个BGP
PE之间建立IBGP邻居传路由信息

RD:可能会有多个MPLS VPN且IP地址相同,RD是用来确保MPLS VPN的唯一性

RT:RT会定义路由的 import (入口) 和export(出口)。
一条路由如果传给多个VPN,就可以用import和export来确定是哪个VPN可以接收本条路由

这里写图片描述

其中R1和R5为CE R2和R4为PE R3为P

R2 R3 R4上启用MPLS
R2:int e0/1
ip add 10.1.23.1 255.255.255.0
no sh
int lo 0
ip add 10.2.2.2 255.255.255.255
mpls label range 100 199
ip cef
mpls lab pro ldp
mpls ldp router-id lo 0
mpls ip
int e0/1
mpls ip

R3:int e0/0
ip add 10.1.23.2 255.255.255.0
no sh
int e0/1
ip add 10.1.34.1 255.255.255.0
no sh
int lo 0
ip add 10.3.3.3 255.255.255.255
mpls label range 200 299
ip cef
mpls lab pro ldp
mpls ldp router-id lo 0
mpls ip
int e0/1
mpls ip
int e0/0
mpls ip

R4:int e0/0
ip add 10.1.34.2 255.255.255.0
no sh
int lo 0
ip add 10.4.4.4 255.255.255.255
mpls label range 300 399
ip cef
mpls lab pro ldp
mpls ldp router-id lo 0
mpls ip
int e0/0
mpls ip

在PE上启动BGP
R2:router bgp 123
bgp log-neighbor-changes
no bgp default ipv4-unicast
neighbor 10.4.4.4 remote-as 123
neighbor 10.4.4.4 update-source Loopback0
address-family vpnv4
neighbor 10.4.4.4 activate
neighbor 10.4.4.4 send-community both
R4:router bgp 123
bgp log-neighbor-changes
no bgp default ipv4-unicast
neighbor 10.2.2.2 remote-as 123
neighbor 10.2.2.2 update-source Loopback0
address-family vpnv4
neighbor 10.2.2.2 activate
neighbor 10.2.2.2 send-community both

R2和R4上开启VRF
R2:
ip vrf red
rd 1:2
route-target export 10:12
route-target import 10:12
int e0/0
ip vrf red forwarding red
ip add 100.1.1.1 255.255.255.0
no sh
R4:ip vrf red
rd 1:2
route-target export 10:12
route-target import 10:12
int e0/1
ip vrf forwarding red
ip add 200.1.1.1 255.255.255.0
no sh

在PE和CE间启动协议
R1:interface Loopback0
ip address 192.168.1.1 255.255.255.0
interface Ethernet0/0
ip address 100.1.1.2 255.255.255
router ospf 90
network 100.1.1.0 0.0.0.255 area 0
network 192.168.1.0 0.0.0.255 area 0
R2:router ospf 90 vrf red
redistribute bgp 123 subnets
network 100.1.1.0 0.0.0.255 area 0
router bgp 123
address-family ipv4 vrf red
redistribute ospf 90
R4:router bgp 123
address-family ipv4 vrf red
redistribute ospf 90
router ospf 90 vrf red
redistribute bgp 123 subnets
network 200.1.1.0 0.0.0.255 area 0
R5:interface Loopback0
ip address 172.16.1.1 255.255.255.0
interface Ethernet0/0
ip address 200.1.1.2 255.255.255.0
router ospf 90
network 172.16.1.0 0.0.0.255 area 0
network 200.1.1.0 0.0.0.255 area 0

猜你喜欢

转载自blog.csdn.net/qq_42868046/article/details/82564253