1、场景拓扑

使用小凡模拟器搭建了如下网络拓扑,使用的镜像为:c3640-jk9o3s-mz.122-15.T9.bin

相关的配置在下方

如果重复实验,需要清空设备的配置,知道路由器的密码,操作步骤如下:

(1)登入路由器,输入enbale命令启动超级用户模式,在该模式下,输入enable password命令

(2)输入configure terminal命令,启动全局配置模式

(3)输入config-register 0x2142命令

(4)输入end命令,并输入write erase命令删除路由器当前的启动配置

(5)输入reload命令重启路由器 当系统询问是否要保存配置时,选择no

当路由器完成重启后,所有参数将会恢复为出厂时的默认设置

2、术语解释

LSR:标签交换路由器,这里的LSR就是P

边缘LSR:只要一台LSR拥有非MPLS邻居,那么就可以将他看成一台边界LSR,这里的边界LSR就是PE

LSP():标签交换路径

FEC(转发等价类):可以将转发等价类概念想象为一组以相同的方式,走相同的路径,按一致的转发优先级进行转发的数据包。

TDP():标记分发协议

LDP():标签分发协议

3、基本配置

3.1 基本IP的配置

CE1

hostname CE1
no ip domain lookup
no voice hpi capture buffer
interface Loopback0
ip address 1.1.1.1 255.255.255.255
interface Ethernet0/0
ip address 192.168.1.1 255.255.255.252
half-duplex

PE1

hostname PE1
no ip domain lookup
interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface Ethernet0/0
ip address 192.168.1.2 255.255.255.252
half-duplex
!
interface Ethernet0/1
ip address 10.1.1.1 255.255.255.252
half-duplex
!

P

hostname P
no ip domain lookup
interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface Ethernet0/0
ip address 10.1.1.5 255.255.255.252
half-duplex
!
interface Ethernet0/1
ip address 10.1.1.2 255.255.255.252
half-duplex

PE2

hostname PE2
no ip domain lookup
interface Loopback0
ip address 4.4.4.4 255.255.255.255
!
interface Ethernet0/0
ip address 10.1.1.6 255.255.255.252
half-duplex
!
interface Ethernet0/1
ip address 192.168.2.1 255.255.255.252
half-duplex
!

CE2

hostname CE2
no ip domain lookup
!
interface Loopback0
ip address 5.5.5.5 255.255.255.255
!
interface Ethernet0/0
no ip address
shutdown
half-duplex
!
interface Ethernet0/1
ip address 192.168.2.2 255.255.255.252
half-duplex
!

3.2 MPLS VPN实验

主要的配置在PE和PE2

分别如下步骤:

3.2.1 pe1 p pe2 路由器之间运行 ospf. 将所有的路由宣告

例如在pe1执行如下命令

router ospf 10
router-id 2.2.2.2
network 2.2.2.2 0.0.0.0 area 0
network 10.1.1.0 0.0.0.3 area 0

3.2.2 启用 ip cef 验证现在的路由是基于每一跳

例如在pe1上执行如下命令

ip cef

3.2.3 启用 vrf rd 用来唯一区别不同的 vpn

创建了vrf,并定义路由区别符(RD)和路由目标(RT)

ip vrf vpna
rd 100:2
route-target export 100:1
route-target import 100:1

3.2.4 启用 ibgp 主要用来承载大量的私有前缀

例如在pe1上执行如下

pe1(config)#router bgp 100
pe1(config-router)#bgp router-id 2.2.2.2
pe1(config-router)#nei 4.4.4.4 remote-as 100
pe1(config-router)#nei 4.4.4.4 update-source Loopback0
pe1(config-router)# no auto-summary
pe1(config-router)# no synchronization
pe1(config-router)#exit

激活标准的ipv4 bgp会话,这里的进程100应该是进程号,使用100这个进程号与邻居4.4.4.4进行会话

BGP进程通过使用BGP自身的地址家族,来激活携带vpn-ipv4前缀的MP-IBGP会话,在这里将邻居激活,neighbor 4.4.4.4 send-community extended(不输入也会默认添加)这个命令将指示BGP通告扩展团体属性。

