HUB&SPOKE架构

Hub&Spoke架构MPLS VPN

目录

一、实验设想... 1

二、实验拓扑... 1

三、配置脚本... 1

HUB   CE (r4): 1

2.     HUB PE(R1): 3

3.     PE1(R2): 5

4.     PE2(R3): 7

5.     CE1(R5):... 9

6.     CE2(R6) 11

四、总结现象... 12

一、实验设想

当采用Hub&Spoke方案时,可以将多个站点中的一个站点设置为Hub站点,其余站点为Spoke站点。站点间的互访必须通过Hub站点,通过Hub站点集中管控站点间的数据传输。我们的目的是R5访问R6的流量数据经过HUB站点R4. 分支之间可以互相访问,但是必须经过HUB总部节点。我们采用EBGP的方法。也可以使用OSPF。公网底层我们采用ISIS作为底层。49.0001.0000.0000.000X.00

二、实验拓扑

ff97b6c221c84286aaa91d697ff609fb.png

我们规划PE所在的AS为123,CE所在的AS为26200. R4为HUB CE.  R5和R6为SPOKE  流量的访问走向为R5 到R1走到R4在去到R6的流量走向。我们的思路是HUB PE上去配置两个VRF,一个是INT,一个是OUT。我们根据规划R5的业务RD为5:5   in RT为55:55 out RT为54:54.R6的业务RD为6:6,in RT为66:66 out RT为64:64.这样我们在HUB PE上的INT 为 54:54 65:65.  OUT为55:55. 66:66.

三、配置脚本

HUB   CE (r4):

<R4>DIS CU

[V200R003C00]

#

 sysname R4

#

 snmp-agent local-engineid 800007DB03000000000000

 snmp-agent

#

 clock timezone China-Standard-Time minus 08:00:00

#

portal local-server load flash:/portalpage.zip

#

 drop illegal-mac alarm

#

 wlan ac-global carrier id other ac id 0

#

 set cpu-usage threshold 80 restore 75

#

aaa

 authentication-scheme default

 authorization-scheme default

 accounting-scheme default

 domain default

 domain default_admin

 local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$

 local-user admin service-type http      

#                                        

firewall zone Local                      

 priority 15                             

#                                        

interface GigabitEthernet0/0/0           

#                                        

interface GigabitEthernet0/0/0.100       

 description vpn_in                      

 dot1q termination vid 100               

 ip address 14.1.1.4 255.255.255.0       

 arp broadcast enable                    

#                                        

interface GigabitEthernet0/0/0.200       

 description vpn_out                     

 dot1q termination vid 200               

 ip address 41.1.1.4 255.255.255.0       

 arp broadcast enable                    

#                                         

interface GigabitEthernet0/0/1           

#                                        

interface GigabitEthernet0/0/2           

#                                        

interface NULL0                          

#                                        

bgp 26200                                

 peer 14.1.1.1 as-number 123             

 peer 14.1.1.1 ebgp-max-hop 255          

 peer 41.1.1.1 as-number 123             

 peer 41.1.1.1 ebgp-max-hop 255          

 #                                       

 ipv4-family unicast                     

  undo synchronization                   

  peer 14.1.1.1 enable                   

  peer 41.1.1.1 enable                    

#                                        

user-interface con 0                     

 authentication-mode password            

user-interface vty 0 4                   

user-interface vty 16 20                 

#                                        

wlan ac                

2.   HUB PE(R1):

[R1]dis current-configuration

[V200R003C00]

#

 sysname R1

##

ip vpn-instance vpn_in

 ipv4-family

  route-distinguisher 11:11

  vpn-target 54:54 65:65 import-extcommunity

#

ip vpn-instance vpn_out

 ipv4-family

  route-distinguisher 22:22              

  vpn-target 55:55 66:66 export-extcommunity

#                                        

mpls lsr-id 1.1.1.1                      

mpls                                     

#                                        

mpls ldp                                 

#                                         #                                        

isis 1                                   

 is-level level-2                        

 cost-style wide                         

 network-entity 49.0001.0000.0000.0001.00

                       

interface GigabitEthernet0/0/0           

 ip address 12.1.1.1 255.255.255.0       

 isis enable 1                           

 mpls                                    

 mpls ldp                                

#                                        

interface GigabitEthernet0/0/1           

 ip address 13.1.1.1 255.255.255.0       

 isis enable 1                           

 mpls                                    

 mpls ldp                                

#                                        

interface GigabitEthernet0/0/2           

#                                        

interface GigabitEthernet0/0/2.100       

 description vpn_in                      

 dot1q termination vid 100               

 ip binding vpn-instance vpn_in          

 ip address 14.1.1.1 255.255.255.0       

 arp broadcast enable                    

#                                        

interface GigabitEthernet0/0/2.200       

 description vpn_out                     

 dot1q termination vid 200               

 ip binding vpn-instance vpn_out         

 ip address 41.1.1.1 255.255.255.0       

 arp broadcast enable                     

#                                        

