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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • coding平台_codeserver github

    coding平台_codeserver github这年头,IDE虽然也便宜了,不过,免费,还如此强大的就不多了。Codio,官方号称世界上最强大的基于浏览器的强大免费WebIDE,口号很响亮,当然,我也没用过,希望有朋友用了的,也来冒个泡。因为自己也是才接触这个,看了些国外用户的反馈,感觉还不错。这里就主要给寻找IDE的朋友们推荐这个东西。Codio是一个功能强大的云计算和基于浏览器的IDE(webide),从原型到部署,涵盖了完整的web…

    2022年8月31日
    5
  • JUC多线程:synchronized 锁机制原理

    JUC多线程:synchronized 锁机制原理

    2021年10月5日
    37
  • 【转载】Win10强制删除文件夹

    【转载】Win10强制删除文件夹目前比较主流的Windows系统中,我们常常会遇到要对文件以及文件夹进行整理的时候,偶尔会遇到这种奇葩的问题:删除一个文件夹的时候吧,这个文件提示需要提供管理权限,问你是否继续。当点击了那个带盾牌的(就是赋予管理权限)的那个Button之后,仍然提示需要权限……简直不讲道理。因为这个东西是偶然出现的,所以这里留几个解决方法备用。1.重启重启能解决99%的问题!!!亘古不变的真理!2.修改权限右键要删除的文件,选择属性——在属性页面可以看到上方有安全权限,点击之后选择一个.

    2022年6月9日
    33
  • javascript格式化输出的实现(MuJS)

    javascript格式化输出的实现(MuJS)MuJS是一款支持嵌入式开发的轻量级javascript解释器。javascript主要是针对web开发的脚本语言,所以主要借助浏览器来调试;但mujs针对的是嵌入式开发,调试时的交互主要靠输入输出终端,javascript本身是不支持的,所以需要调用c语言的打印函数来实现。下面给出两个例子,一个是普通输出,符合脚本语言的解释性语言的特点,不考虑变量的类型;另一个是简单的格式化输出。前一个…

    2025年6月14日
    2
  • WOW.js – 让页面滚动更有趣

    WOW.js – 让页面滚动更有趣

    2021年9月23日
    43
  • 博途scl编程实例_博途plc编程流程

    博途scl编程实例_博途plc编程流程SCL:StructuredContorlLanguage,结构化控制语言。在TIA博途软件中,默认支持SCL语言,在建立程序块时可以直接选择SCL语言。SCL语言类似计算机高级语言,如果你有C、Java、C++、Python这种高级语言的学习经历,再学习SCL就会容易很多。在用SCL语言编程时,主要用IF…THEN/FOR/WHILE语句去构造条件、循环、判断这样的结构,在这些结构中再次添加指令,去实现逻辑判断。所有程序的编写都是在纯文本的环境下编辑,不像梯形图那么直观。能把

    2022年10月7日
    1

发表回复

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

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