ClearOS Documentation

×

Warning

301 error for file:https://clearos.com/dokuwiki2/lib/exe/css.php?t=dokuwiki&tseed=82873f9c9a1f5784b951644363f20ef8

User Tools

Site Tools


Forcing OpenVPN Traffic for Clients through Server

This guide is intended as a framework for expanding the capability of OpenVPN and also as a method for manual settings which force VPN traffic through the ClearOS firewall. This is useful if you need to have road warrior traffic originate from the corporate site in order to use systems which require security related to remote access from specific IPs.

This can be useful if you need traffic to 'originate' from a different location for security reasons.

Configuration of OpenVPN files

The /etc/openvpn/clients.conf file should be modified to include the following line:

push "redirect-gateway def1"

or

push "redirect-gateway def1 bypass-dhcp"

The bypass-dhcp stops DHCP messages going through the VPN as the local DHCP server should be resolving them.

After you make the change to the openvpn clients.conf file, restart the OpenVPN service:

service openvpn restart                  # ClearOS 5.x or 6.x
systemctl restart openvp@clients.service # ClearOS 7.x

Configuration of the firewall

No particular firewall rules are needed for ClearOS 6.x or 7.x

ClearOS 5.x may need:

iptables -A FORWARD -i eth0 -o tun0 -m state --state RELATED,ESTABLISHED -j ACCEPT # Allow VPN client traffic back in if established
iptables -A FORWARD -i tun0 -o eth0 -j ACCEPT # Allow VPN clients out
iptables -t nat -I POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE # nat for VPN
content/en_us/kb_o_forcing_openvpn_traffic_for_clients_through_server.txt · Last modified: 2018/09/14 12:00 by NickH

https://clearos.com/dokuwiki2/lib/exe/indexer.php?id=content%3Aen_us%3Akb_o_forcing_openvpn_traffic_for_clients_through_server&1566578679