HUB&SPOKE组网(IGP)

HUB&SPOKE(中心辐射型)组网是一种常见的网络拓扑结构,通常用于VPN、广域网(WAN)或云计算环境中。它的名称来源于车轮的结构,中心(HUB)是核心节点,辐射(SPOKE)是连接到中心的边缘节点。

HUB&SPOKE组网的优点
简化管理:集中管理减少了配置和维护的复杂性。

成本效益:通过集中资源,可以减少边缘节点的硬件和软件成本。

安全性:集中实施安全策略,提高了整体网络的安全性。

可扩展性:可以轻松添加新的SPOKE节点,扩展网络规模

应用场景:

企业网络:总部作为HUB,分支机构作为SPOKE。

云计算:云服务提供商作为HUB,客户作为SPOKE。

VPN网络:中心VPN网关作为HUB,远程用户或办公室作为SPOKE。

下列该实验通过配置基于HUB&SPOKE架构的MPLS VPN网络,实现分支机构(R1)与远程节点(R6)之间的VPN通信。核心节点R3和R5作为HUB,承担路由转发与策略管理功能,SPOKE节点通过VPN实例隔离流量并接入中心网络。
在这里插入图片描述

直连先配置好
R1
int g0/0/0
ip ad 13.1.1.1 24 
int loop 0 
ip ad 1.1.1.1 32
q
ospf 1 router 1.1.1.1 
a 0
network 1.1.1.1 0.0.0.0
network 13.1.1.1 0.0.0.0
R2
int g0/0/0
ip ad 23.1.1.2 24 
int loop 0 
ip ad 2.2.2.2 32
q
ospf 1 router 2.2.2.2 
a 0
network 2.2.2.2 0.0.0.0
network 23.1.1.2 0.0.0.0


R3
mpls lsr-id 3.3.3.3
mpls
mpls ldp
int g0/0/2
mpls
mpls ldp

int loo 0 
ip ad 3.3.3.3 32
isis 1 
is-level level-2
network-entity 49.0123.0000.0000.0003.00
int loo 0
isis enable
int g0/0/2
isis enable 1


ip vpn-instance 13
route-distinguisher 1:1
q
vpn-target 12:1 export-extcommunity
vpn-target 1:12 import-extcommunity
q
ip vpn-instance 23
route-distinguisher 2:2
q
vpn-target 12:1 export-extcommunity
vpn-target 1:12 import-extcommunity
q
int g0/0/0
ip binding vpn-instance 13
ip ad 13.1.1.3 24
int g0/0/1
ip binding vpn-instance 23
ip ad 23.1.1.3 24

bgp 500
router-id 3.3.3.3
undo default ipv4-unicast
peer 5.5.5.5 as-number 500
peer 5.5.5.5 connect-interface loopback 0
ipv4-family vpnv4
peer 5.5.5.5 enable


用vpn实例建立ospf邻居
ospf 1 router 3.1.1.1 vpn-instance 13
a 0
network 13.1.1.3 0.0.0.0
network 3.3.3.3 0.0.0.0
q
ospf 2 router 3.2.2.2 vpn-instance 23
a 0
network 23.1.1.3 0.0.0.0
network 3.3.3.3 0.0.0.0



R4

mpls lsr-id 4.4.4.4
mpls
mpls ldp
int g0/0/0
mpls
mpls ldp
int g0/0/1
mpls
mpls ldp

int loo 0 
ip ad 4.4.4.4 32
isis 1 
is-level level-2
network-entity 49.0123.0000.0000.0004.00
int loo 0
isis enable
int g0/0/0
isis enable 1
int g0/0/1
isis enable 1


R5

mpls lsr-id 5.5.5.5
mpls
mpls ldp
int g0/0/0
mpls
mpls ldp


bgp 500
router-id 5.5.5.5
undo default ipv4-unicast
peer 3.3.3.3 as-number 500
peer 3.3.3.3 connect-interface loopback 0
ipv4-family vpnv4
peer 3.3.3.3 enable

