作者:天翼云 蒋露
假如有这样一张网络,其中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隧道的魅力所在。
如果要减少流量,只须要两端内网对应的减少路由就能够了。