0

I have set up OpenVPN on a server. I am able to connect to OpenVPN as a client. I want to route all the client traffic through the VPN. I have read all the documentation and tried to follow it but still unsuccessful.

Here is my configuration details:

Server configs:

push "redirect-gateway def1"

push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 208.67.222.222"
push "dhcp-option DNS 208.67.220.220"

Client configs:

push "redirect-gateway def1"

On the OpenVPN server:

Add the following line in the /etc/sysctl.conf

net.ipv4.ip_forward = 1

confirm it with "sudo sysctl -p" command.

Add the following in the firewall rules /etc/ufw/before.rules

# START OPENVPN RULES
# NAT table rules
*nat
:POSTROUTING ACCEPT [0:0]
# Allow traffic from OpenVPN client to eth0 (change to the interface you discovered!)
-A POSTROUTING -s 10.8.0.0/8 -o eth0 -j MASQUERADE
COMMIT
# END OPENVPN RULES

Kindly guide me if I am missing anything. I have taken all the steps but it is not working. Thanks

Brand Lee
  • 1
  • 1
  • What do you mean by "*I want to route all the client traffic from the OpenVPN server.*"? How exactly the traffic should be routed? Do you want to route all the client traffic through the VPN, or something else? Can you build the desired routing on client and on server by hand, considering VPN connection as just additional network interface, and then we'll find out how to implement this automatically in OpenVPN? – Nikita Kipriyanov Jun 07 '22 at 12:40
  • Yes I want to route all the client traffic through the VPN – Brand Lee Jun 07 '22 at 13:49

0 Answers0