一、配置需求
企业总部和分支机构通过互联网连接,需要在总部路由器(Router1)和分支机构路由器(Router2)之间建立IPsec VPN ,实现两地内部网络(192.168.1.0/24和192.168.2.0/24)的安全通信。
二、配置思路
1. 配置接口IP地址:为路由器的外网接口和内网接口配置IP地址。
2. 配置IKE策略:定义IKE协商时使用的安全参数。
3. 配置IPsec策略:定义IPsec的安全参数和需要保护的数据流。
4. 应用IPsec策略:将IPsec策略应用到对应的接口上。
三、总部路由器(Router1)配置实例
1. 配置接口IP地址
sysname Router1
interface GigabitEthernet0/0/0
ip address 202.100.1.1 255.255.255.0 // 外网接口IP
quit
interface GigabitEthernet0/0/1
ip address 192.168.1.1 255.255.255.0 // 内网接口IP
quit
2. 配置IKE策略
ike proposal 10
authentication-method pre-share
encryption-algorithm aes
integrity-algorithm sha2-256
dh group2
quit
ike peer Branch
exchange-mode main
pre-shared-key cipher Huawei123
ike-proposal 10
remote-address 202.100.2.1 // 分支机构外网IP
quit
3. 配置IPsec策略
acl number 3000
rule 5 permit ip source 192.168.1.0 0.0.0.255 destination 192.168.2.0 0.0.0.255 // 定义需要保护的数据流
quit
ipsec proposal VPN
transform esp
esp authentication-algorithm sha2-256
esp encryption-algorithm aes
quit
ipsec policy VPN 10 isakmp
security acl 3000
ike-peer Branch
proposal VPN
quit
4. 应用IPsec策略
interface GigabitEthernet0/0/0
ipsec policy VPN
quit
四、分支机构路由器(Router2)配置实例
1. 配置接口IP地址
sysname Router2
interface GigabitEthernet0/0/0
ip address 202.100.2.1 255.255.255.0 // 外网接口IP
quit
interface GigabitEthernet0/0/1
ip address 192.168.2.1 255.255.255.0 // 内网接口IP
quit
2. 配置IKE策略
ike proposal 10
authentication-method pre-share
encryption-algorithm aes
integrity-algorithm sha2-256
dh group2
quit
ike peer Headquarter
exchange-mode main
pre-shared-key cipher Huawei123
ike-proposal 10
remote-address 202.100.1.1 // 总部外网IP
quit
3. 配置IPsec策略
acl number 3000
rule 5 permit ip source 192.168.2.0 0.0.0.255 destination 192.168.1.0 0.0.0.255 // 定义需要保护的数据流
quit
ipsec proposal VPN
transform esp
esp authentication-algorithm sha2-256
esp encryption-algorithm aes
quit
ipsec policy VPN 10 isakmp
security acl 3000
ike-peer Headquarter
proposal VPN
quit
4. 应用IPsec策略
interface GigabitEthernet0/0/0
ipsec policy VPN
quit
五、配置解说
1. 接口IP地址配置:为路由器的不同接口分配IP地址,确保路由器可以与内部网络和外部网络通信。
2. IKE策略配置:
- ike proposal:定义了IKE协商过程中使用的加密算法(如aes)、完整性验证算法(如sha2 - 256)、DH组(如group2)以及认证方法(预共享密钥)。
- ike peer:指定了对端的IP地址、预共享密钥和使用的IKE提议。
3. IPsec策略配置:
- acl:定义了需要通过IPsec VPN保护的数据流,这里是总部和分支机构内部网络之间的流量。
- ipsec proposal:定义了IPsec使用的封装模式(如esp)、加密和认证算法。
- ipsec policy:将ACL、IKE对等体和IPsec提议关联起来,形成一个完整的IPsec策略。
4. 应用IPsec策略:将配置好的IPsec策略应用到连接外网的接口上,使该接口对符合ACL定义的流量进行IPsec处理。
请注意,在实际配置中,需要根据你的网络拓扑、安全需求和运营商提供的网络环境等因素进行调整和优化。同时,VPN配置涉及到网络安全,要妥善保管预共享密钥等敏感信息 。