interface NULL0                          

#                                        

interface LoopBack0                      

 ip address 1.1.1.1 255.255.255.255      

 isis enable 1                           

#                                        

bgp 123                                  

 peer 2.2.2.2 as-number 123              

 peer 2.2.2.2 connect-interface LoopBack0

 peer 3.3.3.3 as-number 123              

 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         

  peer 14.1.1.4 as-number 26200          

  peer 14.1.1.4 ebgp-max-hop 255            

  peer 14.1.1.4 substitute-as            

 #                                       

 ipv4-family vpn-instance vpn_out        

  peer 41.1.1.4 as-number 26200          

  peer 41.1.1.4 ebgp-max-hop 255         

  peer 41.1.1.4 substitute-as               // ;#启用 AS 号码替换功能,令 PE 使用本地 AS 号码替换收到的私网路由中 CE 所在 VPN 站点的 AS 号码

  peer 41.1.1.4 allow-as-loop 2             //本地AS号允许重复两次

#                                        

user-interface con 0                     

 authentication-mode password            

user-interface vty 0 4                   

user-interface vty 16 20                 

#                                        

wlan ac                                  

#                                        

return   

3.   PE1(R2):

[R2]DIS current-configuration

[V200R003C00]

#

 sysname R2

#

 snmp-agent local-engineid 800007DB03000000000000

 snmp-agent

#

 clock timezone China-Standard-Time minus 08:00:00

#

portal local-server load flash:/portalpage.zip

#

 drop illegal-mac alarm

#

 wlan ac-global carrier id other ac id 0

#

 set cpu-usage threshold 80 restore 75

#

ip vpn-instance vpn_spoke1

 ipv4-family

  route-distinguisher 55:55

  vpn-target 54:54 export-extcommunity

  vpn-target 55:55 import-extcommunity

#

mpls lsr-id 2.2.2.2

mpls                                     

#                                        

mpls ldp                                 

#                                        

#                                        

isis 1                                   

 is-level level-2                        

 cost-style wide                         

 network-entity 49.0001.0000.0000.0002.00

#                                        

firewall zone Local                      

 priority 15                             

#                                        

interface GigabitEthernet0/0/0           

 ip address 12.1.1.2 255.255.255.0       

 isis enable 1                           

 mpls                                    

 mpls ldp                                

#                                        

interface GigabitEthernet0/0/1           

 ip binding vpn-instance vpn_spoke1      

 ip address 25.1.1.2 255.255.255.0       

#                                        

interface GigabitEthernet0/0/2           

#                                        

interface NULL0                          

#                                        

interface LoopBack0                      

 ip address 2.2.2.2 255.255.255.255      

 isis enable 1                           

#                                        

bgp 123                                  

 peer 1.1.1.1 as-number 123              

 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 vpn_spoke1     

  peer 25.1.1.5 as-number 26200          

  peer 25.1.1.5 ebgp-max-hop 255         

  peer 25.1.1.5 substitute-as            

  peer 25.1.1.5 allow-as-loop 2           

#                                        

user-interface con 0                     

 authentication-mode password            

user-interface vty 0 4                   

user-interface vty 16 20                 

#                                        

wlan ac                                  

#                                        

Return

4.   PE2(R3):

<R3>DIS current-configuration

[V200R003C00]

#

 sysname R3

#

 snmp-agent local-engineid 800007DB03000000000000

 snmp-agent

#

 clock timezone China-Standard-Time minus 08:00:00

#

portal local-server load flash:/portalpage.zip

#

 drop illegal-mac alarm

#

 wlan ac-global carrier id other ac id 0

#

 set cpu-usage threshold 80 restore 75

#

ip vpn-instance spoke2

 ipv4-family

  route-distinguisher 6:6

  vpn-target 65:65 export-extcommunity

  vpn-target 66:66 import-extcommunity

#

mpls lsr-id 3.3.3.3

mpls                                     

#                                        

mpls ldp                                 

#                                        

#                                        

aaa                                      

 authentication-scheme default           

 authorization-scheme default            

 accounting-scheme default               

 domain default                          

 domain default_admin                    

 local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$

 local-user admin service-type http      

#                                        

isis 1                                   

 is-level level-2                        

 cost-style wide                         

 network-entity 49.0001.0000.0000.0003.00

#                                        

firewall zone Local                      

 priority 15                             

#                                        

interface GigabitEthernet0/0/0           

 ip address 13.1.1.3 255.255.255.0       

 isis enable 1                           

 mpls                                    

 mpls ldp                                

#                                        

interface GigabitEthernet0/0/1           

 ip binding vpn-instance spoke2          

 ip address 36.1.1.3 255.255.255.0       

#                                        

interface GigabitEthernet0/0/2           

#                                        

interface NULL0                          

#                                        

interface LoopBack0                      

 ip address 3.3.3.3 255.255.255.255      

 isis enable 1                           

#                                        

