RasPi gets no IP after router change Topic is solved

Having issues with your DietPi installation or found a bug? Post it here.
GreenGentleman
Posts: 53
Joined: Mon Nov 09, 2020 4:10 pm

RasPi gets no IP after router change

Post by GreenGentleman »

Hello!

I switched my router today, now I've got a Fritzbox 7530. With this change, my Pi doesn't get an IP anymore. In my previous network, the Pi handled the DHCP (via Pihole), before switching routers, I disabled it in the Pihole settings, so my new router can "work as intended" before I set everything up again. After I set everything up, I connected the Pi again, and the Fritzbox sees the Pi, but it doesn't assign an IP to it. I tried to assign the old IP manually, but I can't, since it's "Out of range" for the Fritzbox.

Now, I can't access the Pi via SSH (it doesn't get an IP) and to change that, I'd need to SSH into it, which I can't. I tried looking through the files, but I didn't see anything network relevant. What are my options now?
User avatar
trendy
Posts: 343
Joined: Tue Feb 25, 2020 2:54 pm

Re: RasPi gets no IP after router change

Post by trendy »

I find it rather strange to have the Pi soliciting for DHCP, while the DHCP server is running on Pihole. Do I understand correctly that Pihole is running on the very same Pi or do you have a secondary device running Pihole?
If you connect any other device on the new Fritz, does it get automatically settings from DHCP?
GreenGentleman
Posts: 53
Joined: Mon Nov 09, 2020 4:10 pm

Re: RasPi gets no IP after router change

Post by GreenGentleman »

Yes, it's the same Pi. Other devices work fine, it's just the Pi.

I assume the error comes from the static IP that is set in the Pi, which is outside of the range of the addresses the Fritzbox can give.
User avatar
Joulinar
Posts: 5149
Joined: Sat Nov 16, 2019 12:49 am

Re: RasPi gets no IP after router change

Post by Joulinar »

Can you share IP range of your FritzBox as well as STATIC IP of your Raspberry Pi
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
trendy
Posts: 343
Joined: Tue Feb 25, 2020 2:54 pm

Re: RasPi gets no IP after router change

Post by trendy »

Yeah, that clears things up. Pi is using static IP, hence it won't acquire settings from Fritz DHCP.
Keep the Pi connected on the Fritz. From another device, e.g a PC/laptop, either add a secondary IP on the interface in the same subnet as the Pi, or change the address to match the old subnet if you don't know how to add a secondary IP. For example:
If Fritz is offering 192.168.178.X/24 addresses and Pi still has 192.168.1.10/24, then assign to the PC the IP 192.168.1.2/24, access the Pi, change the static IP settings to either DHCP or a static in the 192.168.178.X/24 subnet, and revert the IP of the PC back to 192.168.178.X
GreenGentleman
Posts: 53
Joined: Mon Nov 09, 2020 4:10 pm

Re: RasPi gets no IP after router change

Post by GreenGentleman »

Keep the Pi connected on the Fritz. From another device, e.g a PC/laptop, either add a secondary IP on the interface in the same subnet as the Pi, or change the address to match the old subnet if you don't know how to add a secondary IP. For example:
Thank you, that worked - the Fritzbox assigns an IP to the Pi.

I can't SSH into it, though:

Code: Select all

ssh: connect to host 192.168.2.125 port 22: Connection timed out
Could the problem be that the Pi does have a wrong IP for the router?
User avatar
Joulinar
Posts: 5149
Joined: Sat Nov 16, 2019 12:49 am

Re: RasPi gets no IP after router change

Post by Joulinar »

it might be easier to connect locally to the RPi using keyboard and screen if possible.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
trendy
Posts: 343
Joined: Tue Feb 25, 2020 2:54 pm

Re: RasPi gets no IP after router change

Post by trendy »

GreenGentleman wrote: Fri Jul 09, 2021 5:43 pm Could the problem be that the Pi does have a wrong IP for the router?
Which IP does the router, the Pi, and your PC have?
GreenGentleman
Posts: 53
Joined: Mon Nov 09, 2020 4:10 pm

Re: RasPi gets no IP after router change

Post by GreenGentleman »

Joulinar wrote: Fri Jul 09, 2021 8:00 pm it might be easier to connect locally to the RPi using keyboard and screen if possible.
I think I could do this. I'll go with this if the other approach doesn't work.

Which IP does the router, the Pi, and your PC have?
My PC: 192.168.1.22
Fritzbox: 192.168.178.1
RasPi: 192.168.2.125

Range the Fritzbox can adress:
192.168.1.20 - 192.168.177.200 (Subnetmask 255.255.0.0)
Local DNS Server: 192.168.178.1 (the Fritzbox)
DHCP is activated in the Fritzbox.
Both the RasPi and my PC are on a wired connection with the Fritzbox.
User avatar
Joulinar
Posts: 5149
Joined: Sat Nov 16, 2019 12:49 am

Re: RasPi gets no IP after router change

Post by Joulinar »

why are you going with such a huge IP range? If I'm not mistaken, a netmask of 255.255.0.0 will result in 65536 possible hosts :x

Usually 192.168.178.0/24 should be sufficient.

Fritzbox: 192.168.178.1 (Static)
RasPi: 192.168.178.2 (Static)
Local devices: 192.168.1.20 ff (DHCP)
Netmask 255.255.255.0
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Post Reply