Created
May 11, 2015 09:23
-
-
Save asgrim/42b0fe82c19b417a5b5c to your computer and use it in GitHub Desktop.
OpenVPN with nameserver - when you connect to a VPN that does not automatically set appropriate nameserver, this wraps it and makes it work.
This file contains 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 | |
if [ "$(id -u)" != "0" ]; then | |
echo "You must be root..." | |
exit 1 | |
fi | |
sed -i -e "s/search homerouter\.cpe/nameserver 192.168.2.2\nsearch homerouter.cpe/" /etc/resolv.conf | |
openvpn --config #path-to-ovpn-config# | |
sed -i '/nameserver 192.168.2.2/d' /etc/resolv.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment