Fixed IP address for Home assistant

Depending on your host processor, there is almost always a method to pause the boot process until the network is on line.

Mine did, which is why I have a new router. I don’t have many devices with a permanent lease (static IP) in the router so every one of the DHCP devices came back online just fine. Amazingly, the few router-managed static devices came back online using their prior IP assignments. All I had to do was to reserve their IP’s to static in the new router.

Interesting discussion, I’m surprised nobody is doing it the way I do it… :thinking:

In the good old days, before HA and IoT devices, I handled all my devices via the DHCP of my router (FritzBox for to many years) and never had a thought about doing it in any other way.

With new devices come new problems, so my solution was, do it both. So my way right now is this:

  • setup new device, eg in ESPHome, without any IP settings
  • let the router give it an IP address
  • set this address to permanent in the router
  • change the config of the device and set there the already reserved IP from the router
  • set the other IP settings like DNS as well on the device

This way, at least that’s my understanding, I have the advantages of both worlds. I always have the correct IP address, no matter what starts first, I can be sure the IP isn’t assigned anywhere else, I don’t need to keep tabs on anything (spreadsheets :rofl:) and last but not least, it’s like a little backup. What are the chances of all ESP config getting lost and all router backups at once? :smiley:

But as I’m the only one, doing it this way, maybe I’m totally wrong. So please say something, if this is a bad idea, that I’m doing here for the last few years. :smiley: :slight_smile:

1 Like

I just use DHCP static IP assignment. On the other hand I dont have a lot wifi devices as I migrated most of my smart devices to zigbee. And I’m using a cheap xiaomi routers.
It will be great to use something like unify but on the end of the road it does requires lan connections around house and I don’t have it.

You’re assuming that they are both running on the same box…(which they aren’t for me)

I personally think, Unifi is way overrated. Don’t invest that much money in a company, where you can’t be sure what happens next. :slight_smile:

There are a lot of alternatives out there, maybe not that sophisticated in design and colour, but in reality nobody sees these devices anyway. :wink: :rofl:

Doesn’t matter.
If it’s a Linux based host, you can add “After=network.target” to “/lib/systemd/system/dhcpcd.service”. Startup won’t proceed until the network is connected.

It’s still a single point of failure for your entire IoT network. If you your dhcp server goes down, your entire IoT infrastructure takes a nose dive with it. Sure, you can have failovers, etc, but why make things complex that can be really simple.

All my IP connected IoT devices have static IPs hard assigned to them. I keep a spreadsheet and since it’s part of the ‘important stuff’ folder that gets auto-backup’ed to 3 locations, ‘loosing the spreadsheet’ is a non-issue. If my router goes down, I just plug in a new one and done. If yours goes down, you have to get your (hopefully up-to-date) spreadsheet and start spinning up a new DHCP server, import the reservations, etc. And usually these kind of things fail on the least convenient moment when you really don’t have time starting to mess around with this.

1 Like

If your main router goes down your Internet connectivity has gone so that’s still a single point of failure. Your Intranet will be useable and it will remain usable with devices with router assigned IP’s too as the leases won’t expire for quite some time.

As much as anything this is just a personal preference and both work.

1 Like

Funny conversation. I have always been in the fixed IP world. And I remain so.
For instance … today I was putting some new wiring in my house and had to throw the breaker (I a’int that adventurous to wire live like my dad would).

Turns out the breaker I had to through was on the Starlink router.

Everything comes back … except two devices. Both got new IPs. And because of the way the integration in HA is written, I have to delete both of them (Broadlink RM Pro devices) and re-add them.

And before you tell me I can fix that by reserving addresses … I could if I wanted to take my entire network to alternate router. Starlink AFAIK = no way to reserve anything nor even change it from 192.168.1.1 … period.

So, before you shout out how you have the best solution, just remember … not everyone has your setup. Can everyone of them be better? Sure … but at what time cost.

2 Likes

Just run the dhcp elsewhere :thinking:

Not quite. That just means the interface will be up. You need to use network-online.target and YMMV.

https://systemd.io/NETWORK_ONLINE/

I follow a hybrid strategy.

Some very core systems have static IPs — including my HA server. The rest are DHCP.

I run DHCP on my HA server. If either goes down things are screwed anyway, so may just as well run it together. Both are critical, so treat it as one.

I make heavy use of reservations. I backup my DHCP reservations and I keep a list of statics. mDNS is useful because I don’t like using IPs in references. It’s opaque when reading other config and such.

3 Likes

Not so easy on HAOS, but I take your point. Some interesting discussions here, but I still hold that a hybrid solution is my preferred option. That and a decent UPS :wink:

I think it’s mostly personal preference and also depends a bit on how your network organization was layed out. I also disabled mdns completely. I’m a very number-style person, I tend to remember IPs better than names :stuck_out_tongue:

That’s generally very good advise. And if I may add to that - and a strategy of clean shutdown when the UPS battery runs low. Had that happen when a tree fell on the powerlines last winter. Took the utility company quite some time to get power back up and my UPS ran out (and the generator isn’t on the same circuit). Not all my devices shut down cleanly. I was a bit messy.

1 Like

Of course, which is why I expressed mine, but conversion seemed like it was creating a false dichotomy, so I wanted to say that you don’t have to choose. Regardless, I’ll always give my main server a static IP.

Some devices that have names that you cannot change which then also get used for mDNS are annoying, but most of the time I can set a lookup that I want and which is easy to use an remember (e.g. pieter-bedside-lamp.lan is pretty easy to work with).

Anyway, all good.

1 Like

Yeah good call, and I’ve absolutely got this configured and ready to go.

(sounds of shuffling and frantic typing in the background)

1 Like

ok, Problem solved, I mean I found where to set a fixed IP (from the Settings → System → Network.
Many thanks !

1 Like

Just as I said … knowing the full situation is important. I take it that you do not own a Starlink router. If you did you would know that you can’t turn off it’s DHCP server. So you can’t run DHCP elsewhere unless you don’t even use the Starlink router and put it on pass through mode. So the only solution is getting YAR “yet another router” and set Starlink into bypass mode which makes it essentially a power supply to the dish. Then you can setup all you need in the other router. Or you can not use bypass and set up second VLAN in the second router from the unchangeable 192.168.1.X from Starlink.

It’s not so much an issue, just more $s is all. Starlink was not designed with a fully functional router where you can turn features on/off or even reserve addresses or set lease times.

I have a fritzbox …