Make a guess at what the static IP should be

This commit is contained in:
Bob Mottram 2016-10-22 20:33:36 +01:00
parent d03a95db5c
commit d47b2b6b1c
1 changed files with 7 additions and 4 deletions

View File

@ -1257,13 +1257,16 @@ function change_system_name {
}
function set_static_IP {
STATIC_IP='192.168.1.60'
STATIC_GATEWAY='192.168.1.1'
IPv4_address=$(get_ipv4_address)
IPv4_address_base=$(echo "$IPv4_address" | awk -F '.' '{print $1"."$2"."$3}')
STATIC_IP="${IPv4_address_base}.60"
STATIC_GATEWAY="${IPv4_address_base}.1"
NEW_STATIC_IP=
NEW_STATIC_GATEWAY=
if grep -q 'iface eth0 inet static' /etc/network/interfaces; then
STATIC_IP=$(cat /etc/network/interfaces | grep "address " | awk -F ' ' '{print $2}' | head -n 1)
STATIC_GATEWAY=$(cat /etc/network/interfaces | grep "gateway " | awk -F ' ' '{print $2}' | head -n 1)
STATIC_IP=$(cat /etc/network/interfaces | grep "address " | head -n 1 | awk -F ' ' '{print $2}')
STATIC_GATEWAY=$(cat /etc/network/interfaces | grep "gateway " | head -n 1 | awk -F ' ' '{print $2}')
fi
# get the IP for the box