int loo 0 
ip ad 5.5.5.5 32
isis 1 
is-level level-2
network-entity 49.0123.0000.0000.0005.00
int loo 0
isis enable
int g0/0/0
isis enable 1


建立vpv4邻居
ip vpn-instance in
router-distinguisher 3:3
q
vpn-target 12:1 import-extcommunity
q

ip vpn-instance out
route-distinguisher 4:4
q
vpn-target 1:12 export-extcommunity

q
int g0/0/1.10
dot1q termination vid 10
arp broadcast enable
ip binding vpn-instance in
ip ad 192.168.10.5 24

int g0/0/1.20
dot1q termination vid 20
arp broadcast enable
ip binding vpn-instance out
ip ad 192.168.20.5 24


R6
int g0/0/0.10
dot1q termination vid 10
ip ad 192.168.10.6 24
arp broadcast enable

int g0/0/0.20
dot1q termination vid 20
ip ad 192.168.20.6 24
arp broadcast enable

启用ospf跟实例连接
ospf 1 router 5.1.1.1 vpn-instance in
a 0
network 192.168.10.5 0.0.0.0
network 5.5.5.5 0.0.0.0

ospf 2 router 5.2.2.2 vpn-instance out
a 0
network 192.168.20.5 0.0.0.0
network 5.5.5.5 0.0.0.0


最后R3和R5做引入bgp和ospf
R3
ospf 1
import-route bgp
ospf 2
import-route  bgp

bgp 500
ipv4-family vpn-instance 13
import-route ospf 1
q
ipv4-family vpn-instance 23
import-route ospf 2

R5
ospf 1
import-route bgp
ospf 2
import-route  bgp

bgp 500
ipv4-family vpn-instance in
import-route ospf 1
q
ipv4-family vpn-instance out
import-route ospf 2
### HUB-SPOKE网络架构定义及原理 #### 定义 HUB-SPOKE(星型拓扑)是一种常见的广域网(WAN)设计模式,在这种模式下,所有的分支办公室(Spoke站点)都连接到一个中央位置(Hub),而这些Spoke之间通常不直接相连。这样的布局简化了管理和维护工作,并且可以更有效地控制流量流向。 #### 原理 在网络通信方面,数据包从任何一个Spoke发送出去时会先到达Hub节点再转发给目标目的地。这种方式有助于集中管理网络安全策略和服务质量(QoS)[^1]。具体来说: - **中心化管理**:由于所有外部访问请求都要经过Hub来进行处理,因此可以在该处统一设置防火墙规则、入侵检测系统(IDS)/预防系统(IPS)以及其他安全措施。 - **优化资源利用**:对于某些应用而言,比如视频会议或大型文件传输,可以通过在Hub上部署缓存服务器减少重复下载次数从而节省带宽成本。 - **易于扩展**:当新增加一个远程办公地点作为新的Spoke加入现有体系内时只需建立一条通往Hub之间的链路即可完成整个接入流程而不必考虑与其他各个已存在的Spokes间的互连情况[^3]。 为了确保不同地理位置间稳定高效的互联互通,往往还会采用诸如边界网关协议(BGP)等高级路由技术来实现最优路径选择并解决可能遇到的路由循环问题[^5];与此同时,针对特定需求也可以引入自动发现机制(IPsec Auto-discovery)以便于动态调整加密隧道端点之间的关联关系以适应不断变化的企业环境[^4]。 ```python # Python伪代码展示如何模拟简单Hub-Spoke模型中的消息传递逻辑 class NetworkNode: def __init__(self, name): self.name = name def send_message(sender: str, receiver: str, message_content: str): print(f"{sender} sends '{message_content}' to {receiver}") hub_node = "Hub" spoke_nodes = ["Spoke1", "Spoke2"] for spoke in spoke_nodes: send_message(spoke, hub_node, f"Data request from {spoke}") send_message(hub_node, "Internet", "Forwarded data requests") ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值