前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >MPLS 虚拟专用网络 Hub and Spoke实验

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

作者头像
全栈程序员站长
发布2021-04-14 10:09:54
1.6K0
发布2021-04-14 10:09:54
举报
文章被收录于专栏:全栈程序员必看

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

代码语言:javascript
复制
#
 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

代码语言:javascript
复制
#
 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

代码语言:javascript
复制
#
 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

代码语言:javascript
复制
#
 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

代码语言:javascript
复制
#
 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

代码语言:javascript
复制
#
 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

代码语言:javascript
复制
#
 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.cn/100140.html原文链接:

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • MPLS VPN Hub and Spoke实验
    • 实验拓扑
      • 实验要求
        • 配置
          • 测试:
            • 全部配置:
            相关产品与服务
            VPN 连接
            VPN 连接(VPN Connections)是一种基于网络隧道技术,实现本地数据中心与腾讯云上资源连通的传输服务,它能帮您在 Internet 上快速构建一条安全、可靠的加密通道。VPN 连接具有配置简单,云端配置实时生效、可靠性高等特点,其网关可用性达到 99.95%,保证稳定、持续的业务连接,帮您轻松实现异地容灾、混合云部署等复杂业务场景。
            领券
            问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档