M
M
Mark Sakharov2021-08-22 03:16:40
SSH
Mark Sakharov, 2021-08-22 03:16:40

How to write Iptables rules to direct OpenVPN server traffic to SSH tunnel?

An OpenVPN server has been set up on an Ubuntu 20.04 server.
Open SSH tunnel to remote host

autossh -M 20000 -D 127.0.0.1:1080 -q -N  [email protected]

Actually, they are interested in rules that will not conflict with the existing ones:
-t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE

-A FORWARD -i tun0 -j ACCEPT

-A FORWARD -i tun0 -o eth0 -s 10.8.0.0/24 -j ACCEPT

-A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT

-A FORWARD -j REJECT

to route VPN traffic to the SSH tunnel.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question