当前位置:网站首页>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
边栏推荐
- 关于ue4.27像素流送打包后的本地服务器问题
- love
- Nodejs installation and global configuration (super detailed)
- 宝塔+FastAdmin 404 Not Found
- GCC编译器技术解析
- Resolving C# non-static field, method or property "islandnum.Program.getIslandCount(int[][], int, int)" requires an object reference
- 看图就懂|衡量业务增长健康的销售指标如何选择
- MySQL (3)
- 数据库概论之MySQL表的增删改查1
- aTrust项目的相关操作与分享
猜你喜欢

The stock price has repeatedly hit new lows, and the real estate SaaS giant is in trouble. How should Mingyuan Cloud transform and save itself?

mysql索引失效的常见9种原因详解

node安装及环境配置
![[数据集][VOC]眼睛佩戴数据集VOC格式6000张](/img/66/37f76d9ce5d5f68d6ea0e18710fa04.png)
[数据集][VOC]眼睛佩戴数据集VOC格式6000张

Toolbox App 1.25 新功能一览 | 版本更新

(部分不懂,笔记整理未完成)【图论】差分约束

Nacos installation detailed process
![[数据集][VOC]男女数据集voc格式6188张](/img/72/d3e46a820796a48b458cd2d0a18f8f.png)
[数据集][VOC]男女数据集voc格式6188张

typescript 'props' is declared but its value is never read solution

Expert Insights | 3 ways to seize innovation opportunities in a downturn
随机推荐
MySQL高级SQL语句
MySQL high-level statements (1)
2022年8月计划,着重ue4视频教程
Submit code process
yml字符串读取时转成数字了怎么解决
punch day05
Leetcode周赛304
HCIP 第一天
MySQL union query (multi-table query)
返回文件名问题
MySQL Advanced SQL Statements
(部分不懂,笔记整理未完成)【图论】差分约束
In-depth analysis of the initialization of member variables and local variables
How does abaqus quickly import the assembly of other cae files?
Nodejs安装教程
GCC编译器技术解析
Xgboost报错ValueError:无效的形状:标签(1650 2)
Wuhan 2022 organizing of the high-performance computing added new ecological development of high-performance computing
MySQL 23 classic interviews hang the interviewer
MySQL高级-MVCC(超详细整理)