Changes for FR #897

Support For DHCP IP Reservation

Main:
  - added If statement to skipp SetStaticIPv4 if dhcpRserv=1

getStaticIPv4Settings:
  - Added Whiptail asking if user wants to use DHCP reservation Settings, this will add dhcpReserv and
    skip setStaticIPv4 while still logging everything.
ConfigExample files:
  - Added staticReserv=0 to config examples. so it can be used with Unattended install
    * 0 means static ip will be setup.
    * 1 means DHCP Reservation will be used and no chage will be made to the interfaces
This commit is contained in:
4s3ti 2020-01-07 01:30:17 +01:00
parent 5cea5bddf8
commit b9f237fe92
4 changed files with 81 additions and 39 deletions

View file

@ -5,7 +5,26 @@ patch release notes.
Everytime Test branch is merged into master, a new entry should be created with the date and changes being merged. Everytime Test branch is merged into master, a new entry should be created with the date and changes being merged.
##Jan 6th 2020 ## Jan 7th 2020
Changes for FR #897
Support For DHCP IP Reservation
Main:
- added If statement to skipp SetStaticIPv4 if dhcpRserv=1
getStaticIPv4Settings:
- Added Whiptail asking if user wants to use DHCP reservation Settings, this will add dhcpReserv and
skip setStaticIPv4 while still logging everything.
ConfigExample files:
- Added staticReserv=0 to config examples. so it can be used with Unattended install
* 0 means static ip will be setup.
* 1 means DHCP Reservation will be used and no chage will be made to the interfaces
Updated LatestChanges
## Jan 6th 2020
* Removed Unecessary pipe on availableInterfaces * Removed Unecessary pipe on availableInterfaces
* Changed OS Support messages accross the script * Changed OS Support messages accross the script
@ -36,7 +55,7 @@ Everytime Test branch is merged into master, a new entry should be created with
- the script now checks for hostname length right at the beginning and prompts for a new one. - the script now checks for hostname length right at the beginning and prompts for a new one.
- HOST_NAME to host_name, as best practice variables with capitals, should be used by system variables only. - HOST_NAME to host_name, as best practice variables with capitals, should be used by system variables only.
* fixed ubuntu 18.04 being detected as not supported OS, now fully supported and tested. * fixed ubuntu 18.04 being detected as not supported OS, now fully supported and tested.
* changed how scripts are copied to /opt/pivpn, it hat a lot of long repetitive lines, now it copies all *.sh files making it easier to manage when adding new scripts/features * changed how scripts are copied to /opt/pivpn, it hat a lot of long repetitive lines, now it copies all `*.sh` files making it easier to manage when adding new scripts/features
* Changed how supported OS are presented when maybeOS_Support() is called. * Changed how supported OS are presented when maybeOS_Support() is called.
## Sept 1st 2019 ## Sept 1st 2019

View file

@ -166,8 +166,10 @@ main(){
avoidStaticIPv4Ubuntu avoidStaticIPv4Ubuntu
else else
getStaticIPv4Settings getStaticIPv4Settings
if [ $dhcpReserv -ne 1 ] || [ -z $dhcpReserv ]; then
setStaticIPv4 setStaticIPv4
fi fi
fi
# Choose the user for the ovpns # Choose the user for the ovpns
chooseUser chooseUser
@ -636,6 +638,23 @@ getStaticIPv4Settings() {
fi fi
local ipSettingsCorrect local ipSettingsCorrect
# Some users reserve IP addresses on another DHCP Server or on their routers,
# Lets ask them if they want to make any changes to their interfaces.
if (whiptail --backtitle "Calibrating network interface" --title "DHCP Reservation" --yesno \
"Are you Using DHCP Reservation on your Router/DHCP Server?
These are your current Network Settings:
IP address: ${IPv4addr}
Gateway: ${IPv4gw}
Yes: Keep using DHCP reservation
No: Setup static IP address
Don't know what DHCP Reservation is? Answer No." ${r} ${c}); then
dhcpReserv=1
echo "dhcpReserv=${dhcpReserv}" >> /tmp/setupVars.conf
echo "IPv4addr=${IPv4addr%/*}" >> /tmp/setupVars.conf
echo "IPv4gw=${IPv4gw}" >> /tmp/setupVars.conf
else
# Ask if the user wants to use DHCP settings as their static IP # Ask if the user wants to use DHCP settings as their static IP
if (whiptail --backtitle "Calibrating network interface" --title "Static IP Address" --yesno "Do you want to use your current network settings as a static address? if (whiptail --backtitle "Calibrating network interface" --title "Static IP Address" --yesno "Do you want to use your current network settings as a static address?
IP address: ${IPv4addr} IP address: ${IPv4addr}
@ -687,6 +706,8 @@ It is also possible to use a DHCP reservation, but if you are going to do that,
done done
# End the if statement for DHCP vs. static # End the if statement for DHCP vs. static
fi fi
# End of If Statement for DCHCP Reservation
fi
} }
setDHCPCD(){ setDHCPCD(){

View file

@ -1,4 +1,5 @@
IPv4dev=eth0 IPv4dev=eth0
staticReserv=0
install_user=pi install_user=pi
VPN=openvpn VPN=openvpn
pivpnPROTO=udp pivpnPROTO=udp

View file

@ -1,4 +1,5 @@
IPv4dev=eth0 IPv4dev=eth0
staticReserv=0
install_user=pi install_user=pi
VPN=wireguard VPN=wireguard
pivpnPORT=51820 pivpnPORT=51820