ipsec-vpn高可用性链路冗余备份实例标题:ipsec vpn的高可用性目的:实现vpn链路的冗余备份拓扑:步骤:1.按照拓扑给路由器的接口分配地址Ip地址规划Branch上branch(config)#int f0/0branch(config-if)#ip add 202.100.1.1 255.255.255.0branch(config-if)#no shbranch(config-if)#int lo 0branch(config-if)#ip add 1.1.1.1255.255.255.0isp上isp(config)#int f0/1isp(config-if)#ip add 202.100.1.10 255.255.255.0isp(config-if)#no shisp(config-if)#int f0/0isp(config-if)#ip add 61.128.1.10 255.255.255.0isp(config-if)#no shisp(config-if)#int f1/0isp(config-if)#ip add 137.78.5.10 255.255.255.0isp(config-if)#no shactive上active(config)#int f0/1active(config-if)#ip add 61.128.1.1 255.255.255.0active(config-if)#int f0/0active(config-if)#ip add 10.1.1.10 255.255.255.0active(config-if)#no shstandby上standby(config)#int f0/1standby(config-if)#ip add 137.78.5.1 255.255.255.0standby(config-if)#no shstandby(config-if)#int f0/0standby(config-if)#ip add 10.1.1.20 255.255.255.0standby(config-if)#no shinside上inside(config)#int f0/1inside(config-if)#ip add 10.1.1.1 255.255.255.0inside(config-if)#int lo 0inside(config-if)#ip add 2.2.2.2 255.255.255.0测试直连路由是否可达2.Center中运行动态路由企业内部网络都会运行一种动态路由协议,保障内网用户底层可达Active上active(config)#router ospf 1active(config-router)#network 10.1.1.00.0.0.255 area 0standby上standby(config)#router ospf 1standby(config-router)#network 10.1.1.0 0.0.0.255 area 0inside上inside(config)#router ospf 1inside(config-router)#network 10.1.1.0 0.0.0.255 area 0inside(config-router)#network 2.2.2.0 0.0.0.255 a 03.建立vpn企业网络的边界路由一般使用缺省路由指向互联网首先解决路由问题Branch上Active上Standby上测试连通性然后定义第一阶段的协商策略和认证定义协商策略和认证:认证方式为预共享密钥;配置预共享的key,vpn两端必须一致;为了实现vpn链路的冗余备份,因此需要分支指向中心不同的边界网关,预共享key可以相同,也可以不同Branch上branch(config)#crypto isakmp policy 10branch(config-isakmp)#authentication pre-sharebranch(config)#crypto isakmp key 0 cisco address 61.128.1.1branch(config)#crypto isakmp key 0 h3c address 137.78.5.1定义协商策略和认证:认证方式为预共享密钥;配置预共享的key,vpn两端必须一致active上active(config)#crypto isakmp policy 10active(config-isakmp)#authentication pre-shareactive(config)#crypto isakmp key 0 cisco address 202.100.1.1standby上standby(config)#crypto isakmp policy 10standby(config-isakmp)#authentication pre-sharestandby(config)#crypto isakmp key 0 h3c address 202.100.1.1在branch、active和standby上开启DPD开启DPD,即死亡邻居检测。
以周期性(每10秒)的发送keepalive 报文探测vpn链路或者vpn设备是否工作正常,以实现一个快速的切换定义第二阶段的加密策略定义加密策略:配置感兴趣流,配置转换集(des 加密,MD5认证,隧道模式)Branch上branch(config)#ip access-list extended vpnbranch(config-ext-nacl)#permit ip 1.1.1.00.0.0.255 2.2.2.0 0.0.0.255branch(config)#crypto ipsec transform-set trans esp-des esp-md5-hmacbranch(cfg-crypto-trans)#mode tunnel active上active(config)#ip access-list extended vpnactive(config-ext-nacl)#permit ip 2.2.2.00.0.0.255 1.1.1.0 0.0.0.255active(config)#crypto ipsec transform-set trans esp-des esp-md5-hmacactive(cfg-crypto-trans)#mode tunnel standby上standby(config)#ip access-list extended vpnstandby(config-ext-nacl)#permit ip 2.2.2.00.0.0.255 1.1.1.0 0.0.0.255standby(config)#crypto ipsec transform-set trans esp-des esp-md5-hmacstandby(cfg-crypto-trans)#mode tunnel 定义加密图定义加密图:匹配感兴趣流,转换集,配置peer (为实现冗余备份,分支需要与中心的多个边界建立vpn,先匹配的先建立vpn,然后依次建立【default:不加时,当活动链路down掉后,从首到尾依次检查;加上时,以“圆”的形式检查)Branch上branch(config)#crypto map cisco 10 ipsec-isakmp branch(config-crypto-map)#match address vpnbranch(config-crypto-map)#set transform-set transbranch(config-crypto-map)#set peer 61.128.1.1 defaultbranch(config-crypto-map)#set peer 137.78.5.1定义加密图:匹配感兴趣流,转换集,配置peer,启用反向路由注入,并给RRI动态产生的路由打上tag 10,解决链路备份的回包问题。
active上active(config)#crypto map cisco 10 ipsec-isakmp active(config-crypto-map)#match address vpnactive(config-crypto-map)#set transform-set transactive(config-crypto-map)#set peer 202.100.1.1 active(config-crypto-map)#reverse-routeactive(config-crypto-map)#set reverse-route tag 10standby上standby(config)#crypto map cisco 10 ipsec-isakmpstandby(config-crypto-map)#match address vpnstandby(config-crypto-map)#set transform-set transstandby(config-crypto-map)#set peer 202.100.1.1standby(config-crypto-map)#reverse-route standby(config-crypto-map)#setreverse-route tag 10接口调用接口调用加密图,当内网的通信点与vpn对端的通信点进行通信,会触发连接internet的接口(加密点),对数据加密,以保障数据在internet网络中传输时的安全,vpn对端接口则会解密、验证,如果认证通过,数据传输;不通过,直接丢弃Branch上branch(config)#int f0/0branch(config-if)#crypto map cisco active上active(config)#int f0/1active(config-if)#crypto map cisco standby上standby(config)#int f0/1standby(config-if)#crypto map cisco 在active和standby上配置route-map利用route-map来匹配上tag 10的路由active(config)#route-map s2o permit 10 active(config-route-map)#match tag 10standby(config)#route-map s2o permit 10 standby(config-route-map)#match tag 10在active和standby上将route-map在OSPF中通告将route-map重发布进ospf,通告所有内网用户active(config)#router ospf 1active(config-router)#redistribute static route-map s2o subnetsstandby(config)#router ospf 1standby(config-router)#redistribute static route-map s2o subnets4.测试链路是否建立成功首先在active上查看加解密包的个数再查看静态路由RRI,反向路由注入,即指那一台路由器上有ipsec sa,做了启用的反向路由注入,就会在本地路由器上自动产生一条目标是对端通信点,下一跳为对端加密点的静态路由。