GRE Over IPsec
u 图示
|
u 说明:通过GRE Over IPsec保护loopback100网段的网络,IPsec Over GRE就是走GRE隧道用IPsec加密。GRE本身可以让两内部网络通信,但是没有加密。R1公网接口为f0/0
R3的公网接口为f0/1.
Tunnel模式
u R1配置,该方法配置只能为tunnel模式
crypto isakmp policy 10 encr 3des hash md5 authentication pre-share group 2 crypto isakmp key cisco address 3.3.3.3 255.255.255.0 // 可以不配置 crypto isakmp key cisco address 23.23.23.2 255.255.255.0 ! crypto ipsec transform-set VPNSET esp-3des esp-md5-hmac mode Tunnel //Tunnel模式 ! crypto map VPNMAP 10 ipsec-isakmp set peer 23.23.23.2 set transform-set VPNSET //模式为传输模式 match address VPN //加密GRE流量 ! interface Loopback0 ip address 172.16.1.1 255.255.255.0 ! interface Loopback100 ip address 1.1.1.1 255.255.255.0 ! interface Tunnel0 ip address 192.168.1.1 255.255.255.0 tunnel source FastEthernet0/0 tunnel destination 23.23.23.2 ! interface FastEthernet0/0 ip address 12.12.12.1 255.255.255.0 crypto map VPNMAP //在物理口加密 ! router eigrp 100 network 1.1.1.0 0.0.0.255 network 172.16.1.0 0.0.0.255 network 192.168.1.0 no auto-summary ! ip route 0.0.0.0 0.0.0.0 12.12.12.2 ! ip access-list extended VPN permit gre any any |
u R1路由
|
u GRE Over IPsec封装过程
当172.16.1.1 ping 172.16.2.1时,首先查找路由表,现下一跳路由是192.168.1.2,本地的出口为Tunnel0口。Tunnel口用GRE封装,源为IP为12.12.12.1,目的IP为23.23.23.2。再查找23.23.23.2的路由,发现出口为f0/0,把数据包由f0/0发出。由于f0/0加密了,所以再次封装ESP。在由物理口查找路由,源为12.12.12.1,目的为23.23.23.2,从f0/0出去。 封装格式tunnel模式:
|
Transparent模式
R1配置,该方法配置可以配置两种模式
crypto isakmp policy 10 encr 3des hash md5 authentication pre-share group 2 crypto isakmp key cisco address 3.3.3.3 255.255.255.0 crypto isakmp key cisco address 23.23.23.2 255.255.255.0 ! crypto ipsec transform-set VPNSET esp-3des esp-md5-hmac mode transport //模式可以修改 ! crypto ipsec profile GREPRO //IPsec profile的配置 set transform-set VPNSET ! interface Loopback0 ip address 172.16.1.1 255.255.255.0 ! interface Loopback100 ip address 1.1.1.1 255.255.255.0 ! interface Tunnel0 ip address 192.168.1.1 255.255.255.0 tunnel source FastEthernet0/0 tunnel destination 23.23.23.2 tunnel protection ipsec profile GREPRO //tunnel接口运用,用IPsec保护tunnel流量 ! interface FastEthernet0/0 ip address 12.12.12.1 255.255.255.0 ! router eigrp 100 network 1.1.1.0 0.0.0.255 network 172.16.1.0 0.0.0.255 network 192.168.1.0 no auto-summary ! ip route 0.0.0.0 0.0.0.0 12.12.12.2 ! |
u GRE Over IPsec封装过程
Transparent模式
|