MPLS VPN随堂笔记1

时间:2022-09-02 17:06:38

MPLS VPN 基础

1、MPLS vpn架构的特点

1.1.允许不同CE传递相同私网路由

1.2.SP内部(所有P路由器)不需要学习CE路由

1.3.无安全保障但有带宽保障(跟SP租用服务)

2、MPLS vpn 架构的主要组件

CE 客户边缘路由器

C 客户内部路由器

PE 运营商边缘路由器

P 运营商内部路由器

RD 路由区分符(本地有效)

区分本地接收不同CE传递的路由

如1:1 (SP的 AS号:序号)

RT 路由目标(MPBGP拓展团体属性传递)

区分接收MPBGP传递来的路由是否接收

为MPBGP发送路由更新添加区分符

如2:2 (SP的 AS号:序号+标识)

发送方RT export值
与接收方import值 对应

MPBGP中传递路由:96位 =
RD+私网路由

(1:1:192.168.1.0/24)

3、RD

4、RT

5、MP-BGP

总结MPBGP路由转发模式

Mpls基础实验

1.配置SP内部网络(IGP ospf)

2.配置SP内部MPLS域(LDP)

R3(config)#interface
s0/1

R3(config-if)#mpls ip

接口下启用LDP协议

R3(config)#mpls ldp router-id
loopback 0 force

强制指定loopback0 为RID

R1#show mpls ldp
neighbor

检查LDP邻居是否建立

R1#show mpls ldp
discovery

如未建立 检查错误

3.配置MP-BGP

(起邻居)

router bgp 100

bgp router-id 3.3.3.3

no bgp default
ipv4-unicast

(关闭默认单播ipv4BGP邻居建立)

bgp log-neighbor-changes

neighbor 1.1.1.1 remote-as
100

neighbor 1.1.1.1 update-source
Loopback0

(全局指定邻居以及建立邻居地址)

address-family vpnv4

进入VPNV4地址族

neighbor 1.1.1.1
activate

激活邻居

neighbor 1.1.1.1 send-community
extended

(默认激活后直接开启)

exit-address-family

R1#show ip bgp vpnv4 all
summary

检查MPBGP邻居关系

MPLS VPN随堂笔记1

创建VRF(虚拟路由器)

ip vrf a(本地有效)

进入vrf配置界面

rd 1:1

配置RD值(本地有效)

route-target export
10:10

route-target import
20:20

设置RT出入方向值

R1#show ip vrf a

查看本地VRF

将接口划入VRF中

interface Serial0/1

ip vrf forwarding a

ip address 192.168.1.1
255.255.255.0

(注意要重写一遍地址)

R1#show ip route vrf a

查看虚拟路由表(对应vrf)

R1#ping vrf a
192.168.1.2

测试vrf下的直连

R1(config)#ip route vrf a
11.11.11.11 255.255.255.255 192.168.1.2

vrf下静态路由

router bgp 100

address-family ipv4 vrf
a

redistribute static

在vrf地址族下
重分布静态路由

show ip bgp vpnv4 all neighbors
3.3.3.3 advertised-routes

查看是否给3.3.3.3(邻居)发送该路由

R1#show ip cef vrf a
detail

查看vrf a相关联的FIB表

22.22.22.22/32, version 9, epoch 0,
cached adjacency to Serial0/0

0 packets, 0 bytes

tag information set

local tag:
VPN-route-head

fast tag rewrite with Se0/0,
point2point, tags imposed: {16 104}

via 3.3.3.3, 0 dependencies,
recursive

next hop 12.1.1.2, Serial0/0 via
3.3.3.3/32

下一跳出接口

valid cached adjacency

tag
rewrite with Se0/0, point2point, tags imposed:
{16(LDP分配的标签 104MPBGP分配的标签}

show ip bgp vpnv4 all labels

查阅MPBGP分配的标签

R1#show ip cef vrf a
detail

查阅相关VRF a的FIB表

ce-pe rip

router rip

version 2

no auto-summary

!

address-family ipv4 vrf
a

在相对应的vrf地址族下重分布

redistribute bgp 100 metric
1

将路由重分布进rip时注意加metric值,如不加重分布不进rip

network 192.168.1.0

no auto-summary

exit-address-family

router bgp 100

address-family ipv4 vrf
a

在相对应的vrf地址族下重分布

redistribute rip

检查邻居PE是否通过MPBGP学习到相对应的路由

show ip bgp vpnv4 all

(检查下一跳是否正确)

show ip route vrf b

检查vrf b路由表中是否存在

PE-CE EIGRP

router eigrp 100

no auto-summary

!

address-family ipv4 vrf a

进入相对vrf地址族下

redistribute bgp 100 metric 1000 100 255 1 1500

将其他协议重分布进来需要加metric值

(直连 静态 eigrp其他自制系统)

network 192.168.1.0

autonomous-system 100

强制指定本地AS,否则邻居无法建立

exit-address-family

R1#show ip eigrp vrf a
neighbors

检查EIGRP 相对vrf下邻居

PE-CE OSPF

router ospf 2 vrf a

创立ospf进程号时直接关联vrf

router-id 11.1.1.1

log-adjacency-changes

redistribute bgp 100
subnets

引入BGP路由时注意加 subnets

network 192.168.1.0 0.0.0.255 area
0

router bgp 100

address-family ipv4 vrf
a

redistribute ospf 2 vrf
a

如果直接重分发 默认只会把OSPF域内 区域间(OIA) 区域内部(O)重分发

如果需要将ospf域内 OE2路由引入
需要加match项

redistribute ospf 2 vrf a match
match internal external nssa-external

no synchronization

exit-address-family

PE-CE BGP

CE端

router bgp 65000

no synchronization

bgp router-id 5.5.5.5

bgp log-neighbor-changes

network 22.22.22.22 mask
255.255.255.255

起源路由

neighbor 192.168.2.1 remote-as
100

建立EBGP邻居

neighbor 192.168.2.1 allowas-in
10(发生次数)

允许接收带有自己AS号的路由更新

PE端

router bgp 100

address-family ipv4 vrf
b

进入对应VRF地址族下

neighbor 192.168.2.2 remote-as
65000

建立EBGP邻居

neighbor 192.168.2.2
activate

no synchronization

一般用直连建立EBGP邻居