我正在尝试执行以下操作:
我希望All Networks和Clients在我的服务器上初始化一个OpenVPN连接,所有的客户端都应该能够通过VPN来看到其他客户端/networking。
我也希望客户端(没有路由器)的所有互联网stream量通过服务器路由(安全浏览),我也希望客户端能够到达专用networking“networkingA”和“networkingB “(反之亦然)
networking应该只通过vpn路由发送给其他networking后面的vpn客户端和主机的数据
我会configurationnetworking路由器路由:
我的路线是否正确?
现在真正的问题:我如何设置OpenVPN服务器和防火墙Roules。 我的服务器是Ubuntu 14.04 64位的Strato虚拟专用服务器。
我是否应该将NAT设置为所有客户端的Internet网关,并忽略路由器上的NAT(如上所述的路由)? 我如何让客户互相沟通? 而最困难的是:如何通过vpn设置networking内部主机的数据包预警
例子:
Client B <=> VPN <=> Router for Net A <=> Host in Net A Host in Net A <=> Router Net A <=> VPN <=> Router Net B <=> Host in Net B Server that hosts VPN ("internal IP") <=> VPN <=> Some Host behind a router Server that hosts VPN ("internal IP") <=> VPN <=> Client # Not that important, but would be cool: Client A <=> VPN <=> Client B
还有什么我neet设置,我可能已经忘记了上面?
你是否启用了IP转发?
sudo vi /etc/sysctl.conf #uncomment net.ipv4.ip_forward and set = 1
net.ipv4.ip_forward = 1
sudo sysctl -p
如果您使用TUN,那么您的客户端有一个隧道IP地址。 默认池是10.8.1.0/24。 除非你的路由器知道隧道IP并且有路由,否则你需要伪装(NAT)隧道的IP地址,以便OpenVPN服务器将源地址重写为自身。 似乎你可能有你提到的路由10.8.0.0/24涵盖了这一点。
sudo apt-get install iptables-persistent sudo iptables -t nat -A POSTROUTING -s 10.8.1.0/24 -o eth0 -j MASQUERADE sudo sh -c 'iptables-save > /etc/iptables/rules.v4'