3.2.5 启用 address-family vpnv4 的扩展团体属性

pe1(config)#router bgp 100
pe1(config-router)#address-family vpnv4
pe1(config-router-af)#nei 4.4.4.4 activate 注意在这里要激活邻居。
pe1(config-router-af)# neighbor 4.4.4.4 send-community extended
pe1(config-router-af)#exi
pe1(config-router)#exit

BGP进程通过使用BGP自身的地址家族,来激活携带vpn-ipv4前缀的MP-IBGP会话,在这里将邻居激活,neighbor 4.4.4.4 send-community extended(不输入也会默认添加)这个命令将指示BGP通告扩展团体属性。

3.2.6 启用 address-family ipv4 vrf vpna

pe1(config)#router bgp 100
pe1(config-router)#address-family ipv4 vrf vpna
pe1(config-router-af)#no au
pe1(config-router-af)#no sy
pe1(config-router-af)#end

客户路由添加到vrf后,需要跨越mpls-vpn主干网通告这些路由,mp-ibgp将这些路由作为vpn-ipv4前缀,为此,需要配置BGP进程中的路由环境,用来告诉BGP需要通告的vrf路由,这里告诉BGP需要通告的vrf为vpna

3.2.7 将vpn 应用到接口中 , 注意是 pe 与 ce 相连的接口

pe1(config)#int e0/0
pe1(config-if)#ip vrf forwarding vpna
pe1(config-if)#ip add 192.168.1.2 255.255.255.252
pe1(config-if)#end

只有运行cef交换的接口才能够与vrf相关联,cef交换机制是mpls/vpn数据成功转发的首要条件,因为标签压入是通过cef交换路径完成的

注:将接口关联到一个vrf后,他的ip地址将从全局路由表中删除

3.2.8 在ce与pe上,增加 ce 到 pe 的路由。可以是静态, ospf eigrp 或是 ebgp ripv2,此实验使用静态路由

例如在ce1和pe1上执行如下命令

ce1(config)#ip route 5.5.5.5 255.255.255.255 192.168.1.2
pe1(config)#ip route vrf vpna 1.1.1.1 255.255.255.255 192.168.1.1

3.2.9 将静态路由重分布到 address-family ipv4 vrf vpna 中(bgp学习静态)

pe1(config)#router bgp 100
pe1(config-router)# address-family ipv4 vrf vpna
pe1(config-router-af)# redistribute static
pe1(config-router-af)#end

3.2.10 启用 mpls ip, 注意,是在 pe 与 p 相连的接口上启用 mpls ip

interface Ethernet0/1
ip address 10.1.1.1 255.255.255.252
half-duplex
tag-switching ip

3.2.11 测试 mpls 交换

全部设备配置完后,在ce1测试

CE1#ping 5.5.5.5 so 1.1.1.1 re 10

Type escape sequence to abort.
Sending 10, 100-byte ICMP Echos to 5.5.5.5, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1
!!!!!!!!!!
Success rate is 100 percent (10/10), round-trip min/avg/max = 20/38/112 ms

以下每台设备的配置:

CE1配置

设置去往5.5.5.5的静态路由

hostname CE1
no ip domain lookup
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface Ethernet0/0
ip address 192.168.1.1 255.255.255.252
half-duplex
!
ip route 5.5.5.5 255.255.255.255 192.168.1.2

PE1配置

