Here's my setup:
------------------- ----------------------- -----------------------
| OpenVPN Client | | Ubuntu Server 22.04 | | Ubuntu Server 22.04 |
| Windows 10 |----->| Local Datacenter |----->| Linode Datacenter |
| OpenVPN Connect | | IP: a.b.c.d (1xNIC) | | IP: w.x.y.z (1xNIC) |
| | | | | OpenVPN Server |
------------------- ----------------------- -----------------------
The outbound OpenVPN traffic is blocked for Windows 10 machine so it has no access to OpenVPN server.
The server in the middle is from a local datacenter. Nothing is blocked to/from it.
The OpenVPN server is listening on port 443/udp
. Also ufw
is disabled. It's tested and works 100%.
Now, here's what I've done on the server in the middle:
/etc/sysctl.conf:
net.ipv4.ip_forward = 1
And then:
sudo sysctl -p
And to verify:
sudo cat /proc/sys/net/ipv4/ip_forward
1
After that:
sudo iptables -F
sudo iptables -t nat -F
sudo iptables -X
sudo iptables -t nat -A PREROUTING -p udp --dport 443 -j DNAT --to-destination w.x.y.z
sudo iptables -t nat -A POSTROUTING -p udp -d w.x.y.z --dport 443 -j SNAT --to-source a.b.c.d
As this is not working and OpenVPN connection from client times out, I need to know if the problem is in my rules, or I have to look somewhere else to find the issue.