实验拓扑
实验需求
1.按着拓扑地址给设备部署 IP
2.在点对点部署、两端设备公网 IP 地址固定的场景下,掌握通过 IKE 协商方式建立 IPSec隧道的配置方法。
3.采用静态路由通信
4.配置 ACL
(1) 在 R1 上配置 ACL3000,定义由子网 192.168.1.0/24 去子网 172.16.1.0/24 的数据流。
(2) 在 R3 上配置 ACL3000,定义由子网 172.16.1.0/24 去子网 192.168.1.0/24 的数据流。
5.在 R1、R3 上配置 IPSec 安全提议。名字为 tran1,esp 算法为 aes-128,认证算法为sha2-256。
6.配置 IKE 安全提议
(1)配置 IKE 安全提议序号为 5,算法为 aes-cbc-128。
(2)配置预共享密钥为 FUNNET
(3)配置 IKE 对等体
7.在 R1、R3 上配置 IKE 动态协商方式安全策略,在接口上引用安全策略组。
(1)安全策略名字为:map1,策略序号为 10,创建 ISAKMP 方式 IPSec 安全策略
配置思路及其验证
(1)按照IP详情表配置IP地址
(2)采用静态路由通信
#R1
[R1] ip route-static 23.0.0.0 255.255.255.0 12.0.0.2
//配置一条目的地址是网络 A 外网出口的静态路由
[R1] ip route-static 172.16.1.0 255.255.255.0 12.0.0.2
//配置到达网络 B 的静态路由,对通过隧道传输的加密数据报文进行引流
#R3
[R3] ip route-static 12.0.0.0 255.255.255.0 23.0.0.2
[R3] ip route-static 192.168.1.0 255.255.255.0 23.0.0.2
(3)实现需求 4:配置 ACL
1) 在 R1 上配置 ACL3000,定义由子网 192.168.1.0/24 去子网 172.16.1.0/24 的数据流。
2) 在 R3 上配置 ACL3000,定义由子网 172.16.1.0/24 去子网 192.168.1.0/24 的数据流。
#R1
[R1] acl advanced 3000
[R1-acl-ipv4-adv-3000] rule 5 permit ip source 192.168.1.0 0.0.0.255 destination 172.16.1.0
0.0.0.255
#R3
[R3] acl advanced 3000
[R3-acl-ipv4-adv-3000] rule 5 permit ip source 172.16.1.0 0.0.0.255 destination 192.168.1.0
0.0.0.255
(4)实现需求 6:配置 IKE 参数
(1)配置 IKE 安全提议序号为 5,算法为 aes-cbc-128。
(2)配置预共享密钥为 FUNNET
(3)配置 IKE 对等体
#R1
[R1] ike proposal 5
[R1-ike-proposal-5]authentication-method pre-share//身份验证方法采用预共享密钥
[R1-ike-proposal-5]dh group2 //采用非对称算法 DH 组交换 key
[R1-ike-proposal-5]encryption-algorithm aes-cbc-128 //加密算法 aes-cbc-128
[R1-ike-proposal-5]authentication-algorithm sha //验证算法 sha
[R1] ike keychain k //配置预共享密钥为 FUNNET
[R1-ike-keychain-k] pre-shared-key address 23.0.0.3 key simple FUNNET
[R1] ike profile 1 //配置 IKE 配置文件
[R1-ike-profile-1] local-identity address 12.0.0.1
[R1-ike-profile-1] match remote identity address 23.0.0.3
[R1-ike-profile-1] proposal 5
[R1-ike-profile-1] keychain k
#R3
[R3] ike proposal 5
[R3-ike-proposal-5] authentication-method pre-share
[R3-ike-proposal-5] dh group2
[R3-ike-proposal-5] encryption-algorithm aes-cbc-128
[R3-ike-proposal-5] authentication-algorithm sha
[R3] ike keychain k
[R3-ike-keychain-k] pre-shared-key address 12.0.0.1 key simple FUNNET
[R3] ike profile 1
[R3-ike-profile-1] local-identity address 23.0.0.3
[R3-ike-profile-1] match remote identity address 12.0.0.1
[R3-ike-profile-1] proposal 5
[R3-ike-profile-1] keychain k
(5)在 R1、R3 上配置 IPSec 安全提议。名字为 tran1,esp 算法为 aes-128,认证算法为sha2-256。
#R1
[R1] ipsec transform-set tran1 //创建 IPSec 安全提议 tran1
[R1-ipsec-transform-set-tran1] encapsulation-mode tunnel //封装模式为隧道模式
[R1-ipsec-transform-set-tran1] protocol esp //安全协议为 ESP
[R1-ipsec-transform-set-tran1] esp authentication-algorithm sha256 //认证算法
[R1-ipsec-transform-set-tran1] esp encryption-algorithm aes-cbc-128 //加密算法 #R3
[R3] ipsec transform-set tran1
[R3-ipsec-transform-set-tran1] encapsulation-mode tunnel
[R3-ipsec-transform-set-tran1] protocol esp
[R3-ipsec-transform-set-tran1] esp authentication-algorithm sha256
[R3-ipsec-transform-set-tran1] esp encryption-algorithm aes-cbc-128
(6)7.在 R1、R3 上配置 IKE 动态协商方式安全策略,在接口上引用安全策略组。
(1)安全策略名字为:map1,策略序号为 10,创建 ISAKMP 方式 IPSec 安全策略
#R1
[R1] ipsec policy map1 10 isakmp //创建一条 IKE 协商方式的 IPSec 安全策略
[R1-ipsec-policy-isakmp-map1-10] local-address 12.0.0.1 //本段 IP
[R1-ipsec-policy-isakmp-map1-10] remote-address 23.0.0.3 //对端 IP
[R1-ipsec-policy-isakmp-map1-10] security acl 3000 //指定引用 ACL3000
[R1-ipsec-policy-isakmp-map1-10] ike-profile 1 //指定引用 IKE profile 1
[R1-ipsec-policy-isakmp-map1-10] transform-set tran1 //指定引用安全提议 tran1
[R1] interface GigabitEthernet0/0 //接口上应用安全策略
[R1-GigabitEthernet0/0] ipsec apply policy map1
#R3
[R3] ipsec policy map1 10 isakmp
[R3-ipsec-policy-isakmp-map1-10] local-address 23.0.0.3
[R3-ipsec-policy-isakmp-map1-10] remote-address 12.0.0.1
[R3-ipsec-policy-isakmp-map1-10] security acl 3000
[R3-ipsec-policy-isakmp-map1-10] ike-profile 1
[R3-ipsec-policy-isakmp-map1-10] transform-set tran1
[R3] interface GigabitEthernet0/0
[R3-GigabitEthernet0/0] ipsec apply policy map1