IPSec××× 实验

 

实验目的:通过IPsec××× 使总公司与分公司的PC可以互相PING通。

使用技术点:IPsec×××

 

CISCO IPSec××× 实验_ipsec

地址规划:

总公司路由F0/0 ß--------------àInter路由F0/0

61.148.91.174/24              61.148.91.173/24

总公司路由F0/1ß--------------à总公司PC

192.168.1.1/24                192.168.1.2/24

分公司路由F0/0ß--------------àInter路由F0/1

1.202.136.163/24              1.202.136.162/24

分公司路由F0/1ß--------------à分公司PC

10.21.0.1/24                  10.21.0.2/24

 

 

第一部我们先配置路由接口的IPPC机器的IP

 

总公司路由

Router>en

Router#conf t

Router(config)#hostname ZGSRoute

ZGSRoute(config)#interface fastEthernet 0/0      //进入F0/0接口

ZGSRoute(config-if)#ip address 61.148.91.174 255.255.255.0   //给接口配置IP与子网掩码

ZGSRoute(config-if)#no sh                         //启动接口

ZGSRoute(config-if)#exit

ZGSRoute(config)#interface fastEthernet 0/1

ZGSRoute(config-if)#ip address 192.168.1.1 255.255.255.0

ZGSRoute(config-if)#no sh

ZGSRoute(config-if)#exit

ZGSRoute(config)#ip route 0.0.0.0 0.0.0.0 61.148.91.173   //配置默认路由表(61.148.91.173为下一跳地址)

 

总公司计算机IP配置由于简单也就不介绍了。

 

分公司路由

Router>en

Router#conf t

Router(config)#hostname FGSRoute

FGSRoute(config)#interface fastEthernet 0/0      //进入F0/0接口

FGSRoute(config-if)#ip address 1.202.136.163 255.255.255.0   //给接口配置IP与子网掩码

FGSRoute(config-if)#no sh                         //启动接口

FGSRoute(config-if)#exit

FGSRoute(config)#interface fastEthernet 0/1

FGSRoute(config-if)#ip address 10.21.0.1 255.255.255.0

FGSRoute(config-if)#no sh

FGSRoute(config-if)#exit

ZGSRoute(config)#ip route 0.0.0.0 0.0.0.0 1.202.136.162   //配置默认路由表(1.202.136.162为下一跳地址)

 

 

分公司计算机IP配置由于简单也就不介绍了。

 

 

Inter路由

Router>en

Router#conf t

Router(config)#hostname InterRoute

InterRoute(config)#interface fastEthernet 0/0

InterRoute(config-if)#ip address 61.148.91.173 255.255.255.0

InterRoute(config-if)#no sh

InterRoute(config-if)#exit

InterRoute(config)#interface fastEthernet 0/1

InterRoute(config-if)#ip address 1.202.136.162 255.255.255.0

InterRoute(config-if)#no sh

 

 

到此我们

总公司PC 与总公司路由,

分公司PC与分公司路由,

总公司路由与Inter路由,

分公司路由与Inter路由,

已经可以互相PING通了。

 

 

下面开始配置×××了,大家注意了哦。

 

总公司路由

 

启用IKE协商

ZGSRoute(config)#crypto isakmp policy 10

//建立IKE协商策略(10是策略编号 越小优先级越高(1-1000)。)

ZGSRoute(config-isakmp)#hash md5

//认证密钥的算法为MD5

ZGSRoute(config-isakmp)#authentication pre-share

//告知路由器使用预先共享的密钥

ZGSRoute(config-isakmp)#exit

ZGSRoute(config)#crypto isakmp key 123456 address 1.202.136.163

//用思科TP模拟器为上边的写法。如果用GNS3 在密码前面要加个参数 0为密码明文 6为密码加密。

//123456为预先共享密钥对端也要如此配置,1.202.136.163为对端路由器地址。

 

 

配置IPSec参数

