AR1为企业分支网关,AR2为企业总部网关,分支与总部通过公网建立通信。分支子网为10.0.10.0/24,总部子网为10.0.20.0/24。
企业希望对分支子网与总部子网之间相互访问的流量进行安全保护。分支与总部通过公网建立通信,可以在分支网关与总部网关之间建立一个IPSec隧道来实施安全保护。由于分支子网较为庞大,有大量需要IPSec保护的数据流,可基于虚拟隧道接口方式建立IPSec隧道,对Tunnel接口下的流量进行保护,不需使用ACL定义待保护的流量特征。
采用如下思路配置虚拟隧道接口方式建立IPSec隧道:
1.配置接口的IP地址和到对端的静态路由,保证两端公网路由可达。
2.配置IPSec安全提议,定义IPSec的保护方法。
3.配置IKE对等体,定义对等体间IKE协商时的属性。
4.配置安全框架,并引用安全提议和IKE对等体,确定对何种数据流采取何种保护方法。
5.在Tunnel接口上应用安全框架,使接口具有IPSec的保护功能。
6.配置Tunnel接口的转发路由,将需要IPSec保护的数据流引到Tunnel接口。
1 路由器基础配置
1 IP 地址配置
# R1
#
interface GigabitEthernet0/0/0
ip address 10.0.10.254 255.255.255.0
interface GigabitEthernet0/0/1
ip address 100.0.0.1 255.255.255.0
# R2
#
interface GigabitEthernet0/0/0
ip address 200.0.0.1 255.255.255.0
interface GigabitEthernet0/0/1
ip address 10.0.20.254 255.255.255.0
# internet
#
interface GigabitEthernet0/0/0
ip address 100.0.0.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 200.0.0.2 255.255.255.0
#
interface LoopBack0
ip address 100.100.100.100 255.255.255.255
路由
# R1
ip route-static 0.0.0.0 0.0.0.0 GigabitEthernet 0/0/1 100.0.0.2
# R2
ip route-static 0.0.0.0 0.0.0.0 GigabitEthernet 0/0/0 200.0.0.2
2 让内网PC1和PC2能够访问 ISP的loopback接口
# R1
acl number 3000
rule 5 permit ip source 10.0.10.0 0.0.0.255
#
# 让接口调用 ACL 3000 使指定的流量进行NAT转换
interface GigabitEthernet0/0/1
nat outbound 3000
# R2
acl number 3000
rule 5 permit ip source 10.0.20.0 0.0.0.255
#
interface GigabitEthernet0/0/0
nat outbound 3000
2 配置IPSEC 安全提议
# AR1和AR2
ipsec proposal tran1
esp authentication-algorithm sha2-256
esp encryption-algorithm aes-128
3 配置IKE对等体
# AR1
ike proposal 5
encryption-algorithm aes-cbc-128
dh group14
# AR1
ike peer zongbu v1
pre-shared-key cipher Huawei@123
ike-proposal 5
# AR2
ike proposal 5
encryption-algorithm aes-cbc-128
dh group14
# AR2
ike peer fenbu v1
pre-shared-key cipher Huawei@123
ike-proposal 5
4 在AR1和AR2上创建安全框架
# AR1
ipsec profile profile1
ike-peer zongbu
proposal tran1
# AR2
ipsec profile profile1
ike-peer fenbu
proposal tran1
5 配置tunnel接口,调用安全框架
# AR1
interface Tunnel0/0/0
ip address 192.168.1.1 255.255.255.0
tunnel-protocol ipsec
source 100.0.0.1
destination 200.0.0.1
ipsec profile profile1
# AR2
interface Tunnel0/0/0
ip address 192.168.1.2 255.255.255.0
tunnel-protocol ipsec
source 200.0.0.1
destination 100.0.0.1
ipsec profile profile1
6 配置Tunnel接口的转发路由,将需要IPSEC保护的流量引导到Tunnel接口上
# AR1
ip route-static 10.0.20.0 24 Tunnel 0/0/0
# AR2
ip route-static 10.0.10.0 24 Tunnel 0/0/0