openswan 多子网路由问题

use*_*287 3 centos openswan

我正在尝试在 CentOS 6.5(最终版)上设置 OpenSwan(2.6.32) 以连接 Amazon 云上的远程 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
Run Code Online (Sandbox Code Playgroud)

启动 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
Run Code Online (Sandbox Code Playgroud)

我认为防火墙在这里没有任何作用,因为我完全关闭了它只是为了测试连接。路线也按预期工作。如果我在左侧定义单个网络,单独在单独的测试连接上,我可以访问任一子网。只有当我定义 leftsubet s 时,最后一个范围才会被路由。无论哪个先到,都会在停止路由之前工作一秒钟。

我在互联网上找不到任何人有类似的问题......有人可以赐教吗?

干杯,

小智 5

当你使用时leftsubnets,你必须使用rightsubnets,而不是rightsubnet。如http://linux.die.net/man/5/ipsec.conf 所述

如果同时定义了 aleftsubnets=rightsubnets=,则将实例化子网隧道的所有组合。