实训目的
- 掌握IPSec VPN静态隧道配置。
实训背景
IPSec的相关概念
IPSec(IP Security)是一种由IETF设计的端到端的确保IP层通信安全的机制。IPSec协议可以为IP网络通信提供透明的安全服务,保护TCP/IP通信免遭窃听和篡改,保证数据的完整性和机密性,有效抵御网络攻击。IPSec不是一个单独的协议,而是一组协议,IPSec协议的定义文件包括了12个RFC文件和几十个Internet草案,已经成为工业标准的网络安全协议。
IPSec静态隧道工作原理
IPSec VPN分为两个协商阶段,ISAKMP阶段及IPSec阶段,ISAKMP阶段主要是协商两端的保护策略,验证对等体的合法性,产生加密密钥,保护第二阶段IPSec SA的协商。第二阶段IPSec阶段,主要是确定IPSec SA的保护策略,使用AH还是ESP、传输模式还是隧道模式、被保护的数据是什么等等。第二阶段协商的目标就是产生真正用于保护IP数据的IPSec SA。IPSec通信实体双方对于一、二阶段的这些安全策略必须达成一致,否则IPSec协商将无法通过。
实训拓扑
IPSec VPN静态隧道-聚星云学院实验所需设备:
设备类型 | 设备型号 | 数量 |
---|---|---|
路由器 | RSR20 | 2 |
主机 | Windows 10 | 2 |
实训步骤
步骤1:基本配置。
R1:
Ruijie>enable
Ruijie#configure terminal
Ruijie(config)#hostname R1
R1(config)#
R2:
Ruijie>enable
Ruijie#configure terminal
Ruijie(config)#hostname R2
R2(config)#
步骤2:全网基本IP地址配置。
R1(config)#interface fastEthernet 0/0
R1(config-if-FastEthernet 0/0)#ip address 192.168.3.1 255.255.255.0
R1(config-if-FastEthernet 0/0)#exit
R1(config)#interface fastEthernet 0/1
R1(config-if-FastEthernet 0/1)#ip address 192.168.1.1 255.255.255.0
R1(config-if-FastEthernet 0/1)#exit
R1(config)#
R2(config)#interface fastEthernet 0/0
R2(config-if-FastEthernet 0/0)#ip address 192.168.3.2 255.255.255.0
R2(config-if-FastEthernet 0/0)#exit
R2(config)#interface fastEthernet 0/1
R2(config-if-FastEthernet 0/1)#ip address 192.168.2.1 255.255.255.0
R2(config-if-FastEthernet 0/1)#exit
R2(config)#
PC1:
IPSec VPN静态隧道-聚星云学院PC2:
IPSec VPN静态隧道-聚星云学院步骤3:配置静态路由,使R1和R2能够相互访问。
R1(config)#ip route 192.168.2.0 255.255.255.0 192.168.3.2
R2(config)#ip route 192.168.1.0 255.255.255.0 192.168.3.1
步骤4:在R1上配置静态IPSec VPN隧道。
1.配置IPSec感兴趣流。
R1(config)#access-list 101 permit ip 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255
//指定感兴趣流为源IP段:192.168.1.0/24,目IP段: 192.168.2.0/24。
2.配置isakmp策略。
R1(config)#crypto isakmp keepalive 5 periodic//配置IPSec DPD探测功能。
R1(config)#crypto isakmp policy 1 //创建新的isakmp策略。
R1(isakmp-policy)#authentication pre-share//指定认证方式为预共享密码。
R1(isakmp-policy)#encryption 3des //指定使用3DES进行加密。
R1(isakmp-policy)#exit
R1(config)#
3.配置预共享密钥。
R1(config)#crypto isakmp key 0 juxing address 192.168.3.2
//指定peer 192.168.3.2的预共享密钥为"juxing",对端也必须配置一致的密钥。
4.配置IPSec加密转换集。
R1(config)#crypto ipsec transform-set myset esp-des esp-md5-hmac
//指定IPSec使用esp封装des加密、MD5检验。
R1(cfg-crypto-trans)#exit
5.配置IPSec加密图。
R1(config)#crypto map mymap 5 ipsec-isakmp //新建加密图mymap
R1(config-crypto-map)#set peer 192.168.3.2 //指定peer地址
R1(config-crypto-map)#set transform-set myset //指定转换集myset
R1(config-crypto-map)#match address 101 //指定感兴趣流为ACL 101
R1(config-crypto-map)#exit
R1(config)#
6.将加密图应用到接口。
R1(config)#interface fastEthernet 0/0
R1(config-if-FastEthernet 0/0)#crypto map mymap
R1(config-if-FastEthernet 0/0)#end
R1(config)#
步骤5:在R2上配置静态IPSec VPN隧道。
1.配置IPSec感兴趣流。
R2(config)#access-list 101 permit ip 192.168.2.0 0.0.0.255 192.168.1.0 0.0.0.255
2.配置isakmp策略。
R2(config)#crypto isakmp keepalive 5 periodic
R2(config)#crypto isakmp policy 1
R2(isakmp-policy)#authentication pre-share
R2(isakmp-policy)#encryption 3des
R2(isakmp-policy)#exit
R2(config)#
3.配置预共享密钥。
R2(config)#crypto isakmp key 0 juxing address 192.168.3.1
4.配置IPSec加密转换集。
R2(config)#crypto ipsec transform-set myset esp-des esp-md5-hmac
R2(cfg-crypto-trans)#exit
R2(config)#
5.配置IPSec加密图。
R2(config)#crypto map mymap 5 ipsec-isakmp
R2(config-crypto-map)#set peer 192.168.3.1
R2(config-crypto-map)#set transform-set myset
R2(config-crypto-map)#match address 101
R2(config-crypto-map)#exit
R2(config)#
6.将加密图应用到接口。
R2(config)#interface fastEthernet 0/0
R2(config-if-FastEthernet 0/0)#crypto map mymap
R2(config-if-FastEthernet 0/0)#end
R2(config)#
步骤6:PC1 Ping PC2。
IPSec VPN静态隧道-聚星云学院步骤7:在R1上查看isakmp sa和IPSec sa是否已经协商成功。
R1#show crypto isakmp sa
我们可以看到isakmp协商成功,状态为IKE_IDLE。
IPSec VPN静态隧道-聚星云学院R1#show crypto ipsec sa
IPSec VPN静态隧道-聚星云学院
网友评论