hostname PE1
no ip domain lookup
ip vrf vpna
rd 100:2
route-target export 100:1
route-target import 100:1
!
ip cef
ip audit notify log
ip audit po max-events 100
mpls ldp logging neighbor-changes
interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface Ethernet0/0
ip vrf forwarding vpna
ip address 192.168.1.2 255.255.255.252
half-duplex
!
interface Ethernet0/1
ip address 10.1.1.1 255.255.255.252
half-duplex
tag-switching ip
!
router ospf 10
router-id 2.2.2.2
network 2.2.2.2 0.0.0.0 area 0
network 10.1.1.0 0.0.0.3 area 0
!
router bgp 100
no synchronization
bgp router-id 2.2.2.2
bgp log-neighbor-changes
neighbor 4.4.4.4 remote-as 100
neighbor 4.4.4.4 update-source Loopback0
no auto-summary
!
address-family vpnv4
neighbor 4.4.4.4 activate
neighbor 4.4.4.4 send-community extended
no auto-summary
exit-address-family
!
address-family ipv4 vrf vpna
redistribute static
no auto-summary
no synchronization
exit-address-family
!
ip route vrf vpna 1.1.1.1 255.255.255.255 192.168.1.1

P配置

hostname P
no ip domain lookup
ip cef
interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface Ethernet0/0
ip address 10.1.1.5 255.255.255.252
half-duplex
tag-switching ip
!
interface Ethernet0/1
ip address 10.1.1.2 255.255.255.252
half-duplex
tag-switching ip
router ospf 10
router-id 3.3.3.3
log-adjacency-changes
network 3.3.3.3 0.0.0.0 area 0
network 10.1.1.0 0.0.0.3 area 0
network 10.1.1.4 0.0.0.3 area 0

PE2配置

hostname PE2
no ip domain lookup
ip vrf vpnb
rd 100:3
route-target export 100:1
route-target import 100:1
!
ip cef
mpls ldp logging neighbor-changes interface Loopback0
ip address 4.4.4.4 255.255.255.255
!
interface Ethernet0/0
ip address 10.1.1.6 255.255.255.252
half-duplex
tag-switching ip
!
interface Ethernet0/1
ip vrf forwarding vpnb
ip address 192.168.2.1 255.255.255.252
half-duplex
router ospf 10
router-id 4.4.4.4
log-adjacency-changes
network 4.4.4.4 0.0.0.0 area 0
network 10.1.1.4 0.0.0.3 area 0
!
router bgp 100
no synchronization
bgp router-id 4.4.4.4
bgp log-neighbor-changes
neighbor 2.2.2.2 remote-as 100
neighbor 2.2.2.2 update-source Loopback0
no auto-summary
!
address-family vpnv4
neighbor 2.2.2.2 activate
neighbor 2.2.2.2 send-community extended
no auto-summary
exit-address-family
!
address-family ipv4 vrf vpnb
redistribute static
no auto-summary
no synchronization
exit-address-family
!
ip route vrf vpnb 5.5.5.5 255.255.255.255 192.168.2.2

CE2

hostname CE2
no ip domain lookup
interface Loopback0
ip address 5.5.5.5 255.255.255.255
!
interface Ethernet0/0
no ip address
shutdown
half-duplex
!
interface Ethernet0/1
ip address 192.168.2.2 255.255.255.252
half-duplex
ip route 1.1.1.1 255.255.255.255 192.168.2.1

