当前位置:网站首页>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
边栏推荐
- MySQL Advanced Statements (1)
- Node installation and environment configuration
- 2022年8月计划,着重ue4视频教程
- Servlet
- MySQL高级SQL语句(二)
- MySQL Advanced SQL Statements (2)
- Go inside the basic knowledge
- 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?
- 打卡day05
- zabbix email alarm and WeChat alarm
猜你喜欢
(笔记整理未完成)【图论】图的遍历
MySql 5.7.38 download and installation tutorial, and realize the operation of MySql in Navicat
chrome 插件开发指南
MySQL 23 classic interviews hang the interviewer
Neo4j 中文开发者月刊 - 202207期
Revitalize rural circular economy and digital chain to link agricultural "ecological chain"
MySQL驱动jar包的下载--保姆教程
Toolbox App 1.25 New Features at a Glance | Version Update
有人开源全凭“为爱发电”,有人却用开源“搞到了钱”
有点奇怪!访问目的网址,主机能容器却不行
随机推荐
Difference between npm and yarn
数据库概论之MySQL表的增删改查1
MySQL - Multi-table query and case detailed explanation
HCIP day 3 experiment
MySQL 5.7 安装教程(全步骤、保姆级教程)
typescript ‘props‘ is declared but its value is never read 解决办法
宝塔+FastAdmin 404 Not Found
Wuhan 2022 organizing of the high-performance computing added new ecological development of high-performance computing
Toolbox App 1.25 New Features at a Glance | Version Update
CAT1 4G+以太网开发板腾讯云手机微信小程序显示温度和下发控制
Technology empowers Lhasa's "lungs", Huawei helps Lalu Wetland Smart Management to protect lucid waters and lush mountains
HCIP 第四天
HCIP 第二天
(笔记整理未完成)【图论】图的遍历
Submit code process
mysql索引失效的常见9种原因详解
APP special test: traffic test
Leetcode Weekly 304
GCC编译器技术解析
Nacos database configuration