mirror of
https://github.com/Nyr/openvpn-install.git
synced 2024-12-01 09:26:09 +03:00
49 lines
1.4 KiB
Plaintext
49 lines
1.4 KiB
Plaintext
|
#!/bin/bash
|
||
|
echo "What DNS do you want to use with the VPN?"
|
||
|
echo " 1) Current system resolvers"
|
||
|
echo " 2) Google"
|
||
|
echo " 3) OpenDNS"
|
||
|
echo " 4) NTT"
|
||
|
echo " 5) Hurricane Electric"
|
||
|
echo " 6) You specify the DNS server IP-s"
|
||
|
read -p "DNS [1-6]: " -e -i 6 DNS
|
||
|
if [[ "$DNS" = '6' ]]; then
|
||
|
echo "Please leave a space between DNS IP entries"
|
||
|
read -e -p "Specify the DNS server IP-s. Space is the separator: " OWNDNS
|
||
|
else
|
||
|
echo ""
|
||
|
fi
|
||
|
|
||
|
# DNS
|
||
|
case $DNS in
|
||
|
1)
|
||
|
# Obtain the resolvers from resolv.conf and use them for OpenVPN
|
||
|
grep -v '#' /etc/resolv.conf | grep 'nameserver' | grep -E -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | while read line; do
|
||
|
echo "push \"dhcp-option DNS $line\"" >> ./server.conf
|
||
|
done
|
||
|
;;
|
||
|
2)
|
||
|
echo 'push "dhcp-option DNS 8.8.8.8"' >> ./server.conf
|
||
|
echo 'push "dhcp-option DNS 8.8.4.4"' >> ./server.conf
|
||
|
;;
|
||
|
3)
|
||
|
echo 'push "dhcp-option DNS 208.67.222.222"' >> ./server.conf
|
||
|
echo 'push "dhcp-option DNS 208.67.220.220"' >> ./server.conf
|
||
|
;;
|
||
|
4)
|
||
|
echo 'push "dhcp-option DNS 129.250.35.250"' >> ./server.conf
|
||
|
echo 'push "dhcp-option DNS 129.250.35.251"' >> ./server.conf
|
||
|
;;
|
||
|
5)
|
||
|
echo 'push "dhcp-option DNS 74.82.42.42"' >> ./server.conf
|
||
|
;;
|
||
|
6)
|
||
|
for i in `echo $OWNDNS|tr " " "\n"`;
|
||
|
do
|
||
|
echo 'push "dhcp-option DNS '"$i"'"' >> ./server.conf
|
||
|
done
|
||
|
;;
|
||
|
esac
|
||
|
cat ./server.conf
|
||
|
rm -f ./server.conf
|