Advertisement
Guest User

Untitled

a guest
Oct 12th, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #! /bin/bash
  2. # Niftiest Software – www.niftiestsoftware.com
  3. # Modified version by HTPC Guides – www.htpcguides.com
  4.  
  5. VPNIF="tun0"
  6. VPNUSER="deluge"
  7. GATEWAYIP=`ifconfig $VPNIF | egrep -o '([0-9]{1,3}\.){3}[0-9]{1,3}' | egrep -v '255|(127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})' | tail -n1`
  8. if [[ `ip rule list | grep -c 0x1` == 0 ]]; then
  9. ip rule add from all fwmark 0x1 lookup $VPNUSER
  10. fi
  11. ip route replace default via $GATEWAYIP table $VPNUSER
  12. ip route append default via 127.0.0.1 dev lo table $VPNUSER
  13. ip route flush cache
  14.  
  15. # run update-resolv-conf script to set VPN DNS
  16. #/etc/openvpn/update-resolv-conf
  17.  
  18. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement