1

I'm setting up a server that tunnels all its traffic over an OpenVPN connection. The VPN connection is further tunnelled over obfsproxy hosted on the same machine.

The problem is that as soon as the VPN connects, all traffic goes through the VPN tunnel which includes the traffic from obfsproxy. This creates a circular dependency where OpenVPN needs to tunnel traffic through obfsproxy which is trying to send its outgoing traffic through OpenVPN.

I can fix it by manually adding an exception in the routing table by running route add vpn.example.com gw 192.168.1.1 where 192.168.1.1 is the gateway for the main network interface (not the tunnel). That way, all traffic goes through the tunnel except outgoing traffic from the proxy.

However, the gateway address for the main network interface is set by DHCP and can't be assumed to be the same.

I tried setting it up by running route add vpn.example.com eth0 (where eth0 is the main network interface) but it doesn't work since I haven't specified a gateway and vpn.example.com requires further routing.

I also tried looking at hooks and callbacks for various DHCP clients but I couldn't find any that supports running a script after setting static routes.

Is there a way to set up some sort of route or iptables rule that will redirect traffic to a specific IP address through the main network interface and everything else via the tunnel?

tangrs
  • 152
  • 1
  • 6
  • Usually commands to configure routing are run in scripts on connect/disconnect of the VPN. For openVPN that would be lines like `up /etc/openvpn/up.sh` and `down /etc/openvpn/down.sh` in the configuration file. – Brian Dec 03 '14 at 08:34

0 Answers0