daily pastebin goal


a guest Feb 3rd, 2014 328 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /bin/bash
  2. VPNIF="tun0"
  3. VPNUSER="rt"
  4. # Edited the routing table name to "rt" insted of "vpnuser"
  5. # Modified "ifconfig" to "ip addr show" to support iproute2
  6. GATEWAYIP=`ip addr show $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`
  7. if [[ `ip rule list | grep -c 0x1` == 0 ]]; then
  8. ip rule add from all fwmark 0x1 lookup $VPNUSER
  9. fi
  10. ip route replace default via $GATEWAYIP table $VPNUSER
  11. ip route append default via dev lo table $VPNUSER
  12. ip route flush cache
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand