问题原文
原帖链接 · Red Spider · CC BY-SA 3.0
Set up an openvpn server but having trouble getting ports forwarded to the client.
Below is what I am trying to do:
WAN: 123.45.67.89:4444 -> [OpenVPN Server] -> CLIENT: 192.168.1.10:4444
Seen many different answers on how to do this but no matter what I try it doesn't seem to work and port tests always show the port as closed.
社区高分解答
原帖链接 · Joseph Sible-Reinstate Monica · CC BY-SA 3.0
I assume you're using OpenVPN in routed mode and are NATting its clients onto the WAN. If so, you'll want to do the following:
iptables -t nat -A PREROUTING -i eth0 -d 123.45.67.89 -p tcp --dport 4444 -j DNAT --to-destination 192.168.1.10 (change eth0 to whatever interface your WAN is actually on).
If you're not using NAT, then it's just a matter of making sure the host you're trying to connect from knows to route packets destined for 192.168.1.10 through 123.45.67.89 (which obviously won't work to an RFC1918 IP over the Internet). In any case, the only other requirements are that you have IPv4 routing enabled (I'd assume that the VPN wouldn't be working at all if you didn't) and that you don't have any other firewall rules that would block this traffic.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
