当前位置:网站首页>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
边栏推荐
猜你喜欢
Leetcode Weekly 304
推出 Space On-Premises (本地部署版) Beta 版!
Vscode connect to remote server "Acquiring the lock on the/home / ~ 'problem
yml字符串读取时转成数字了怎么解决
MySQL Advanced Study Notes
mysql索引失效的常见9种原因详解
Detailed explanation of 9 common reasons for MySQL index failure
MySQL - Multi-table query and case detailed explanation
rhce homework
MySQL 5.7 安装教程(全步骤、保姆级教程)
随机推荐
Servlet
How the Internet of Things is changing the efficiency of city operations
GCC编译器技术解析
Nacos installation detailed process
Detailed explanation of 9 common reasons for MySQL index failure
awk语法-01-基础语法(命令、选项、内部变量)
Expert Insights | 3 ways to seize innovation opportunities in a downturn
MySQL union query (multi-table query)
(Notes are not completed) [Graph Theory] Traversal of graphs
看图就懂|衡量业务增长健康的销售指标如何选择
Specified URL is not reachable,caused by :‘Read timed out
nacos源码启动找不到istio包
Vscode连接远程服务器出现‘Acquiring lock on/home/~’问题
享年94岁,图灵奖得主、计算复杂性理论先驱Juris Hartmanis逝世
HCIP 第二天
Connection reset by peer 问题解析
提交代码流程
2022年7月18日-7月31日(Ue4视频教程和文档,20小时。合计1412小时,剩8588小时)
DNS resolution process
Submit code process