当前位置:网站首页>MPLS的相关技术
MPLS的相关技术
2022-08-02 06:11:00 【关伯兰,】

MPLS VPN是一种由运营商提供的,专门解决虚拟专线安全及带宽问题的综合解决方案。



R1 左边:192.168.1.0/24 右边:192.168.2.0/24
R2-R3 23.0.0.0/24
R3-R4 34.0.0.0/24
R5 左边:192.168.3.0/24 右边:192.168.3.0/24
R2-R3-R4都有一个环回
公网配置
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]a 0
[r2-ospf-1-area-0.0.0.0]network 23.0.0.0 0.0.0.255
[r2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]a 0
[r3-ospf-1-area-0.0.0.0]network 23.0.0.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]network 34.0.0.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]a 0
[r4-ospf-1-area-0.0.0.0]network 34.0.0.0 0.0.0.255
[r4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0

[r2]mpls lsr-id 2.2.2.2
[r2]mpls
[r2-mpls]mpls ldp
[r2-mpls-ldp]int g 0/0/1
[r2-GigabitEthernet0/0/1]mpls
[r2-GigabitEthernet0/0/1]mpls ldp
[r3]mpls lsr-id 3.3.3.3
[r3]mpls
[r3-mpls]mpls ldp
[r3-mpls-ldp]int g 0/0/0
[r3-GigabitEthernet0/0/0]mpls
[r3-GigabitEthernet0/0/0]mpls ldp
[r3-GigabitEthernet0/0/0]int g 0/0/1
[r3-GigabitEthernet0/0/1]mpls
[r3-GigabitEthernet0/0/1]mpls ldp
[r4]mpls lsr-id 4.4.4.4
[r4]mpls
[r4-mpls]mpls ldp
[r4-mpls-ldp]int g 0/0/0
[r4-GigabitEthernet0/0/0]mpls
[r4-GigabitEthernet0/0/0]mpls ldp
私网配置
[r2]ip vpn-instance a 创建VRF空间
[r2-vpn-instance-a]route-distinguisher 100:100 配置RD值
[r2-vpn-instance-a-af-ipv4]vpn-target 100:1 export-extcommunity 配置出站RT
[r2-vpn-instance-a-af-ipv4]vpn-target 100:2 import-extcommunity 配置入站RT
[r2]int g 0/0/0 将接口划入到VRF空间
[r2-GigabitEthernet0/0/0]ip binding vpn-instance a
[r2-GigabitEthernet0/0/0]ip address 192.168.2.2 24
[r2]ping -vpn-instance a 192.168.2.1---根据VRF空间的路由信息发送数据包
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]ip address 192.168.2.1 24
[r1-GigabitEthernet0/0/0]int l0
[r1-LoopBack0]ip address 192.168.1.1 24

[r4]ip vpn-instance b
[r4-vpn-instance-b]route-distinguisher 100:200
[r4-vpn-instance-b-af-ipv4]vpn-target 100:1 import-extcommunity
[r4-vpn-instance-b-af-ipv4]vpn-target 100:2 export-extcommunity
[r4]int g 0/0/1
[r4-GigabitEthernet0/0/1]ip binding vpn-instance b
[r4-GigabitEthernet0/0/1]ip address 192.168.3.1 24
[r5]int g 0/0/0
[r5-GigabitEthernet0/0/0]ip address 192.168.3.2 24
[r5-GigabitEthernet0/0/0]int l0
[r5-LoopBack0]ip address 192.168.4.1 24

配置路由
静态
[r1]ip route-static 192.168.3.0 24 192.168.2.2
[r1]ip route-static 192.168.4.0 24 192.168.2.2
[r2]ip route-static vpn-instance a 192.168.1.0 24 192.168.2.1 (3.0和4.0可以通过后续BGP协议获取路由信息)

