经典GRE over IPSec实验
如图所示,该拓扑是GRE over IPSec站点到站点的VPN拓扑
实验需求;
在站点Site1(202.100.1.1)和Site2(61.128.1.1)之间建立GRE隧道tunnel0,网段172.16.1.0/24
GRE隧道上运行OSPF协议
使得Site1和Site2相互学到身后的网络路由1.1.1.1/24和3.3.3.3/24
配置IPSec VPN,对两个站点之间GRE流量加密
基本配置省略
Site1(config)#ip route 0.0.0.0 0.0.0.0 202.100.1.10
Site2(config)#ip route 0.0.0.0 0.0.0.0 61.128.1.10
Site1上的GRE隧道配置
Site1(config-if)#ip add 172.16.1.1 255.255.255.0
Site1(config-if)#tunnel source 202.100.1.1
Site1(config-if)#tunnel destination 61.128.1.1
Site2上的GRE隧道配置
Site2(config)#int tunnel 0
Site2(config-if)#ip add 172.16.1.2 255.255.255.0
Site2(config-if)#tunnel source 61.128.1.1
Site2(config-if)#tunnel destination 202.100.1.1
Site1上的OSPF配置
Site1(config)#router os 1
Site1(config-router)#net 172.16.1.0 255.255.255.0 a
Site1(config-router)#net 1.1.1.0 255.255.255.0 a 0
Site2上的OSPF配置
Site2(config)#router os 1
Site2(config-router)#net 172.16.1.0 255.255.255.0 a 0
*Sep 8 15:31:38.759: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on Tunnel0 from LOADING to FULL, Loading Done //tunnel0的邻居已经建立
Site2(config-router)#net 3.3.3.3 255.255.255.0 a 0
配置IPSec VPN保护站点之间的流量
Site1上的IPSec配置
Site1(config)#crypto isakmp policy 10
Site1(config-isakmp)#authentication pre-share
Site1(config)#crypto isakmp key 0 cisco address 61.128.1.1
Site1(config)#ip access-list extended vpn
Site1(config-ext-nacl)#permit gre host 202.100.1.1 host 61.128.1.1
Site1(config)#crypto ipsec transform-set cisco esp-des esp-md5-hmac
Site1(cfg-crypto-trans)#mode transport
Site1(config)#crypto map cisco 10 ipsec-isakmp
Site1(config-crypto-map)#match add vpn
Site1(config-crypto-map)#set transform-set cisco
Site1(config-crypto-map)#set peer 61.128.1.1
Site1(config-crypto-map)#int f0/0
Site1(config-if)#crypto map cisco
第一条报错消息,从61.128.1.1到202.100.1.1的流量未被封装上ISAKMP头部
第二条由于Site1采用了加密策略,Site2未采用,导致tunnel0邻居关系down
Site2上的IPSec配置
Site2(config)#crypto isakmp policy 10
Site2(config-isakmp)#authentication pre-share
Site2(config)#crypto isakmp key 0 cisco address 202.100.1.1
Site2(config)#ip access-list extended vpn
Site2(config-ext-nacl)#per gre host 61.128.1.1 host 202.100.1.1
Site2(config)#crypto ipsec transform-set cisco esp-des esp-md5-hmac
Site2(cfg-crypto-trans)#mode transport
Site2(config)#crypto map cisco 10 ipsec-isakmp
Site2(config-crypto-map)#match add vpn
Site2(config-crypto-map)#set transform-set cisco
Site2(config-crypto-map)#set peer 202.100.1.1
Site2(config)#int f0/0
Site2(config-if)#crypto map cisco
*Sep 8 15:43:20.803: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on Tunnel0 from LOADING to FULL, Loading Done //站点之间配置完成,邻居up
测试连通性
快速查看加解密状态
查看IPSec SA