Unable to change Ethernet static IP address from previous.

Still running v139 which I restored from backup, though this also occurred on v140. What I’m trying to do is expand my subnet from the current /28 to a /27. The only change I need to make is to update the subnet mask from 255.255.255.240, to 255.255.255.224.

When I update that in dietpi-config, though, it looks alright but then tells me the interface is already configured:

Reconnecting Ethernet , please wait

DietPi-Services
─────────────────────────────────────────────────────
Mode: stop
Please wait…

[Ok] cron
[Ok] proftpd
[Ok] lighttpd
[Ok] php5-fpm
[Ok] mysql
[Ok] dnsmasq
[Ok] subsonic
[Ok] fail2ban
[Ok] openvpn

[Info] Dropping connections, please wait…

DietPi-Set_Hardware
─────────────────────────────────────────────────────
Mode: wifi (disable)
Please wait…

[Ok] wifi disable | Completed

\

  • Restarting networking services…
    ifup: interface eth0 already configured

What’s odd is, my /etc/network/interfaces file does show the new subnet:

root@DietPi:~# cat /etc/network/interfaces
#/etc/network/interfaces
#Please use DietPi-Config to modify network settings.

Local

auto lo
iface lo inet loopback

Ethernet

allow-hotplug eth0
iface eth0 inet static
address 172.17.50.14
netmask 255.255.255.224
gateway 172.17.50.1
dns-nameservers 127.0.0.1

Wifi

#allow-hotplug wlan0
iface wlan0 inet dhcp
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
wireless-essid Not_Set
wireless-key Not_Set
wireless-mode Managed
wireless-power off
wpa-ssid Not_Set
wpa-psk Not_Set
#dns-nameservers 8.8.8.8 8.8.4.4

ifconfig, however, doesn’t:

root@DietPi:~# ifconfig
eth0 Link encap:Ethernet HWaddr b8:27:eb:a1:73:c2
inet addr:172.17.50.14 Bcast:172.17.50.15 Mask:255.255.255.240
inet6 addr: fe80::ecf0:3f4b:7cb1:2ef4/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5982 errors:0 dropped:22 overruns:0 frame:0
TX packets:3816 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1340944 (1.2 MiB) TX bytes:946982 (924.7 KiB)

Something isn’t matching up here but I’m not sure it won’t accept the new config.

Hi,

It appears DietPi-Config is correctly setting those values to the network config file, but yes, strange they are now being activated on the system.
If not done already, It may be worth trying a reboot to see if the changes are applied correctly then.

dns-nameservers 127.0.0.1

Also, your DNS server is pointing to localhost, not sure if that was intentional? Ideally, should be pointing to an external source (eg: router, google DNS etc 8.8.8.8)

Hi,

your ip configuration looks fine, except DNS.
161223-0001.gif
… and after a reboot, please have a look on:

:~# cat /DietPi/dietpi.txt

...
# >> Networking Options -----------------------------
#If both Ethernet and Wifi are enabled, Wifi will take priority and Ethernet will be disabled.
#   1=enabled
Ethernet_Enabled=1
Wifi_Enabled=0

#Enter your Wifi details below, if applicable (Case Sensitive).
Wifi_SSID=FuzonWifi
Wifi_KEY=MyAccessKey

#Enter your Static Network details below, if applicable.
Use_Static=1
Static_IP=172.17.50.14
Static_Mask=255.255.255.224
Static_Gateway=172.17.50.1
Static_DNS=172.17.50.1 8.8.4.4
....

and

:~# ip a | grep eth0

Happy holidays!

Unfortunately, still no luck. Basically it seems as though any changes made to /etc/network/interfaces are being ignored on boot, but I can’t for the life of me figure out what’s overriding them.

I don’t have NetworkManager installed, as I read that can sometimes ignore the interfaces file.
Added info into /etc/dhcpd.conf (which had previously been empty) thinking maybe that might do it.
Updated my pihole setupVars.conf with the new CIDR mask thinking that might help.
Confirmed the interfaces file and DietPi.txt both have the same values.
Tried a sudo ifdown --force eth0 && ifup --force eth0.
Tried sudo service networking restart, and several reboots.

Every time, the IP address refuses to change. When I modified the dnsmasq configuration to expand the DHCP address range, that stopped functioning since it said the range was invalid based on the subnet (which it would be if it’s still stuck on /28), so changed that back. Oh and I also set the DNS in the interfaces file to Google’s, and added the broadcast line, and auto eth0 above allow-hotplug, all to no avail.

Question: Where does dietpi-config pull it’s “Current information” from? It’s on that screen where it still lists my 255.255.255.240 original subnet, with what I want to change it to below.



ip r
ifconfig



				ETH_IP=$(ifconfig eth$ETH_INDEX | grep -m1 'inet' | awk '{ print $2 }' | sed 's/addr://g')
				ETH_GATEWAY=$(ip r | grep -m1 'default' | awk '{ print $3 }')
				ETH_MASK=$(ifconfig eth$ETH_INDEX | grep -m1 'inet' | awk '{ print $4 }' | sed 's/Mask://g')
				ETH_DNS=$(cat /etc/resolv.conf | grep -m1 nameserver | awk '{print $2}')



auto eth0 above allow-hotplug

auto isnt required, allow-hotplug assumes “auto”

Basically it seems as though any changes made to /etc/network/interfaces are being ignored on boot

Try updating SystemD with the new config before reboot:

systemctl daemon-reload

On a fresh C2 install, i changed subnet mask to .128. Appears to be working for me at least:


Here is my interfaces file:

#/etc/network/interfaces
#Please use DietPi-Config to modify network settings.

# Local
auto lo
iface lo inet loopback

# Ethernet
allow-hotplug eth0
iface eth0 inet static
address 192.168.0.112
netmask 255.255.255.128
gateway 192.168.0.1
dns-nameservers 192.168.0.111

# Wifi
#allow-hotplug wlan0
iface wlan0 inet dhcp
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
wireless-essid Not_Set
wireless-key Not_Set
wireless-mode Managed
wireless-power off
wpa-ssid Not_Set
wpa-psk Not_Set
#dns-nameservers 8.8.8.8 8.8.4.4

Lets check interfaces file isnt a symlink.

ls -lha /etc/network/interfaces

Aside from that, I can only suggest trying a fresh install, setting the mask and seeing if problems persist.
Also which device are you running?