![VPN客户端互相连接](https://linux22.com/image/1612581/VPN%E5%AE%A2%E6%88%B7%E7%AB%AF%E4%BA%92%E7%9B%B8%E8%BF%9E%E6%8E%A5.png)
我在 Digital Ocean 上有 l2tp vpn,然后连接设备。我希望每个设备都相互连接。
例如 :
192.168.42.10 可以连接到 192.168.42.11
这是为了隧道目的。
IPtables 规则:
GNU nano 2.2.6 File: /etc/iptables.rules
Completed on Thu Dec 26 15:07:38 2019
Generated by iptables-save v1.4.21 on Thu Dec 26 15:07:38 2019
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -p udp -m udp --dport 1701 -m policy --dir in --pol none -j DROP
-A INPUT -m conntrack --ctstate INVALID -j DROP
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p udp -m multiport --dports 500,4500 -j ACCEPT
-A INPUT -p udp -m udp --dport 1701 -m policy --dir in --pol ipsec -j ACCEPT
-A INPUT -p udp -m udp --dport 1701 -j DROP
-A FORWARD -m conntrack --ctstate INVALID -j DROP
-A FORWARD -i eth0 -o ppp+ -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i ppp+ -o eth0 -j ACCEPT
-A FORWARD -s 192.168.42.0/24 -d 192.168.42.0/24 -i ppp+ -o ppp+ -j ACCEPT
-A FORWARD -d 192.168.43.0/24 -i eth0 -m conntrack --ctstate RELATED,ESTABLISHE$
-A FORWARD -s 192.168.43.0/24 -o eth0 -j ACCEPT
-A FORWARD -j DROP