bgp 123                                  

 peer 1.1.1.1 as-number 123              

 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 spoke2         

  peer 36.1.1.6 as-number 26200          

  peer 36.1.1.6 ebgp-max-hop 255         

  peer 36.1.1.6 substitute-as            

  peer 36.1.1.6 allow-as-loop 2          

#                                         

user-interface con 0                     

 authentication-mode password            

user-interface vty 0 4                   

user-interface vty 16 20                 

#                       

5.   CE1(R5):

<R5>DIS current-configuration

[V200R003C00]

#

 sysname R5

#

 snmp-agent local-engineid 800007DB03000000000000

 snmp-agent

#

 clock timezone China-Standard-Time minus 08:00:00

#

portal local-server load flash:/portalpage.zip

#

 drop illegal-mac alarm

#

 wlan ac-global carrier id other ac id 0

#

 set cpu-usage threshold 80 restore 75

#

aaa

 authentication-scheme default

 authorization-scheme default

 accounting-scheme default

 domain default

 domain default_admin

 local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$

 local-user admin service-type http      

#                                        

firewall zone Local                      

 priority 15                             

#                                        

interface GigabitEthernet0/0/0           

 ip address 25.1.1.5 255.255.255.0       

#                                        

interface GigabitEthernet0/0/1           

#                                        

interface GigabitEthernet0/0/2           

#                                        

interface NULL0                          

#                                        

interface LoopBack0                      

 ip address 5.5.5.5 255.255.255.255      

#                                        

bgp 26200                                

 peer 25.1.1.2 as-number 123             

 peer 25.1.1.2 ebgp-max-hop 255          

 #                                       

 ipv4-family unicast                     

  undo synchronization                   

  network 5.5.5.5 255.255.255.255        

  peer 25.1.1.2 enable                    

#                                        

user-interface con 0                     

 authentication-mode password            

user-interface vty 0 4                   

user-interface vty 16 20                 

#                                        

wlan ac                     

6.   CE2(R6)

<R6>DIS current-configuration

[V200R003C00]

#

#                                        

firewall zone Local                      

 priority 15                             

#                                        

interface GigabitEthernet0/0/0           

 ip address 36.1.1.6 255.255.255.0       

#                                        

interface GigabitEthernet0/0/1           

#                                        

interface GigabitEthernet0/0/2           

#                                        

interface NULL0                          

#                                        

interface LoopBack0                      

 ip address 6.6.6.6 255.255.255.255      

#                                        

bgp 26200                                

 peer 36.1.1.3 as-number 123             

 peer 36.1.1.3 ebgp-max-hop 255          

 #                                       

 ipv4-family unicast                     

  undo synchronization                   

  network 6.6.6.6 255.255.255.255        

  peer 36.1.1.3 enable                   

#                                        

user-interface con 0                      

 authentication-mode password            

user-interface vty 0 4                   

user-interface vty 16 20                 

#                                        

wlan ac                                  

#     

四、总结现象

我们来进行实验验证

18fa2cda4e5a43e489da7960f789adfb.png

我们可以看到6访问5的流量走向经过HUB点R4,才去访问的R5.

e72b6acd04874d07aa359587efc3d7e9.png

fa10e107be424ecd91e1172e52a1784b.png

我们的流量走向是这样的。我们需要注意AS_path会防环,会导致我们的路由无法被传递,我们需要配置AS替换,PE本地的AS会替换私网CE的AS号和允许本地AS号出现两次。从而使得路由正确转发。HUB PE和HUB CE.我们采用子接口的方式用互联。

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
MPLS (Multiprotocol Label Switching) 是一种网络技术,它扩展了传统的IP转发方式,引入了标签交换的概念,使得数据包能够更快速、更高效地在网络中传输。在 MPLS 中,Hub-Spoke模型是一种常见的网络架构设计,主要用于大型企业网络或服务提供商网络。 **Hub-Spoke模型:** - **Hub**: 在这种模型中,通常指的是中心节点或核心路由器,负责连接到多个子网(Spokes)。它是所有流量的主要入口和出口点。 - **Spoke**: 指的是从中心Hub辐射出去的分支网络,每个Spoke代表一个单独的区域或部门,如分公司、数据中心等。Spokes与Hub之间建立专用的MPLS隧道,数据通过这些隧道定向传输到Hub。 - **优点**: - 带宽效率:由于流量被集中处理,Hub可以为每个Spoke提供专用带宽,避免了全网广播或广播风暴。 - 网络扩展:当需要添加新的Spoke时,只需要在Hub和新Spoke之间配置连接,而无需修改整个网络的其他部分。 - 安全性:Hub可以实施防火墙策略,保护内部Spoke之间的通信不受外部干扰。 **如何工作:** 1. 数据包进入Hub时,会被打上标签,标识出它的目的地。 2. Hub根据标签转发数据包,不关心底层的IP路由信息。 3. Spoke之间的通信通过Hub进行,数据包在Hub内进行标签交换,然后沿预定路径到达目的地Spoke。 4. 当数据包到达目标Spoke时,标签被移除,执行最后的IP转发。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值