MPLS的模拟学习过程的更多相关文章

  1. OpenStack 业务链networking-sfc介绍 (2) - 底层原理

    原文链接:https://blog.csdn.net/bc_vnetwork/article/details/65630475 1.  SFC底层实现原理 port chain和ovs driver/ ...

  2. CCIE路由实验(7) -- MPLS VPN

    1.LDP协议的各种情况2.LDP和BGP交互3.LDP高级部分4.MPLS VPN (RIP和静态)5.MPLS VPN (EIGRP)6.MPLS VPN (OSPF)7.MPLS VPN (EB ...

  3. 详解 mpls vpn 的实现

    MPLS VPN的实现 一.实验目的 该实验通过MPLS VPN的数据配置,使学生掌握路由器相关接口的IP地址设置.路由协议的配置以及MPLS VPN的完整的创建过程, 从而加深对IP网络的IP编址. ...

  4. 详解 mpls vpn 的实现

    MPLS VPN的实现 一.实验目的 该实验通过MPLS VPN的数据配置,使学生掌握路由器相关接口的IP地址设置.路由协议的配置以及MPLS VPN的完整的创建过程, 从而加深对IP网络的IP编址. ...

  5. 深度神经网络(DNN)是否模拟了人类大脑皮层结构?

    原文地址:https://www.zhihu.com/question/59800121/answer/184888043 神经元 在深度学习领域,神经元是最底层的单元,如果用感知机的模型, wx + ...

  6. python:学习自顶向下程序设计:竞技体育模拟

    学习过程记录: 一,需求及框架: 二:程序代码: #sports.py from random import random def main(): #熟悉函数的调用 printInfo() probA ...

  7. 代码本色 用编程模拟自然系统 (Daniel Shiffman 著)

    https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.7/p5.js http://www.box2d.org http://www.jbox2d.org ...

  8. appium+python自动化37-adb shell模拟点击事件(input tap)

    前言 appium有时候定位一个元素很难定位到,或者说明明定位到这个元素了,却无法点击,这个时候该怎么办呢? 求助大神是没用的,点击不了就是点击不了,appium不是万能的,这个时候应该转换思路,换其 ...

  9. 孤荷凌寒自学python第八十五天配置selenium并进行模拟浏览器操作1

    孤荷凌寒自学python第八十五天配置selenium并进行模拟浏览器操作1 (完整学习过程屏幕记录视频地址在文末) 要模拟进行浏览器操作,只用requests是不行的,因此今天了解到有专门的解决方案 ...

随机推荐

  1. hasOne、hasMany、belongsTo

    这里将hasOne.hasMany.belongsTo进行一个详细举例说明. 首先,这3个的大致中文意思: hasOne:有一个,加上主谓语应该是 ,A 有一个 B hasMany:有很多,A 有很多 ...

  2. Centos6.10源码部署zabbix-3.2.6

    环境:Centos6.10   已有lnmp环境  mysql5.7  php7.2 创建zabbix数据库 mysql> create database zabbix character se ...

  3. C# .Net String字符串效率提高-字符串拼接

    字符串操作是编程中非常频繁的操作,特别是在拼接字符串的时候.下面来说说字符串拼接的效率提升. 1. 减少装箱 值类型与引用类型之间的转换存在装箱与拆箱操作:将值类型转换成引用类型的操作叫装箱,将引用类 ...

  4. 开放接口/RESTful/Api服务的设计和安全方案详解

    一.总体思路 这个涉及到两个方面问题:一个是接口访问认证问题,主要解决谁可以使用接口(用户登录验证.来路验证)一个是数据数据传输安全,主要解决接口数据被监听(HTTPS安全传输.敏感内容加密.数字签名 ...

  5. 【Android】PreferenceActivity 详解

    PreferenceActivity是专业的设置界面,只要给它指定一个配置好的xml,它就能自动根据操作更改程序Preference的相应值. 首先要用一个xml文件来配置一个设置界面,也就是我们说的 ...

  6. 用PHPExcel导出导入Excel

    thinkPHP5.0框架 查询数据库调用Excel方法 public function exportlist(){ $orderModel = new OrderModel(); if($start ...

  7. Scala的泛型

    类比java中的泛型: 上界(协变).下界(逆变) scala中泛型采用中括号声明 val array = Array[Int](,,,) array() //声明什么类型就返回什么类型 //test ...

  8. es ik分词插件安装

    1.ik下载(下载es对应版本的ik分词包) https://github.com/medcl/elasticsearch-analysis-ik/releases 2.mac cd /usr/loc ...

  9. 在iphone的safari浏览器中,拨打电话,出现系统异常弹框

    这是系统级别的问题,暂时无法解决. IPHONE的safari浏览器电话拨打,前两次点击拨打按钮,会正常弹出系统弹框包含(电话号码,取消,呼叫). 第3次往后,点击按钮会出现另一种系统弹框包含(已阻止 ...

  10. WinForm 水晶报表的简单使用

    今天需要做出一个水晶报表, 以前在学校的时候就看过一点点,有些印象, 但没有具体的了解过,今天百度了一下,发现这个东西相当的方便简单. 还很完美. 开发工具是VS2010,水晶报表没有内置.需要自己下 ...