Advertisement
Guest User

Untitled

a guest
Feb 3rd, 2014
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /bin/bash
  2. VPNIF="tun0"
  3. VPNUSER="rt" # Edited the routing table to "rt" insted of "vpnuser"
  4. 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`
  5. if [[ `ip rule list | grep -c 0x1` == 0 ]]; then
  6. ip rule add from all fwmark 0x1 lookup $VPNUSER
  7. fi
  8. ip route replace default via $GATEWAYIP table $VPNUSER
  9. ip route append default via 127.0.0.1 dev lo table $VPNUSER
  10. ip route flush cache
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement