rendered paste body#!/bin/bash
USERNAME="$1"
IFACE="$2"
PPTPS=cable.netvision.net.il
NEWDNS=194.90.1.5
ifdown $IFACE
ifup $IFACE
NVGW=$(ping -c 3 -w 3 $PPTPS | head -n 1 | cut -d" " -f3 | cut -d"(" -f2 | cut -d")" -f1)
CABLEGW=$(route -n | grep 0.0.0.0 | cut -d" " -f10 | tail -1)
route add -host $NVGW gw $CABLEGW dev $IFACE
./pptp $NVGW debug user $USERNAME mtu 1380 mru 1380 defaultroute persist nobsdcomp usepeerdns
sleep 6
NEWGW=$(ifconfig ppp0 | grep inet | cut -d":" -f3 | tail -1 | cut -d" " -f1)
route add default gw $NEWGW
route del default gw $CABLEGW
echo nameserver $NEWDNS > /etc/resolv.conf