準(zhǔn)備工作
主模式配置示例
配置 IP 地址部分
外網(wǎng)要全部互通(本路由器外部接口能ping通隧道對端路由器接口)
1决记、在 R1 上創(chuàng)建感興趣流舵变,匹配兩端私網(wǎng)地址網(wǎng)段
[R1]acl advanced 3000
[R1-acl-ipv4-adv-3000]rule per ip source 192.168.1.0 0.0.0.255 destination 192.168.2.0 0.0.0.255
2、在 R1 上創(chuàng)建 IKE 提議,配置驗證模式為預(yù)共享密鑰赞枕,并配置加密算法
[R1]ike proposal 1
[R1-ike-proposal-1]authentication-method pre-share
[R1-ike-proposal-1]encryption-algorithm aes-cbc-128
3刻获、在 R1 上創(chuàng)建預(yù)共享密鑰
[R1]ike keychain r3
[R1-ike-keychain-r3]pre-shared-key address 100.2.2.3 key simple 123456
4:在 R1 上創(chuàng)建 IKE Profile,指定本端和對端公網(wǎng)地址只祠,并調(diào)用預(yù)共享密鑰和 IKE 提議
[R1]ike profile r3
[R1-ike-profile-r3]keychain r3
[R1-ike-profile-r3]local-identity address 100.1.1.1
[R1-ike-profile-r3]match remote identity address 100.2.2.3
[R1-ike-profile-r3]proposal 1
5:在 R1 上創(chuàng)建IPsec 轉(zhuǎn)換集兜蠕,配置加密和驗證算法。由于工作模式默認是隧道模式抛寝,且協(xié)議默認使用 ESP熊杨,所以無需配置
[R1]ipsec transform-set r3
[R1-ipsec-transform-set-r3]esp authentication-algorithm sha1
[R1-ipsec-transform-set-r3]esp encryption-algorithm aes-cbc-128
6:在 R1 上創(chuàng)建 IPsec 策略,調(diào)用上述配置
[R1]ipsec policy r3 1 isakmp
[R1-ipsec-policy-isakmp-r3-1]security acl 3000
[R1-ipsec-policy-isakmp-r3-1]ike-profile r3
[R1-ipsec-policy-isakmp-r3-1]transform-set r3
[R1-ipsec-policy-isakmp-r3-1]remote-address 100.2.2.3
7:在 R1 的公網(wǎng)接口上下發(fā) IPsec 策略
[R1-GigabitEthernet0/0]ipsec apply policy r3
8:在 R3 上完成 IPsec 相關(guān)配置墩剖,方法和命令與 R1 一致猴凹,本端和對端地址對調(diào)即可