2013-10-03
Make OpenVPN Not Use VPN by Default

Some users of the LUG VPN hope to use the VPN only for certain specific IPs, while OpenVPN defaults to using the VPN for all. Perhaps my search skills are too poor, I didn’t Google a reliable answer. Readers without patience can directly look at my solution:

1
2
3
4
5
6
7
8
9
10
11
$ echo "script-security 2" >>/etc/openvpn/client.conf
$ echo "up /usr/local/bin/remove-ovpn-defroute" >>/etc/openvpn/client.conf

$ cat /usr/local/bin/remove-ovpn-defroute
#!/bin/sh
(
sleep 2 # wait for routing table to be flushed
ip route del 0.0.0.0/1 dev tun0
ip route del 128.0.0.0/1 dev tun0
) &
exit 0
Read More