美文网首页百年工匠
用MPLS VPN配置Hub and Spoke

用MPLS VPN配置Hub and Spoke

作者: 爱看时事的通信崔 | 来源:发表于2020-05-23 08:56 被阅读0次

目前行业的组网应用开始出现网络扁平化趋势,其中Hub-And-Spoke组网就是一种典型的扁平化组网方式。该模式是通过在VPN中设置总部,要求其它分部的互访全部通过总部进行,以实现对分部网络流量的集中控制。

在本文中,我们基于华为ENSP模拟器,用BGP/MPLS VPN完成Hub and Spoke组网的配置实验,模拟实现某企业总公司和分公司之间的安全互访。具体实验拓扑如下:

实验拓扑图

有几点进行说明

  1. 中间的三台PE路由器模拟的是骨干网,其IGP使用OSPF协议以实现骨干网IP连通,并配置MPLS和MPLS-LDP;
  2. PE和CE间使用静态路由,配置不同的BGP AS号,模拟公司接入网;
  3. 总公司PE作为Hub,分公司PE作为Spoke,Hub和Spoke之间需要建立MP-IBGP对等体;
  4. 分公司间的流量互访经过总公司,所以分公司间无需建立MP-IBGP对等体,总公司CE要设置允许AS号重复;
  5. 限于篇幅,不对基础知识进行讲解,下面直接贴出详细配置。

总公司PE

sysname 总公司-PE
#
ip vpn-instance vpn_in
 ipv4-family
  route-distinguisher 100:21
  vpn-target 100:1 import-extcommunity
#
ip vpn-instance vpn_out
 ipv4-family
  route-distinguisher 100:22
  vpn-target 200:1 export-extcommunity
#
mpls lsr-id 1.1.1.1
mpls
 label advertise non-null
#
mpls ldp
#
interface GigabitEthernet0/0/0
 ip address 10.1.1.2 255.255.255.0 
 mpls
 mpls ldp
#
interface GigabitEthernet0/0/1
 ip address 11.1.1.2 255.255.255.0 
 mpls
 mpls ldp
#
interface GigabitEthernet0/0/2
 ip binding vpn-instance vpn_in
 ip address 12.1.1.2 255.255.255.0 
#
interface GigabitEthernet4/0/0
 ip binding vpn-instance vpn_out
 ip address 13.1.1.2 255.255.255.0 
#
interface LoopBack0
 ip address 1.1.1.1 255.255.255.255 
#
bgp 100
 peer 2.2.2.2 as-number 100 
 peer 2.2.2.2 connect-interface LoopBack0
 peer 3.3.3.3 as-number 100 
 peer 3.3.3.3 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 2.2.2.2 enable
  peer 3.3.3.3 enable
 # 
 ipv4-family vpnv4
  policy vpn-target
  peer 2.2.2.2 enable
  peer 3.3.3.3 enable
 #
 ipv4-family vpn-instance vpn_in 
  import-route direct
  peer 12.1.1.1 as-number 65430 
 #
 ipv4-family vpn-instance vpn_out 
  import-route direct
  peer 13.1.1.1 as-number 65430 
  peer 13.1.1.1 allow-as-loop
#
ospf 1 
 area 0.0.0.0 
  network 1.1.1.1 0.0.0.0 
  network 10.1.1.0 0.0.0.255 
  network 11.1.1.0 0.0.0.255 

总公司CE

sysname 总公司-CE
#
interface GigabitEthernet0/0/0
 ip address 12.1.1.1 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 13.1.1.1 255.255.255.0 
#
bgp 65430
 peer 12.1.1.2 as-number 100 
 peer 13.1.1.2 as-number 100 
 #
 ipv4-family unicast
  undo synchronization
  import-route direct
  peer 12.1.1.2 enable
  peer 13.1.1.2 enable

分公司PE1

#
 sysname 分公司-PE1
ip vpn-instance vpna
 ipv4-family
  route-distinguisher 100:1
  vpn-target 100:1 export-extcommunity
  vpn-target 200:1 import-extcommunity
#
mpls lsr-id 2.2.2.2
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0
 ip address 10.1.1.1 255.255.255.0 
 mpls
 mpls ldp
#
interface GigabitEthernet0/0/2
 ip binding vpn-instance vpna
 ip address 100.1.1.2 255.255.255.0 
#
interface LoopBack0
 ip address 2.2.2.2 255.255.255.255 
#
bgp 100
 peer 1.1.1.1 as-number 100 
 peer 1.1.1.1 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 1.1.1.1 enable
 # 
 ipv4-family vpnv4
  policy vpn-target
  peer 1.1.1.1 enable
 #
 ipv4-family vpn-instance vpna 
  import-route direct
  peer 100.1.1.1 as-number 65410 
