Last active
March 3, 2017 06:04
-
-
Save intrd/f0151dfb035abdcfa46e5c4b8f8d6ee4 to your computer and use it in GitHub Desktop.
OpenVPN - Shuffle ip, start and isolate tun0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## OpenVPN - Shuffle ip, start and isolate tun0 | |
# @author intrd - http://dann.com.br/ | |
# @license Creative Commons Attribution-ShareAlike 4.0 International License - http://creativecommons.org/licenses/by-sa/4.0/ | |
# dep: https://gist.github.com/intrd/55576b75a9945ae6e611fba49f1a4b0d | |
#sort a vpn | |
VPN="$(shuf -n 1 /home/intrd/openvpn/xvpn/ips.txt | cut -f2 -d' ')" | |
#clear default routes, leaving localroute | |
sudo route del default gw 192.168.0.1 wlan0 | |
sudo route del default gw 192.168.1.1 wlan0 | |
sudo route del -net 192.168.0.0 netmask 255.255.255.0 dev wlan0 | |
sudo route del -net 192.168.1.0 netmask 255.255.255.0 dev wlan0 | |
#add new restrict routes | |
sudo route add 192.168.1.1 gw 192.168.1.20 wlan0 #local | |
#create route to vpn | |
sudo route add $VPN gw 192.168.1.1 wlan0 | |
sudo openvpn --remote $VPN --port 443 --config /home/intrd/openvpn/xvpn/xvpn1.ovpn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment