ipsec over gre

工程不推荐

加密包在router里边处理过程,和map撞击的方法

主要为了跑动态路由协议

问:为什么我们需要用到GRE?

答:Ipsec VPN 不能够支持加密二层和组播流量,这样一个限制就意味着

不能够通过Ipsec VPN 运行动态路由协议。为了解决这个问题,我们采用了GRE,它能

很好的封装组播和二层协议,能够为我们的Ipsec VPN 提供动态路由协议的服务。但是

这个限制到了12.4 之后就消除了!Cisco在12.4 引入了Ipsec Profile的技术。

site1:

inter tunn 0

ip add 172.16.1.1 255.255.255.0

tunnel source f0/0

tunnel dest 202.100.1.2

site2:

inter lo0

ip add 172.16.1.2 255.255.255.0

tunnel source f0/0

tunnel dest 202.100.1.1

site1:

router ospf 1

network 172.16.1.0 0.0.0.255 area 0net 1.1.1.1 0.0.0.0 area 0

net 2.2.2.2 0.0.0.0 area 0

net 3.3.3.3 0.0.0.0 area 0

site2:

router ospf 1

network 172.16.1.0 0.0.0.255 area 0

net 4.4.4.4 0.0.0.0 area 0

net 5.5.5.5 0.0.0.0 area 0

net 6.6.6.6 0.0.0.0 area 0

site1:

cry isa pol 10

au re

cry isa key 0 cisco add 202.100.1.2

cry ipsec transform-set cisco esp-des esp-md5-hmac

ip access-list ex vpn

permit ip host 1.1.1.1 host 4.4.4.4(总共要写9条感兴趣流,只写一条测试)

cry map cisco 10 ipsec-isa

match address vpn

set transform-set cisco

set peer 202.100.1.2

应该在tunnel口调用map,因为都是从tunnel出去的。至少应该在tunnel上调用,建议所有出接口和入接口都调用。

inter tunnel 0

cry map cisco

inter f0/0

cry map cisco

site2:crypto isakmp policy 10

auth pre-share

crypto isakmp key cisco address 202.10.1.1

crypto ipsec transtom-set cisco esp-des esp-md5-hmac

crypto map cisco 10 ipsec-isakmp

set peer 202.100.1.1

set transform-set cisco

match address vpn

ip access-list ex vpn

permit ip host 4.4.4.4 host 1.1.1.1

int tunnel 0

cry map cisco

int f0/0

cry map cisco

1.查询路由表,发现tunnel是出行接口。

2.在tunnel口撞击map,感兴趣流要匹配,要在tunnel调用。

3.触发了加密 sip:202.100.1.1 dip:202.100.1.2 esp 1.1.1.1 4.4.4.4

4.加密产生的新包继续查询路由表。

5.从物理口出

site1:

int lo 100

ip add 11.1.1.1 255.255.255.255site2:

int lo 100

ip add 22.1.1.1 255.255.255.255

site1:

router ospf 1

network 11.1.1.1 0.0.0.0 area 0

site2:

router ospf 1

net 22.2.2.2 0.0.0.0 area 0

更改peer为对方回环口

no crypto isakmp key cisco address 202.100.1.2

crypto isakmp key cisco address 22.1.1.1

crypto map cisco 10 ipsec-isakmp

no set peer 202.100.1.2

set peer 22.1.1.1

cry map cisco local-address lo 100(更改更新源)

site2:

no crypto isakmp key cisco address 202.100.1.1

crypto isakmp key cisco address 11.1.1.1

crypto map cisco 10 ipsec-isakmp

no set peer 202.100.1.1

set peer 11.1.1.1

cry map cisco local-address lo 100

1.查询路由表,发现tunnel是出行接口。

2.在tunnel口撞击map,感兴趣流要匹配,要在tunnel调用。

3.触发了加密 sip:11.1.1.1 dip:22.1.1.1 esp 1.1.1.1 4.4.4.4

4.加密产生的新包继续查询路由表。

5.继续送到tunnel口

6.出tunnel口sip:202.100.1.1 dip:202.100.1.2 gre sip:11.1.1.1 dip:22.1.1.1 esp 1.1.1.1 4.4.4.4

7.查询路由表

8.送出物理口