写点什么

一个关于 SDWAN 单臂部署方案验证的实验

  • 2022 年 5 月 26 日
  • 本文字数:2185 字

    阅读完需:约 7 分钟

作者:天翼云蒋露

 

假设有这样一张网络,其中 RTA 和 PCA 表示某公司的 A 分支,通过中国电信 CT 路由器接入互联网 ISP;RTB 和 PCB 表示某公司的 B 分支,通过中国联通 CU 路由器接入互联网 ISP。DNS(8.8.8.8)表示某互联网应用。



为实现 A 分支私网 192.168.2.0/24 和 B 分支私网 192.168.3.0/24 的互通,现计划使用某厂商的 SD-WAN 方案进打通两个内网,像下图这样简单变更一下网络。图中 POP 为某厂商 SD-WAN 方案用户接入点设备,分支侧通过接入 CPE 设备进行互通。为不改变现有网络结构,将 CPE 设备旁挂在分支的出口设备上,需要能够同时访问到内网和互联网即可,由 CPE 设备和 POP 设备建立隧道,进而实现内网互通。



这种架构的SD-WAN方案是目前实现比较简单的方案,对设备整体要求不高,只要支持 IPsec 即可,所以本案例主要也是通过 IPsec 来实现的。而且分支机构不需要具备公网 IP 地址,只要能访问互联网即可。



接下来就简单了,可以说是单纯的 IPsec 的配置。

POP

创建 IKE keychain,并配置与两个 CPE 使用的预共享密钥为明文的 qwe123。

#

ike keychain key1

 pre-shared-key hostname cpe1 key simple qwe123

 pre-shared-key hostname cpe2 key simple qwe123

创建 IKE profile,指定密钥为 key1,配置 IKE 第一阶段协商使用野蛮模式。指定使用 IP 地址(24.1.1.4)标识本端身份,指定需要匹配对端身份类型为名称 cpe1 和 cpe2。

#

ike profile pro1

 keychain key1

 exchange-mode aggressive

 local-identity address 24.1.1.4

 match remote identity fqdn cpe1

 match remote identity fqdn cpe2

创建 IPsec 安全提议,ESP 加密算法为 aes-cbc-128,ESP 认证算法为 sha1。

#

ipsec transform-set tran1

 esp encryption-algorithm aes-cbc-128

 esp authentication-algorithm sha1

配置 IPsec 安全框架,通过 IKE 协商建立安全联盟。

#

ipsec profile sdwan isakmp

 transform-set tran1

 ike-profile pro1

创建模式为 psec-p2mp 的隧道接口 Tunnel1,配置 WAN 口地址为接口的源端地址,并配置 Tunnel1 接口的 IP 地址。最后在 IPsec 隧道接口上应用 IPsec 安全框架 sdwan。

#

interface Tunnel1 mode ipsec-p2mp

 ip address 11.1.1.1 255.255.255.0

 source 24.1.1.4

 tunnel protection ipsec profile sdwan

添加 A 分支到 B 分支的静态路由。

#

ip route-static 192.168.2.0 24 Tunnel1 11.1.1.2

ip route-static 192.168.3.0 24 Tunnel1 11.1.1.3

CPE1

创建 IKE keychain,并配置与 POP(地址为 24.1.1.4)的对端使用的预共享密钥为明文的 qwe123。

#

ike keychain key1

 pre-shared-key address 24.1.1.4 255.255.255.0 key simple qwe123

创建 IKE profile,指定密钥为 key1,配置 IKE 第一阶段协商使用野蛮模式,指定使用名称 cpe1 标识本端身份。指定需要匹配对端身份类型为 IP 地址,取值为 24.1.1.4。

#

ike profile pro1

 keychain key1

 exchange-mode aggressive

 local-identity fqdn cpe1

 match remote identity address 24.1.1.4 255.255.255.0

创建 IPsec 安全提议,ESP 加密算法为 aes-cbc-128,ESP 认证算法为 sha1。

#

ipsec transform-set tran1

 esp encryption-algorithm aes-cbc-128

 esp authentication-algorithm sha1

配置 IPsec 安全框架,通过 IKE 协商建立安全联盟。

#

ipsec profile sdwan isakmp

 transform-set tran1

 ike-profile pro1

创建模式为 IPsec 的隧道接口 Tunnel1,配置 WAN 口地址为接口的源端地址,配置 POP 地址为接口的目的端地址,并配置 Tunnel1 接口的 IP 地址。最后在 IPsec 隧道接口上应用 IPsec 安全框架 sdwan。

#

interface Tunnel1 mode ipsec

 ip address 11.1.1.2 255.255.255.0

 source GigabitEthernet2/0

 destination 24.1.1.4

 tunnel protection ipsec profile sdwan

配置 A 分支到 B 分支的静态路由。

#

ip route-static 192.168.3.0 24 Tunnel1

ip route-static 4.4.4.0 24 Tunnel1

CPE2

配置同 CPE1,不再赘述,直接上配置。

#

ike keychain key1

 pre-shared-key address 24.1.1.4 255.255.255.0 key simple qwe123

#

ike profile pro1

 keychain key1

 exchange-mode aggressive

 local-identity fqdn cpe2

 match remote identity address 24.1.1.4 255.255.255.0

#

ipsec transform-set tran1

 esp encryption-algorithm aes-cbc-128

 esp authentication-algorithm sha1

#

ipsec profile sdwan isakmp

 transform-set tran1

 ike-profile pro1

#

interface Tunnel1 mode ipsec

 ip address 22.1.1.2 255.255.255.0

 source GigabitEthernet2/0

 destination 24.1.1.4

 tunnel protection ipsec profile sdwan

#

ip route-static 192.168.2.0 24 Tunnel1

ip route-static 4.4.4.0 24 Tunnel1

接下来只要在路由器 RTA 和 RTB 上将去往对端私网流量的下一跳指向 CPE 就可以了。

RTA

#

ip route-static 192.168.3.0 24 192.168.2.10

RTB

#

ip route-static 192.168.2.0 24 192.168.3.10

验证配置

从 PCA 上测试访问 PCB 的情况。



可以看到,访问正常,并且通过 tracert 查看转发路径,流量是先到网关,再到 CPE1,再到 POP,再到 CPE2,最后到达目标主机 PCB。

而且,此时是不影响访问互联网的,在私网互通的同时可以正常访问模拟的公网业务。



查看隧道接口状态。



查看当前 IKE SA 的信息。



查看当前 IPsec SA 的信息。



可以看到 POP 上隧道对端的地址是分支的出口公网 IP 地址,而流量是全 0 的,也就是说,任何流量转发过来都会封装 IPsec,这就是 IPsec 隧道的魅力所在。

如果要增加流量,只需要两端内网对应的增加路由就可以了。


发布于: 刚刚阅读数: 4
用户头像

还未添加个人签名 2022.02.22 加入

天翼云是中国电信倾力打造的云服务品牌,致力于成为领先的云计算服务提供商。提供云主机、CDN、云电脑、大数据及AI等全线产品和场景化解决方案。

评论

发布
暂无评论
一个关于SDWAN单臂部署方案验证的实验_天翼云开发者社区_InfoQ写作社区