MPLS 虚拟专用网络 Hub and Spoke实验

MPLS 虚拟专用网络 Hub and Spoke实验

MPLS VPN Hub and Spoke实验

实验拓扑

在这里插入图片描述

实验要求

1.R6与R7通信需要经过R1,不可以直通
2.HUB-CE,SPOKE-CE在同一个AS(allow
-as-loop的合理使用)
3.各个PE与CE之间均为EBGP关系(也可以做IBGP,OSPF)

配置

1.R2,3,4,5配置路由,并启用ospf

2.PE之间配置MP-BGP邻居关系

(减少IBGP邻居的建立使用 RR 反射器,其中R2充当反射器最为合适)

3.R2,3,4,5启用MPLS

3.SPOKE-PE配置VPN实例,并进入接口进行绑定

4.HUB-PE上配置只进的VPN实例,和只出的VPN实例

5.配置PE与CE间路由交换(允许路由环路)

测试:

R2上dis bgp vpnv4 vpn-instance in routing-table
在这里插入图片描述
R2上dis bgp vpnv4 vpn-instance out routing-table

在这里插入图片描述
R6pingR7
在这里插入图片描述

全部配置:

R1

#
 sysname R1
#
interface GigabitEthernet0/0/0
 ip address 10.1.12.1 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 10.2.12.1 255.255.255.0 
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
 ip address 10.1.1.1 255.255.255.0 
#
bgp 10
 peer 10.1.12.2 as-number 100 
 peer 10.2.12.2 as-number 100 
 #
 ipv4-family unicast
  undo synchronization
  network 10.1.1.0 255.255.255.0 
  peer 10.1.12.2 enable
  peer 10.1.12.2 allow-as-loop
  peer 10.2.12.2 enable
  peer 10.2.12.2 allow-as-loop
#

R2

#
 sysname R2
#
ip vpn-instance in
 ipv4-family
  route-distinguisher 2:2
  vpn-target 1:1 1:2 import-extcommunity
#
ip vpn-instance out
 ipv4-family
  route-distinguisher 2:1
  vpn-target 2:1 export-extcommunity
#
mpls lsr-id 10.2.2.2
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0
 ip binding vpn-instance in
 ip address 10.1.12.2 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip binding vpn-instance out
 ip address 10.2.12.2 255.255.255.0 
#
interface GigabitEthernet0/0/2
 ip address 10.1.23.1 255.255.255.0 
 mpls
 mpls ldp
#
interface NULL0
#
interface LoopBack0
 ip address 10.2.2.2 255.255.255.0 
#
bgp 100
 peer 10.4.4.4 as-number 100 
 peer 10.4.4.4 connect-interface LoopBack0
 peer 10.5.5.5 as-number 100 
 peer 10.5.5.5 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 10.4.4.4 enable
  peer 10.4.4.4 reflect-client
  peer 10.4.4.4 next-hop-local 
  peer 10.5.5.5 enable
  peer 10.5.5.5 reflect-client
  peer 10.5.5.5 next-hop-local 
 # 
 ipv4-family vpnv4
  policy vpn-target
  peer 10.4.4.4 enable
  peer 10.4.4.4 reflect-client
  peer 10.5.5.5 enable
  peer 10.5.5.5 reflect-client
 #
 ipv4-family vpn-instance in 
  peer 10.1.12.1 as-number 10 
 #
 ipv4-family vpn-instance out 
  peer 10.2.12.1 as-number 10 
  peer 10.2.12.1 allow-as-loop 2
#
ospf 1 router-id 2.2.2.2 
 area 0.0.0.0 
  network 10.1.23.0 0.0.0.255 
  network 10.2.2.2 0.0.0.0 
#

R3

#
 sysname R3
#
mpls lsr-id 10.3.3.3
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0
 ip address 10.1.23.2 255.255.255.0 
 mpls
 mpls ldp
#
interface GigabitEthernet0/0/1
 ip address 10.1.34.2 255.255.255.0 
 mpls
 mpls ldp
#
interface GigabitEthernet0/0/2
 ip address 10.1.35.2 255.255.255.0 
 mpls
 mpls ldp
#
interface NULL0
#
interface LoopBack0
 ip address 10.3.3.3 255.255.255.0 
#
ospf 1 router-id 3.3.3.3 
 area 0.0.0.0 
  network 10.1.23.0 0.0.0.255 
  network 10.1.34.0 0.0.0.255 
  network 10.1.35.0 0.0.0.255 
  network 10.3.3.3 0.0.0.0 
#

R4

#
 sysname R4
#
ip vpn-instance spoke
 ipv4-family
  route-distinguisher 1:1
  vpn-target 1:1 export-extcommunity
  vpn-target 2:1 import-extcommunity
#
mpls lsr-id 10.4.4.4
mpls
#
mpls ldp
#

interface GigabitEthernet0/0/0
 ip address 10.1.34.1 255.255.255.0 
 mpls
 mpls ldp
#
interface GigabitEthernet0/0/1
 ip binding vpn-instance spoke
 ip address 10.1.46.2 255.255.255.0 
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
 ip address 10.4.4.4 255.255.255.0 
#
bgp 100
 peer 10.2.2.2 as-number 100 
 peer 10.2.2.2 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 10.2.2.2 enable
  peer 10.2.2.2 next-hop-local 
  peer 10.2.2.2 allow-as-loop
 # 
 ipv4-family vpnv4
  policy vpn-target
  peer 10.2.2.2 enable
 #
 ipv4-family vpn-instance spoke 
  peer 10.1.46.1 as-number 10 
  peer 10.1.46.1 allow-as-loop