ZGSRoute(config)#crypto ipsec transform-set ipsecvpn ah-md5-hmac esp-des

//ipsecvpn传输模式的名称(可以任意改变)。ah-md5-hamc esp-des表示传输模式中采用的验证和加密算法

ZGSRoute(config)#access-list 101 permit ip 192.168.1.0 0.0.0.255 10.21.0.0 0.0.0.255

//访问控制列表。192.168.1.0 10.21.0.0 允许通过(下面会使用到)

 

 

设置crypto map (目的是把IKE的协商信息和IPesc的参数整合到一起并一个名字)

ZGSRoute(config)#crypto map vpnmap 1 ipsec-isakmp

//vpnmap:crypto map起的名字。1:优先级。ipsec-isakmp:表示此IPSec链接采用IKE自动协商

ZGSRoute(config-crypto-map)#set peer 1.202.136.163

//指定此×××链路对端地址

ZGSRoute(config-crypto-map)#set transform-set ipsecvpn

//把刚才配的IPSec参数整合进来 ipsecvpn:IPSec传输模式的名字,上面配置了

ZGSRoute(config-crypto-map)#match address 101

//匹配IP地址,101为刚才编写的访问控制列表。匹配内容为访问列表内的IP

 

 

crypto map应用到端口

ZGSRoute(config)#interface fastEthernet 0/0  //进入 F0/0端口

ZGSRoute(config-if)#crypto map vpnmap  //crypto map绑定到端口(vpnmap为刚才给crypto map起的名字)

 

 

分公司路由配置

启用IKE协商

ZGSRoute(config)#crypto isakmp policy 10

//建立IKE协商策略(10是策略编号 越小优先级越高(1-1000)。)

ZGSRoute(config-isakmp)#hash md5

//认证密钥的算法为MD5

ZGSRoute(config-isakmp)#authentication pre-share

//告知路由器使用预先共享的密钥

ZGSRoute(config-isakmp)#exit

ZGSRoute(config)#crypto isakmp key 123456 address 61.148.91.174

//123456为预先共享密钥对端也要如此配置,1.202.136.163为对端路由器地址。

 

 

配置IPSec参数

ZGSRoute(config)#crypto ipsec transform-set ipsecvpn ah-md5-hmac esp-des

//ipsecvpn传输模式的名称(可以任意改变)。ah-md5-hamc esp-des表示传输模式中采用的验证和加密算法

ZGSRoute(config)#access-list 101 permit ip 10.21.0.0 0.0.0.255 192.168.1.0 0.0.0.255

//访问控制列表。10.21.0.0段到192.168.1.0段允许通过(下面会使用到)

 

 

设置crypto map (目的是把IKE的协商信息和IPesc的参数整合到一起并一个名字)

ZGSRoute(config)#crypto map vpnmap 1 ipsec-isakmp

//vpnmap:crypto map起的名字。1:优先级。ipsec-isakmp:表示此IPSec链接采用IKE自动协商

ZGSRoute(config-crypto-map)#set peer 61.148.91.174

//指定此×××链路对端地址

ZGSRoute(config-crypto-map)#set transform-set ipsecvpn

//把刚才配的IPSec参数整合进来 ipsecvpn:IPSec传输模式的名字,上面配置了

ZGSRoute(config-crypto-map)#match address 101

//匹配IP地址,101为刚才编写的访问控制列表。匹配内容为访问列表内的IP

 

 

crypto map应用到端口

ZGSRoute(config)#interface fastEthernet 0/0  //进入 F0/0端口

ZGSRoute(config-if)#crypto map vpnmap  //crypto map绑定到端口(vpnmap为刚才给crypto map起的名字)

 

 

 

到此配置已经完成了!!!!不过想要总公司PC PING 分公司PC 需要等待一会。1-3分钟吧。为什么啊。应为2台路由器建立×××连接需要协商的缘故,需要一会。过一会就可以PING通了。如果几分钟过去了。还是不通。那就要看看你写的配置对不对了哦。