Did something bad/stupid - manually changed IP address

Noobie here and I’m going to apologize in advance for my lack of knowledge and ignorance. I have had an HA instance running on a rpi400, and I planned to migrate it to an rpi4. In advance of doing this I decided to change my IP address from DHCP to static, and I picked what I believed was an unused address in range. (I watched a YouTube video… I know…) I made the change from a web browser running Home Assistant. I changed only the IPv4 IP address and left the gateway and DNS server addresses unchanged. After rebooting the rpi400, I cannot access the HA instance from 192.xxx.xxx.xxx:8123 with the new IP address. (message is: “Safari can’t open the page because the server where this page is located isn’t responding”). If I ping the IP address from a terminal window I get responses, so something is there! When I connect a monitor to my rpi400 and reboot, everything seems to reboot just fine with no errors. In the system information it shows the IPv4 address to be the new static one that I changed it to. But I cannot access HA from a web browser or an IOS or Android application. Does anyone have any ideas on how I can rescue my HA instance? Thank you!

Do you know the address you used? If so, the easiest might be to manually set the address on your laptop to something on the same subnet (eg increment the address, rpi400 is 192.168.17.11/24 and set the laptop to 192.168.17.12/24). If not, you might be stuck using direct access by connecting a keyboard and “monitor” (HDMI TV will do) to directly connect and reset the IP.

Thanks for the quick response, Ian! Are you saying that if my laptop is on the same subnet then I should be able to access the instance? I will try that. I do have a keyboard and monitor attached to my rpi400. I don’t know how to reset the IP with direct access (and maybe I should change it back to DHCP?)

As long as you are using IPs and not relying on DNS, TCP/IP is fairly simple to get two devices communicating as long as they are on the same subnet and you know the IP addresses. It is generally best if you can set up a dedicated hub/switch or crossover cable to fix things. If you are using an existing ethernet or wifi network then you run the risk of clashing with existing addresses.

I don’t know the terminal direct commands to switch back to DHCP. That should be fairly simple. Looks like Common Tasks - Operating System - Home Assistant would be somewhere to start on that.

I set the IP address of my laptop to an IP on the same subnet (I tried a few different ones in case they were already being used) and I was still not able to access the HA instance. So I think I did create an IP conflict when I selected the static HA IP. I’ll check if I have a switch to connect the laptop and rpi400 directly. Thanks for the Home Assistant Common Task list - it’s not obvious from that list how to change the IP address, but I’ll dig further. As you said, that will probably be the easiest if I can figure out how to do it. Your inputs are much appreciated!

On the command line, “ha network info” should show the current setup.

I think " ha network update --ipv4-method auto" will set the interface back to DHCP. “ha network info” should give you the interface name. In my case, it is enp6s0 on a virtual machine, but it will depend on your hardware.

2 Likes

OMG you are a lifesaver! Thank you so much - that worked! I was afraid I had lost a lot of work. I owe you a beer (or two!). In the future I am going to be way more careful about changing IP addresses.

In order to close out this thread (in case I am not the only idiot that randomly changes IP addresses), the command I needed was:

ha> network update eth0 --ipv4-method auto

2 Likes

For future users having this issue, another simple solution not requiring a screen and keyboard would have been to connect to the web interface of the router (= gateway) and look at the DHCP leases, then look at the name of the equipment carrying the IP address in conflic (in classic domestic setup there is a high chance that everything will be configured with DHCP so all your network equipments should be here :slightly_smiling_face:).
This will help you identify which equipement is in conflic, so that you can manually turn it off. After that, HA should immediately be back online (or may need a last reboot to be sure).

1 Like

Thank you for posting your solution! That will help others in the future.

Did you confirm that it was an IP address conflict, or was it something else?

One way to avoid conflicts is to set static IP addresses (reservations) in your router. The devices still use DHCP but always get the same address, and that address can’t be given out to a different devices. This is very useful for anything with a web interface, like a printer.

1 Like

Thanks, good idea!

Thanks Tom. So… I did go into my router and look at the IP addresses at everything that is connected and there is no conflict at the IP that I chose to use (the one that caused issues.) So now I am not sure what the problem was!

Here’s what I was aiming to do (and would still like to): I am migrating from an rpi400 to an rpi4. I have several devices/integrations that requested the IP address of the host when I set them up. In order to avoid setting up those devices again after the migration, I thought I would change the IP address of my original rpi400 to something new, and then use the original IP address for my new rpi4.

It seems that your suggestion to reserve a static IP addresses in the router would be a good solution. First I would still need to move the original rpi400 onto a new IP address to avoid a conflict (or of course I could just take it offline, but I want to keep it running as a backup until I know I have a new stable instance.)

Migration complete and all working now. I manually changed the IP address of the new rpi4 to the original IP address (no problems setting a static IP this time, although I did disable ipv6 which I didn’t do previously) and then restored the backup from the rpi400. All sensors and integrations are working. Thanks again all!

2 Likes

I apologize that my post had some formatting issues and didn’t show properly. I’m glad that you were able to figure out the solution from the info I provided. It looks like some others provide some great suggestions.

No apologies! You pointed out the command I needed and from then it was pretty easy to check the correct syntax for it. Been working great ever since. Of course I now have some new minor issues but that is the nature of building an HA dashboard!