From 9c7324565720f75349e38973f50bee38cc374087 Mon Sep 17 00:00:00 2001 From: Alessandro Partesotti Date: Mon, 24 Apr 2023 17:33:54 +0200 Subject: [PATCH] Update script to select custom lan network --- openvpn-install.sh | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/openvpn-install.sh b/openvpn-install.sh index c47e08f..deb7ed8 100755 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -310,6 +310,24 @@ function installQuestions() { PROTOCOL="tcp" ;; esac + until [[ $LAN_IP =~ "" ]]; do + + echo "Do wou want to specify a custom LAN network an subnet?" + echo " 1) NO (will use 10.8.0.0 and 255.255.255.0)" + echo " 2) YES" + until [[ $LAN_IP_CHOICE =~ ^[1-2]$ ]]; do + read -rp "Choice [1-2]: " -e -i 1 LAN_IP_CHOICE + done + case $LAN_IP_CHOICE in + 1) + $LAN_IP = "10.8.0.0" + $LAN_SUBNET_MASK = "255.255.255.0" + ;; + 2) + read -rp "IP NETWORK (e.g. 192.168.4.0): " -e -i 1 LAN_IP + read -rp "SUBNET (e.g. 255.255.255.0) : " -e -i 1 LAN_SUBNET_MASK + ;; + esac echo "" echo "What DNS resolvers do you want to use with the VPN?" echo " 1) Current system resolvers (from /etc/resolv.conf)" @@ -782,7 +800,7 @@ persist-key persist-tun keepalive 10 120 topology subnet -server 10.8.0.0 255.255.255.0 +server $LAN_IP $LAN_SUBNET_MASK ifconfig-pool-persist ipp.txt" >>/etc/openvpn/server.conf # DNS resolvers