I have an Ubuntu 14 server that is running OpenVPN gateway and ufw. Let's call it Server A.
I have an IP reservation for a permanently connected server (Server B). It always connects to OpenVPN and gets an IP of 10.8.0.10.
I need to forward connections to port 5010 on Server A to Server B's port 22 (SSH).
I have the following in before.rules:
# NAT table rules *nat :PREROUTING ACCEPT [0:0] # Route SSH to archimedes -A PREROUTING -p tcp -i eth0 --dport 5010 -j DNAT --to-destination 10.8.0.10:22 :POSTROUTING ACCEPT [0:0] # Allow traffic from OpenVPN client to eth0 -A POSTROUTING -s 10.8.0.0/8 -o tun0 -j MASQUERADE # END OPENVPN RULES COMMIT
DEFAULT_FORWARD_POLICY="ACCEPT" is set in
net.ipv4.ip_forward=1 is set in
If I SSH into Server and and try to SSH from it directly to 10.8.0.10 (Server B's VPN assigned IP on tun0 interface), I can connect just fine.
Any attempt to connect to Server A's port 5010 fails with a timeout. What did I miss?