2013-10-03
让 OpenVPN 默认不走 VPN

LUG VPN 的一些用户希望仅对某些特定 IP 使用 VPN,而 OpenVPN 默认是全部走 VPN。也许是我的搜索能力太差,竟然没有 Google 到靠谱的答案。没有耐心的读者可直接看我的解决方案:

$ 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