
H3C路由器与防火墙建立IPSEC
需要与路由器一端配置一致。需要与路由器一端配置一致。
一.拓扑结构
二.需求
#在R1和FW1之间建立一个IPsec隧道,对Host A所在的子网(192.168.1.0/24)与Host B所在的子网(172.16.1.0/24)之间的数据流进行安全保护。
#· R1和FW1之间采用IKE协商方式建立IPsec SA。
#· 使用缺省的IKE提议。
#· 使用缺省的预共享密钥认证方法。
三.配置实例
R1配置
1.配置各接口IP
sys
#
interface LoopBack0
ip address 192.168.1.1 255.255.255.255
#
interface GigabitEthernet0/0/0
port link-mode route
combo enable copper
ip address 100.1.1.1 255.255.255.0
2.配置IPv4高级ACL 3101,定义要保护由子网192.168.1.0 /24去子网172.16.1.0/24的数据流。
acl advanced 3101
rule 5 permit ip source 192.168.1.0 0.0.0.255 destination 172.16.1.0 0.0.0.255
3.1创建IPsec安全提议tran1。
3.2配置安全协议对IP报文的封装形式为隧道模式。
3.3配置采用的安全协议为ESP。
3.4配置ESP协议采用的加密算法为128比特的AES,认证算法为HMAC-SHA1。
ipsec transform-set tran1
esp encryption-algorithm aes-cbc-128
esp authentication-algorithm sha1
4.1创建IKE keychain,名称为keychain1。
4.2 配置与IP地址为200.1.1.2的对端使用的预共享密钥为明文h3c123
ike keychain keychain1
pre-shared-key address 200.1.1.2 255.255.255.0 key cipher h3c123
5.1创建IKE profile,名称为profile1。
5.2指定引用的IKE keychain为keychain1。
5.3配置本端的身份信息为IP地址100.1.1.1。
5.4配置匹配对端身份的规则为IP地址200.1.1.2/24。
ike profile profile1
keychain keychain1
local-identity address 100.1.1.1
match remote identity address 200.1.1.2 255.255.255.0
6.1创建一条IKE协商方式的IPsec安全策略,名称为map1,顺序号为10。
6.2配置IPsec隧道的对端IP地址为200.1.1.2。
6.3指定引用ACL 3101。
6.4指定引用的安全提议为tran1。
6.5指定引用的IKE profile为profile1。
ipsec policy map1 10 isakmp
transform-set tran1
security acl 3101
remote-address 200.1.1.2
ike-profile profile1
7.1在接口GigabitEthernet0/0/0上应用IPsec安全策略map1。
7.2配置到Host B所在子网的静态路由。100.1.1.2为本例中的直连下一跳地址,实际使用中请以具体组网情况为准。
interface GigabitEthernet0/0/0
ipsec apply policy map1
ip route-static 0.0.0.0 0 100.1.1.2
FW1配置
1. 配置接口IP地址
interface GigabitEthernet1/0/0
port link-mode route
combo enable copper
ip address 200.1.1.2 255.255.255.0
2.配置路由
ip route-static 0.0.0.0 0 200.1.1.1
3. 配置接口加入安全域
security-zone name Untrust
import interface GigabitEthernet1/0/0
#
security-zone name Trust
import interface LoopBack0
4.配置安全策略
#放通防火墙本端去访问对端路由器的公网接口
security-policy ip
rule 0 name ipseclocalout
action pass
source-zone local
destination-zone untrust
source-ip-host 200.1.1.2
destination-ip-host 100.1.1.1
#放通对端路由器的公网地址和隧道地址访问本端的公网地址和隧道地址
rule 1 name ipseclocalin
action pass
source-zone untrust
destination-zone local
source-ip-host 100.1.1.1
source-ip-subnet 192.168.1.0 255.255.255.0
destination-ip-host 200.1.1.2
destination-ip-subnet 172.16.1.0 255.255.255.0
#放通本端隧道地址访问对端隧道地址
rule 2 name trust-untrust
action pass
source-zone trust
source-zone local
destination-zone untrust
source-ip-subnet 172.16.1.0 255.255.255.0
destination-ip-subnet 192.168.1.0 255.255.255.0
#放通对端隧道地址访问本端隧道地址
rule 3 name untrust-trust
action pass
source-zone untrust
destination-zone trust
source-ip-subnet 192.168.1.0 255.255.255.0
destination-ip-subnet 172.16.1.0 255.255.255.0
5.定义需要保护的数据流
acl advanced 3101
rule 0 permit ip source 172.16.1.0 0.0.0.255 destination 192.168.1.0 0.0.0.255
6.配置IPsec安全提议,协商封装报文使用的各种安全协议。需要与路由器一端配置一致
ipsec transform-set tran1
esp encryption-algorithm aes-cbc-128
esp authentication-algorithm sha1
7.配置IKE keychain,约定通信双方使用的密钥信息。需要与路由器一端配置一致
ike keychain keychain1
pre-shared-key address 100.1.1.1 255.255.255.0 key cipher h3c123
8.配置IKE profile,约定建立IKE SA所需的安全参数
ike profile profile1
keychain keychain1
local-identity address 200.1.1.2
match remote identity address 100.1.1.1 255.255.255.0
9.配置IPsec安全策略,建立IPsec隧道,保护需要防护的数据流
ipsec policy map1 10 isakmp
transform-set tran1
security acl 3101
local-address 200.1.1.2
remote-address 100.1.1.1
ike-profile profile1
10.在接口上应用IPsec安全策略,对接口上的流量进行保护
interface GigabitEthernet1/0/0
ipsec apply policy map1
四.测试结果
更多推荐
所有评论(0)