Excluding route in openVPN profile

4

2

To add routing through vpn I add the following line to .ovpn profile:

route 173.0.0.0 255.0.0.0

how can I do the opposite? I need to EXCLUDE certain subnet to be passed throught vpn Do I need to write as many routes with "smaller" masks to cover all the remaining addresses?

user2659701

Posted 2014-01-30T08:31:45.873

Reputation: 43

Answers

3

OpenVPN has no command to avoid certain routes. What you need to do is to instruct your routing table to avoid the OpenVPN interface (tap or tun).

For instance, if your are connected to your LAN via eth0/br0, you tell the routing table to use that interface for the local LAN:

  sudo route add -net 192.168.0.0/24 dev eth0

or dev br0, whichever applies. Or you may tell your routing table to skip the VPN, when it wants to reach the IP address 8.8.4.4 (for instance) by means of:

  sudo route add -host 8.8.4.4 gw 192.168.0.1

Here I assumed that your LAN subnet is 192.168.0.0/24, and your gateway without VPN 192.168.0.1; if necessary, change the two statements above accordingly.

MariusMatutiae

Posted 2014-01-30T08:31:45.873

Reputation: 41 321