[r5]ip route-static 192.168.1.0 24 192.168.3.1
[r5]ip route-static 192.168.2.0 24 192.168.3.1
[r4]ip route-static vpn-instance b 192.168.4.0 24 192.168.3.2 往VRF空间添加静态路由
R2-R4上启动BGP协议,获取路由信息
[r2]bgp 1
[r2-bgp]router-id 2.2.2.2
[r2-bgp]peer 4.4.4.4 as-number 1
[r2-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[r2-bgp]ipv4-family vpnv4 启动MP-BGP(此处传递的路由为VPNV4路由)
[r2-bgp-af-vpnv4]peer 4.4.4.4 enable
[r2-bgp]ipv4-family vpn-instance a 在VPN空间中导入路由
[r2-bgp-a]import-route static
[r2-bgp-a]import-route direct
[r4]bgp 1
[r4-bgp]router-id 4.4.4.4
[r4-bgp]peer 2.2.2.2 as-number 1
[r4-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[r4-bgp]ipv4-family vpnv4
[r4-bgp-af-vpnv4]peer 2.2.2.2 enable
[r4-bgp]ipv4-family vpn-instance b
[r4-bgp-b]import-route direct
[r4-bgp-b]import-route static



抓包结果:R2上抓包
192.168.1.1 --->192.168.4.1


这个不携带标签的数据包来到R2,先打标签。靠近二层的外层标签由LDP协议分配,目的是使数据可以通过MPLS区域 到达R4,打入的外层标签1025是基于同一个FEC进行分配的。靠近三层的内层标签由MP-BGP协议去分配,由上图可得MP-BGP为去4.0打入的内层标签是1027。
192.168.4.1----> 192.168.1.1


由4.0回包,数据到达R2要弹出靠近二层的外层标签,所以上图展示的只有内层标签,以便判断到达对应的VRF空间
动态 (站点1运行RIP协议,站点2运行OSPF协议)
[r1]rip
version 2
network 192.168.1.0
network 192.168.2.0
[r2]rip 1 vpn-instance a ----在空间中启动动态路由协议RIP
v 2
network 192.168.2.0
[r5]ospf 1 router-id 5.5.5.5
area 0
network 192.168.3.0 0.0.0.255
network 192.168.4.0 0.0.0.255
[r4]ospf 2 vpn-instance b router-id 4.4.4.4
a 0
network 192.168.3.0 0.0.0.255
双向重发布
[r2]bgp 1
ipv4-family vpn-instance a
import-route rip 1
[r2]rip
import-route bgp
[r4]ospf 2
import-route bgp
[r4]bgp 1
ipv4-family vpn-instance b
import-route ospf 2
边栏推荐
猜你喜欢

typescript ‘props‘ is declared but its value is never read 解决办法

HCIP 第四天

node安装及环境配置

Specified URL is not reachable,caused by :‘Read timed out

MySQL Advanced SQL Statements

mysql高阶语句(一)

Nodejs安装教程

About the local server problem after ue4.27 pixel streaming package

Specified URL is not reachable,caused by :‘Read timed out

【21天学习挑战赛】顺序查找
随机推荐
Toolbox App 1.25 New Features at a Glance | Version Update
SphereEx苗立尧:云原生架构下的Database Mesh研发实践
MySQL高级-MVCC(超详细整理)
chrome 插件开发指南
MySQL(3)
Two good php debug tutorials
MySQL Advanced SQL Statements (2)
The second day HCIP
zabbix email alarm and WeChat alarm
项目开发规范
MySql 5.7.38 download and installation tutorial, and realize the operation of MySql in Navicat
MySQL - Multi-table query and case detailed explanation
Dataset:机器学习中常用数据集下载链接集合之详细攻略
MySQL high-level statements (1)
MySQL high-level --- storage engine, index, lock
PMP新考纲通关秘籍,告别抓瞎
MySQL classic 50 practice questions and the most detailed analysis of the whole network
yml字符串读取时转成数字了怎么解决
postgres 多个变量填充字符串,字串格式化
File upload vulnerability (2)