【问题标题】:Strongswan RoadWarrior VPN-ConfigStrongswan RoadWarrior VPN-配置
【发布时间】:2014-06-08 09:28:21
【问题描述】:

我想为我的本地网络流量(iPhone/iPad/MacBook)设置一个 VPN-Server。

到目前为止,我设法使用 CA 和 Client-Cert 设置了基本配置。 目前我的客户端可以连接到服务器并访问服务器资源,但没有到互联网的路由。

服务器可通过公网IP直接访问(无需家庭安装...)。

要通过 VPN-Server 路由我的所有客户端流量并为我的客户端启用 Internet 访问,我需要进行哪些更改?

提前致谢

/etc/ipsec.conf

config setup

conn rw
    keyexchange=ikev1
    authby=xauthrsasig
    xauth=server
    auto=add
    #
    #LEFT (SERVER)
    left=%defaultroute
    leftsubnet=0.0.0.0/0
    leftfirewall=yes
    leftcert=serverCert.pem
    #
    #RIGHT (CLIENT)
    right=%any
    rightsubnet=10.0.0.0/24
    rightsourceip=10.0.0.0/24
    rightcert=clientCert.pem

iptables --list

Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  10.0.0.1             anywhere             policy match dir in pol ipsec                                                                                                                reqid 1 proto esp
ACCEPT     all  --  anywhere             10.0.0.1             policy match dir out pol ipsec                                                                                                                reqid 1 proto esp

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

【问题讨论】:

    标签: linux vpn nat ipsec


    【解决方案1】:

    找到了解决办法!

    /etc/ipsec.conf

    rightsubnet=10.0.0.0/24
    

    iptables

    iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -o eth0 -m policy --dir out --pol ipsec -j ACCEPT
    iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -o eth0 -j MASQUERADE
    

    系统

    sysctl net.ipv4.ip_forward=1
    

    【讨论】:

    猜你喜欢
    • 2022-07-28
    • 2020-11-16
    • 2021-07-27
    • 2020-01-07
    • 1970-01-01
    • 2021-01-26
    • 2020-04-02
    • 2012-02-06
    • 1970-01-01
    相关资源
    最近更新 更多