Openswan ipsec 集线器和辐射设置不起作用

Openswan ipsec 集线器和辐射设置不起作用

我已经使用 openswan ipsec 配置了 Hub 和 Spoke。隧道立即启动,但问题是:

Spoke1 can ping/access HUB's LAN and vice-versa (S1 -- HUB && HUB -- S1)
Spoke2 can ping/access HUB's LAN and vice-versa (S1 -- HUB && HUB -- S2)

但,

Spoke1 can **not** ping/access Spoke2 and vice-versa (**S1 -- S2 && S2 -- S1 NOT WORKING**)

配置:

Hub: 10.103.6.7/23          LAN: 10.1.0.0/16
Spoke1: 10.103.6.40/23      LAN: 10.1.2.0/24
Spoke2: 10.103.6.97/23      LAN: 10.1.1.0/24

Spoke1 上的配置:( /etc/ipsec.conf)

config setup
    nat_traversal=yes
    oe=off
    protostack=netkey

conn NGpassthrough
    left=10.1.2.1
    right=0.0.0.0
    leftsubnet=10.1.2.0/24
    rightsubnet=10.1.2.0/24
    authby=never
    type=passthrough
    auto=route

conn NG
    right=10.103.6.7
    rightsubnet=10.1.0.0/16
    left=10.103.6.40
    leftsubnet=10.1.2.0/24
    leftnexthop=10.103.6.1
    leftupdown="ipsec _updown --route yes"
    auto=start
    leftid=10.103.6.40
    rightid=10.103.6.7
    #x_rightdynamic=yes
    authby=secret
    compress=no
    failureshunt=drop
    dpddelay=15
    dpdtimeout=60
    dpdaction=restart
    pfs=yes
    ike=aes128-md5-modp1024,aes192-md5-modp1024,aes256-md5-modp1024,aes128-sha1-modp1024,aes192-sha1-modp1024,aes256-sha1-modp1024,3des-md5-modp1024,3des-sha1-modp1024,aes128-md5-modp1536,aes192-md5-modp1536,aes256-md5-modp1536,aes128-sha1-modp1536,aes192-sha1-modp1536,aes256-sha1-modp1536,3des-md5-modp1536,3des-sha1-modp1536,aes128-md5-modp2048,aes192-md5-modp2048,aes256-md5-modp2048,aes128-sha1-modp2048,aes192-sha1-modp2048,aes256-sha1-modp2048,3des-md5-modp2048,3des-sha1-modp2048
    esp=aes128-md5,aes192-md5,aes256-md5,aes128-sha1,aes192-sha1,aes256-sha1,3des-md5,3des-sha1

HUB 上的配置:(/etc/ipsec.conf)

config setup
    nat_traversal=yes
    oe=off
    protostack=netkey

conn NGpassthrough
    left=10.1.0.1
    right=0.0.0.0
    leftsubnet=10.1.0.0/16
    rightsubnet=10.1.0.0/16
    authby=never
    type=passthrough
    auto=route

conn NG
    right=10.103.6.40
    rightsubnet=10.1.2.0/24
    left=10.103.6.7
    leftsubnet=10.1.0.0/16
    leftnexthop=10.103.6.1
    leftupdown="ipsec _updown --route yes"
    auto=start
    leftid=10.103.6.7
    rightid=10.103.6.40
    #x_rightdynamic=yes
    authby=secret
    compress=no
    failureshunt=drop
    dpddelay=15
    dpdtimeout=60
    dpdaction=restart
    pfs=yes
    ike=aes128-md5-modp1024,aes192-md5-modp1024,aes256-md5-modp1024,aes128-sha1-modp1024,aes192-sha1-modp1024,aes256-sha1-modp1024,3des-md5-modp1024,3des-sha1-modp1024,aes128-md5-modp1536,aes192-md5-modp1536,aes256-md5-modp1536,aes128-sha1-modp1536,aes192-sha1-modp1536,aes256-sha1-modp1536,3des-md5-modp1536,3des-sha1-modp1536,aes128-md5-modp2048,aes192-md5-modp2048,aes256-md5-modp2048,aes128-sha1-modp2048,aes192-sha1-modp2048,aes256-sha1-modp2048,3des-md5-modp2048,3des-sha1-modp2048
    esp=aes128-md5,aes192-md5,aes256-md5,aes128-sha1,aes192-sha1,aes256-sha1,3des-md5,3des-sha1


conn NG1passthrough
    left=10.1.0.1
    right=0.0.0.0
    leftsubnet=10.1.0.0/16
    rightsubnet=10.1.0.0/16
    authby=never
    type=passthrough
    auto=route

conn NG1
    right=10.103.6.97
    rightsubnet=10.1.1.0/24
    left=10.103.6.7
    leftsubnet=10.1.0.0/16
    leftnexthop=10.103.6.1
    leftupdown="ipsec _updown --route yes"
    auto=start
    leftid=10.103.6.7
    rightid=10.103.6.97
    #x_rightdynamic=yes
    authby=secret
    compress=no
    failureshunt=drop
    dpddelay=15
    dpdtimeout=60
    dpdaction=restart
    pfs=yes
    ike=aes128-md5-modp1024,aes192-md5-modp1024,aes256-md5-modp1024,aes128-sha1-modp1024,aes192-sha1-modp1024,aes256-sha1-modp1024,3des-md5-modp1024,3des-sha1-modp1024,aes128-md5-modp1536,aes192-md5-modp1536,aes256-md5-modp1536,aes128-sha1-modp1536,aes192-sha1-modp1536,aes256-sha1-modp1536,3des-md5-modp1536,3des-sha1-modp1536,aes128-md5-modp2048,aes192-md5-modp2048,aes256-md5-modp2048,aes128-sha1-modp2048,aes192-sha1-modp2048,aes256-sha1-modp2048,3des-md5-modp2048,3des-sha1-modp2048
    esp=aes128-md5,aes192-md5,aes256-md5,aes128-sha1,aes192-sha1,aes256-sha1,3des-md5,3des-sha1

Spoke2 上的配置:(/etc/ipsec.conf)

config setup
    nat_traversal=yes
    oe=off
    protostack=netkey


conn NGpassthrough
    left=10.1.1.1
    right=0.0.0.0
    leftsubnet=10.1.1.0/255.255.255.0
    rightsubnet=10.1.1.0/255.255.255.0
    authby=never
    type=passthrough
    auto=route

conn NG
    right=10.103.6.7
    rightsubnet=10.1.0.0/16
    left=10.103.6.97
    leftsubnet=10.1.1.0/255.255.255.0
    leftnexthop=10.103.6.1
    auto=start
    leftid=10.103.6.97
    rightid=10.103.6.7
    #x_rightdynamic=yes
    authby=secret
    compress=no
    failureshunt=drop
    dpddelay=15
    dpdtimeout=60
    dpdaction=restart
    pfs=yes
    ike=aes128-md5-modp1024,aes192-md5-modp1024,aes256-md5-modp1024,aes128-sha1-modp1024,aes192-sha1-modp1024,aes256-sha1-modp1024,3des-md5-modp1024,3des-sha1-modp1024,aes128-md5-modp1536,aes192-md5-modp1536,aes256-md5-modp1536,aes128-sha1-modp1536,aes192-sha1-modp1536,aes256-sha1-modp1536,3des-md5-modp1536,3des-sha1-modp1536,aes128-md5-modp2048,aes192-md5-modp2048,aes256-md5-modp2048,aes128-sha1-modp2048,aes192-sha1-modp2048,aes256-sha1-modp2048,3des-md5-modp2048,3des-sha1-modp2048
    esp=aes128-md5,aes192-md5,aes256-md5,aes128-sha1,aes192-sha1,aes256-sha1,3des-md5,3des-sha1

Spoke1 上添加的路由:

10.1.0.0/16 via 10.1.2.1 dev br0 (lan interface)

HUB上添加的路由:

10.1.1.0/24 via 10.1.0.1 dev br0 (lan interface)
10.1.2.0/24 via 10.1.0.1 dev br0 (lan interface)

Spoke2上添加的路由:

10.1.0.0/16 via 10.1.1.1 dev br-lan (lan interface)

数据包进入 HUB 的 PREROUTING 表,但未进入 FORWARD 表或 INPUT 表。我已经删除了路由并刷新了 iptable。但仍然面临同样的问题。

相关内容