Answer the question
In order to leave comments, you need to log in
How to allow NAT only when OpenVPN is connected on Ubuntu Server?
Good evening.
Task: route client traffic from the internal network through OpenVPN.
Right now I'm using the following rules:
sudo iptables -A FORWARD -o tun0 -i eth0 -s 192.168.1.0/24 -m conntrack --ctstate NEW -j ACCEPT
sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A POSTROUTING -o tun0 -t nat -j MASQUERADE
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question