#
ospf 1 
 area 0.0.0.0 
  network 2.2.2.2 0.0.0.0 
  network 10.1.1.0 0.0.0.255 

分公司CE1

#
 sysname 分公司-CE1
interface GigabitEthernet0/0/0
 ip address 100.1.1.1 255.255.255.0 
#
bgp 65410
 peer 100.1.1.2 as-number 100 
 #
 ipv4-family unicast
  undo synchronization
  import-route direct
  peer 100.1.1.2 enable
  

分公司PE2

#
 sysname 分公司-PE2
#
ip vpn-instance vpna
 ipv4-family
  route-distinguisher 100:3
  vpn-target 100:1 export-extcommunity
  vpn-target 200:1 import-extcommunity
#
mpls lsr-id 3.3.3.9
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/1
 ip address 11.1.1.1 255.255.255.0 
 mpls
 mpls ldp
#
interface GigabitEthernet0/0/2
 ip binding vpn-instance vpna
 ip address 120.1.1.2 255.255.255.0 
#
interface LoopBack0
 ip address 3.3.3.3 255.255.255.255 
#
bgp 100
 peer 1.1.1.1 as-number 100 
 peer 1.1.1.1 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 1.1.1.1 enable
 # 
 ipv4-family vpnv4
  policy vpn-target
  peer 1.1.1.1 enable
 #
 ipv4-family vpn-instance vpna 
  import-route direct
  peer 120.1.1.1 as-number 65420 
#
ospf 1 
 area 0.0.0.0 
  network 2.2.2.2 0.0.0.0 
  network 11.1.1.0 0.0.0.255 

分公司CE2

#
 sysname 分公司-CE2
#
interface GigabitEthernet0/0/0
 ip address 120.1.1.1 255.255.255.0 
#
bgp 65420
 peer 120.1.1.2 as-number 100 
 #
 ipv4-family unicast
  undo synchronization
  import-route direct
  peer 120.1.1.2 enable

验证

实验配置完成,验证一下实验效果。

  1. 从分公司1 ping 分公司2,验证连通情况
ping 120.1.1.1
  PING 120.1.1.1: 56  data bytes, press CTRL_C to break
    Reply from 120.1.1.1: bytes=56 Sequence=1 ttl=250 time=70 ms
  1. 从分公司1 tracert 分公司2,注意中间总公司负责流量的汇聚和转发
tracert 120.1.1.1

 1 100.1.1.2 20 ms  10 ms  20 ms 
 2 13.1.1.2 < AS=100 > 20 ms  50 ms  30 ms 
 3 13.1.1.1 < AS=100 > 30 ms  20 ms  20 ms
 # 第3和4步,流量在总公司CE进行汇聚转发
 4 12.1.1.2 < AS=65430 > 30 ms  30 ms  20 ms 
 5 120.1.1.2 < AS=100 > 40 ms  30 ms  30 ms 
 6 120.1.1.1 < AS=100 > 60 ms  40 ms  50 ms 

相关文章

  • 用MPLS VPN配置Hub and Spoke

    目前行业的组网应用开始出现网络扁平化趋势,其中Hub-And-Spoke组网就是一种典型的扁平化组网方式。该模式是...

  • 【今日新知】MPLS基本概述

    一、MPLS概述 MPLS是什么:标签协议转发 MPLS有什么作用:现用于MPLS VPN中,封装标签使用。 MP...

  • MPLS分类

    基于MPLS的VPN 传统的VPN一般是通过GRE(Generic Routing Encapsulation)、...

  • IEPL与MPLS VPN对比

    在企业组网的过程中,IEPL和MPLS VPN经常会拿来一起对比,大家不知道该选择MPLS VPN还是选择IEPL...

  • MPLS and VPN Architectures.pdf

    下载地址:MPLS and VPN Architectures[www.rejoiceblog.com].pdf

  • docker极速搭建一个pptp vpn

    1. 在docker hub上找个pptp vpn容器,这里用的是mobtitude/vpn-pptp[http...

  • MPLS VPN之MPLS(1)

    一、MPLS产生背景 MPLS起初是为提高数据包转发效率而产生的。 早期的路由器是用软件的方式来进行报文转发处理的...

  • MPLS_VPN

    配置思路: 1.首先配置ISP内部的IGP协议,一般使用OSPF、ISIS路由协议。 2.配置ISP内部的mpls...

  • MPLS VPN(3)

    一、MPLS VPN的网络架构 1、CE Custom Edge 用户网络的边界设备,直接与服务提供商网络相连,...

  • HCIA day①

    公网 pppoe 拨号 ppp 点对点协议 HDLC 高数据控制 VPN \gre\ mpls\ ospf NA...

网友评论

    本文标题:用MPLS VPN配置Hub and Spoke

    本文链接:https://www.haomeiwen.com/subject/zxqkahtx.html