我正在尝试在CentOS 6.5(最终版)上设置一个OpenSwan(2.6.32)来连接亚马逊云上的远程VPC网关.我把隧道搞定了.但是,仅路由来自/到leftsubnets中定义的最后一个ip范围的流量.第一个工作短暂一秒(可能在第二个隧道启动之前),然后没有更多路由.以下是我的配置.
- conn aws-vpc
- leftsubnets={10.43.4.0/24 10.43.6.0/24}
- rightsubnet=10.43.7.0/24
- auto=start
- left=206.191.2.xxx
- right=72.21.209.xxx
- rightid=72.21.209.xxx
- leftid=206.191.2.xxx
- leftsourceip=10.43.6.128
- authby=secret
- ike=aes128-sha1;modp1024
- phase2=esp
- phase2alg=aes128-sha1;modp1024
- aggrmode=no
- ikelifetime=8h
- salifetime=1h
- dpddelay=10
- dpdtimeout=40
- dpdaction=restart
- type=tunnel
- forceencaps=yes
启动IPsec服务后:
- # service ipsec status
- IPsec running - pluto pid: 8601
- pluto pid 8601
- 2 tunnels up
- some eroutes exist
- # ip xfrm policy
- src 10.43.6.0/24 dst 10.43.7.0/24
- dir out priority 2344 ptype main
- tmpl src 206.191.2.xxx dst 72.21.209.xxx
- proto esp reqid 16389 mode tunnel
- src 10.43.7.0/24 dst 10.43.6.0/24
- dir fwd priority 2344 ptype main
- tmpl src 72.21.209.xxx dst 206.191.2.xxx
- proto esp reqid 16389 mode tunnel
- src 10.43.7.0/24 dst 10.43.6.0/24
- dir in priority 2344 ptype main
- tmpl src 72.21.209.xxx dst 206.191.2.xxx
- proto esp reqid 16389 mode tunnel
- src 10.43.4.0/24 dst 10.43.7.0/24
- dir out priority 2344 ptype main
- tmpl src 206.191.2.xxx dst 72.21.209.xxx
- proto esp reqid 16385 mode tunnel
- src 10.43.7.0/24 dst 10.43.4.0/24
- dir fwd priority 2344 ptype main
- tmpl src 72.21.209.xxx dst 206.191.2.xxx
- proto esp reqid 16385 mode tunnel
- src 10.43.7.0/24 dst 10.43.4.0/24
- dir in priority 2344 ptype main
- tmpl src 72.21.209.xxx dst 206.191.2.xxx
- proto esp reqid 16385 mode tunnel
我不认为防火墙在这里扮演任何角色,因为我完全将其关闭以测试连接.路线也按预期工作.如果我在左侧定义单个网络,单独在一个单独的测试连接上,我可以到达任一子网.只有当我定义leftsubets时,最后的最后一个范围才会被路由到最后.无论哪个先到,在停止路由之前都要工作一小段时间.
我在网上找不到任何人有类似的问题…有人可以赐教吗?
干杯,
博
使用leftsubnets时,必须使用权限子网,而不是权限子网.如
http://linux.die.net/man/5/ipsec.conf所述:
If both a
leftsubnets=
andrightsubnets=
is defined,all combinations of subnet tunnels will be instantiated.