Fixing DietPi IP Settings

I installed and setup DietPi and had it all up and running, configured, set the way I thought I wanted it. Then a few days later I realized I had set a static IP address that was not going to work as it was conflicting with an address of another device that was not always connected.

I SSH’d into the device and ran the config to change the IP address. Everything seemed to go fine, but when the device rebooted I could no longer access it. I checked my router and I can see the IP show up there, there are no other devices conflicting with that IP address, but I just cannot remotely access the Pi. I truly hate to have to reload the image again because I had OwnCloud and Ampache set up on it along with Syncthing and everything was working perfectly. Well, until I goofed it up.

Is there any way I can take the SD card and modify the settings without having to reinstall the image and wipe everything out? I just need to get the thing set from a static IP to a Dynamic. If I can do that every would be fine.

Well, I have tried to find where it is storing the static IP’s at. I have looked at the dietpi.network file and the dietpi\conf\network_interfaces file and have come up empty with trying to assign a new IP address so I can get into the device. So either I am doing it wrong or the static IP is stored in some file elsewhere that I cannot access directly on the SD card.

So I will leave it there and hope someone here can point me in the right direction. Ultimately I would just like to set it to DHCP so that when it boots it will grab and IP so I can SSH in. I see the static IP I set up show up in the router when I boot but it wont let me SSH into the device

In the dietpi.network file it has

0
0
eth0
10.0.0.5

But that is not even the IP in use, but it is the one I change it from. It was 10.0.0.5 and I changed the static IP to 10.0.0.10 which is the address I see show up in the router. It’s like it has two different IP’s set which, of course, is not going to work. Any help is much appreciated.

I thought I would add one other detail just in case. When I boot the device and I see the IP address show up in the router, it is associated with the correct MAC address.

I had one last idea. I tried a cross-over cable and no joy there either. I am officially out of ideas.

Can you SSH to the device by using its name as opposed to the IP address?

What happens if you ping the IP address from another computer?

The settings are in /etc/network/interfaces - you may be able to edit this and fix it.

John

No, cannot SSH into the device at all.

If I ping the current address that shows up in the router (10.0.0.10) it returns Timed Out. If I ping the old address (10.0.0.5) it tells me something different but exactly what now, I cannot recall at this moment. Something along the lines it cannot connect or something like that. It gave me the impression it could reach the old IP just could not get a response back is the best way I know to describe it at the moment.

I was hoping to do exactly as you suggested and get to the interfaces file and change the IP address or at least set it from static back to DHCP. As I mentioned earlier I can see the file dietpi\conf\network_interfaces on the SD card itself, but changing it had no effect. I do not know if DietPi is configured the same as I never dug into it, but on the OEM raspbian image, changing the interfaces file has no effect. You have to set a static IP in the dhcpcd.conf file I believe it is, and I see no such file on the DietPi SD card.

I really, really hate to have to reload that thing as I had my external drive all set up to hold all the files for owncloud, Ampache, etc.

There is no other IP address on my network close to either 10.0.0.10 or 10.0.0.5 so there is some kind of internal conflict on DietPi that I am unable to change.

I know when you are setting up the config you can copy the current IP settings to a static configuration, but then you can also set a static IP manually and the first time I just copied current setting to the static IP. When I had to change the static IP I did so manually, but everything else stayed the same. The gateway, the subnet mask, etc. So I am not sure what exactly went wrong.

Is there some kind of configuration file that DietPi grabs configs from before letting the kernel, etc. take over? Anything, any file at all I can change that would make it reset the IP address or something like that?

DietPi pulls this information from the system and stores it in that file. Thats the current IP address being used by the system.

Is there some kind of configuration file that DietPi grabs configs from before letting the kernel, etc. take over? Anything, any file at all I can change that would make it reset the IP address or something like that?

DietPi-Config network settings are stored in /etc/network/interfaces file as John already mentioned above.

We really need to see the contents of /etc/network/interfaces. A simple way would be to plug a monitor/keyboard into the system, login, then run the following command and take a picture:

cat /etc/network/interfaces

OH. MY. GOD!!! :open_mouth:

I almost feel like paying one of you to come slap the ever lovin’ crap out of me!

I COMPLETELY spaced the fact the silly thing came with an HDMI cable that I could hook up to my desktop. I had gotten so used to using SSH that in my head that was the only way to access it. Uggg.
I am so, so sorry for wasting everyone’s time.

I hope you all will forgive me. I kept reading the replies and each time thought, do they understand I cannot get to this thing, I have no way to access it and need to modify the config directly on the SD card. I seriously need to go stick my head in the sand in shame.

So, I hooked it up to my desktop, ran the dietpi-config, switched eth0 from static back to DHCP, rebooted and wouldn’t you know it, it automagically worked. That said, DHCP assigned it back to an IP address of 10.0.0.5. However, the interfaces file had this:

#/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 dhcp
metric 0
address 10.0.0.10
netmask 255.255.255.0
gateway 10.0.0.1
#dns-nameservers 8.8.8.8 8.8.4.4

# Wifi
#allow-hotplug wlan0
iface wlan0 inet dhcp
metric 1
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

The interesting thing, however, is even after I switched it back to DHCP, it retained those addresses. It did not update the file with the new DHCP addresses. I went ahead and manually set the address back to the default of 192.168.0.100. Then went ahead and set a DHCP Reservation address in the router so I don’t have to worry about that mess again.

Again, I am deeply sorry for not using my noggin and realizing I could have settled all this moments after it occurred.

I COMPLETELY spaced the fact the silly thing came with an HDMI cable that I could hook up to my desktop. I had gotten so used to using SSH that in my head that was the only way to access it

Lol, no worries. I’ve done the same thing once or twice :wink: Couldn’t live without SSH, get so used to it :smiley:

iface eth0 inet dhcp
however, is even after I switched it back to DHCP, it retained those addresses

So it looks like your router DHCP reservations are still in effect, or, the DHCP lease that the router provides hasn’t timed out yet.
There should be a lease time setting somewhere in the web interface, either way, might be worth rebooting the router, should clear that.