#
ospf 1 router-id 4.4.4.4 
 area 0.0.0.0 
  network 10.1.34.0 0.0.0.255 
  network 10.4.4.4 0.0.0.0 
#

R5

#
 sysname R5
#
ip vpn-instance spoke
 ipv4-family
  route-distinguisher 1:2
  vpn-target 1:2 export-extcommunity
  vpn-target 2:1 import-extcommunity
#
mpls lsr-id 10.5.5.5
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0
 ip address 10.1.35.1 255.255.255.0 
 mpls
 mpls ldp
#
interface GigabitEthernet0/0/1
 ip binding vpn-instance spoke
 ip address 10.1.57.2 255.255.255.0 
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
 ip address 10.5.5.5 255.255.255.0 
#
bgp 100
 peer 10.2.2.2 as-number 100 
 peer 10.2.2.2 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 10.2.2.2 enable
  peer 10.2.2.2 next-hop-local 
  peer 10.2.2.2 allow-as-loop
 # 
 ipv4-family vpnv4
  policy vpn-target
  peer 10.2.2.2 enable
 #
 ipv4-family vpn-instance spoke 
  peer 10.1.57.1 as-number 10 
  peer 10.1.57.1 allow-as-loop
#
ospf 1 router-id 5.5.5.5 
 area 0.0.0.0 
  network 10.1.35.0 0.0.0.255 
  network 10.5.5.5 0.0.0.0 
#

R6

#
 sysname R6
#
interface GigabitEthernet0/0/0
 ip address 10.1.46.1 255.255.255.0 
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
 ip address 10.6.6.6 255.255.255.0 
#
bgp 10
 peer 10.1.46.2 as-number 100 
 #
 ipv4-family unicast
  undo synchronization
  network 10.6.6.0 255.255.255.0 
  peer 10.1.46.2 enable
  peer 10.1.46.2 allow-as-loop 2
 # 
 ipv4-family vpnv4
  policy vpn-target
#

R7

#
 sysname R7
#
interface GigabitEthernet0/0/0
 ip address 10.1.57.1 255.255.255.0 
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
 ip address 10.7.7.7 255.255.255.0 
#
bgp 10
 peer 10.1.57.2 as-number 100 
 #
 ipv4-family unicast
  undo synchronization
  network 10.7.7.0 255.255.255.0 
  peer 10.1.57.2 enable
  peer 10.1.57.2 allow-as-loop 2
#
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/100140.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • vue-router(路由)详细教程

    vue-router(路由)详细教程  由于Vue在开发时对路由支持的不足,于是官方补充了vue-router插件。vue的单页面应用是基于路由和组件的,路由用于设定访问路径,并将路径和组件映射起来。传统的页面应用,是用一些超链接来实现页面切换和跳转的。在vue-router单页面应用中,则是路径之间的切换,实际上就是组件的切换。路由就是SPA(单页应用)的路径管理器。再通俗的说,vue-router就是我们WebApp的链…

    2022年7月11日
    39
  • python nonlocal关键字「建议收藏」

    python nonlocal关键字「建议收藏」pythonnonlocal关键字non-local非局部变量如果两个嵌套函数,一个函数A里面又包含了一个函数B,那么对于B中的名称来说A中的作用域就为nonlocal作用域:enclosing作用域—外层非全局作用域如果要在内层函数中修改外层变量,则需要用到nonlocal关键字defouter():num=10print(num)definner():nonlocalnum#内层函数未定义此变量n

    2022年9月3日
    3
  • 为了1024[通俗易懂]

    为了1024[通俗易懂]为了1024

    2022年6月24日
    25
  • 数据分析决策树算法_大数据决策树算法

    数据分析决策树算法_大数据决策树算法在2006年12月召开的IEEE数据挖掘国际会议上,与会的各位专家选出了当时的十大数据挖掘算法(top10dataminingalgorithms)。本博客的十大数据挖掘算法系列已经介绍过其中的5个。本文主要介绍决策树中的C4.5,这也是当年位列十大数据挖掘算法之首的经典算法,最后,我们还将演示在Weka(怀卡托智能环境)中进行数据挖掘的实际操作方法

    2022年5月3日
    28
  • 菜鸟教程 Java 学习笔记 (基础教程)

    1、Java对象和类Java作为一种面向对象的语言,支持以下基本概念:多态、继承、封装、抽象、类、对象实例、方法、重载。对象:对象是类的一个实例,有状态和行为。类:类是一个模板,它描述一类对象的行为和状态。1.1创建对象对象是根据类创建的,在Java中,使用关键字new来创建一个新的对象。创建对象需要以下三步:(1)声明:声明一个对象,包括对象名称和对象类型。(2)实例化:使

    2022年4月4日
    44
  • PyCharm教程[通俗易懂]

    PyCharm教程[通俗易懂]Pycharm介绍Pycharm安装Pycharm了解基础知识Pycharm快捷键Pycharm快捷方式PycharmOmniPycharmMacrosPycharmMicrosPycharm改进和编写代码PycharmConsolePycharmshellPycharm调试Pycharm版本控制集成PycharmHTML和CSS集成Py…

    2022年8月25日
    3

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号