mirror of
https://github.com/Nyr/openvpn-install.git
synced 2024-11-23 21:46:08 +03:00
(#889) Adds Custom DNS Choice.
This commit is contained in:
parent
e4a9a310eb
commit
6785da1f99
@ -125,7 +125,7 @@ if [[ ! -e /etc/openvpn/server/server.conf ]]; then
|
||||
[[ -z "$ip_number" ]] && ip_number="1"
|
||||
ip=$(ip -4 addr | grep inet | grep -vE '127(\.[0-9]{1,3}){3}' | cut -d '/' -f 1 | grep -oE '[0-9]{1,3}(\.[0-9]{1,3}){3}' | sed -n "$ip_number"p)
|
||||
fi
|
||||
# If $ip is a private IP address, the server must be behind NAT
|
||||
# If $ip is a private IP address, the server must be behind NAT
|
||||
if echo "$ip" | grep -qE '^(10\.|172\.1[6789]\.|172\.2[0-9]\.|172\.3[01]\.|192\.168)'; then
|
||||
echo
|
||||
echo "This server is behind NAT. What is the public IPv4 address or hostname?"
|
||||
@ -190,11 +190,17 @@ if [[ ! -e /etc/openvpn/server/server.conf ]]; then
|
||||
echo " 4) OpenDNS"
|
||||
echo " 5) Quad9"
|
||||
echo " 6) AdGuard"
|
||||
echo " 7) Custom DNS"
|
||||
read -p "DNS server [1]: " dns
|
||||
until [[ -z "$dns" || "$dns" =~ ^[1-6]$ ]]; do
|
||||
until [[ -z "$dns" || "$dns" =~ ^[1-7]$ ]]; do
|
||||
echo "$dns: invalid selection."
|
||||
read -p "DNS server [1]: " dns
|
||||
done
|
||||
|
||||
if [[ "$dns" == "7" ]]; then
|
||||
read -p "Enter your custom DNS server: " custom_dns
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Enter a name for the first client:"
|
||||
read -p "Name [client]: " unsanitized_client
|
||||
@ -321,6 +327,9 @@ server 10.8.0.0 255.255.255.0" > /etc/openvpn/server/server.conf
|
||||
echo 'push "dhcp-option DNS 94.140.14.14"' >> /etc/openvpn/server/server.conf
|
||||
echo 'push "dhcp-option DNS 94.140.15.15"' >> /etc/openvpn/server/server.conf
|
||||
;;
|
||||
7)
|
||||
echo "push \"dhcp-option DNS $custom_dns\"" >> /etc/openvpn/server/server.conf
|
||||
;;
|
||||
esac
|
||||
echo 'push "block-outside-dns"' >> /etc/openvpn/server/server.conf
|
||||
echo "keepalive 10 120
|
||||
|
Loading…
Reference in New Issue
Block a user