IP addresses best practices - static or dynamic?

For whatever reason, IP addresses of multiple of my devices shifted by one (what was 192.168.0.100 is now 192.168.0.101). I had to manually change many devices in HA config.yaml.

What is the best practice here? Manually assign each device a static IP on the router? I do have the RPi that HA runs on set to static, but the thought of doing this for all of my devices is kinda daunting.

Any suggestions? Thanks!

if you lost router, you will lost all devices (they will release leased ips).
So for reliability, it’s best to set IP in device.
For management comfort probably setting leases for mac addresses might be an option.

BTW on this forum you can find past discussions about that

I use DHCP but have an edgemax router and can static map mac address to IP address. I have tried static and it causes problems on some hardware but is “required” by others. The mapping through the router has never failed me. I have a ubiquity cloud server and it allows visualization of the Access Point (AP) utilization. I also have two ubiquity switches (one poe) and will eventually change my other 2 switches to ubiquity. The setting of a static map makes it simple to see what is running. I have a supermicro server that I run HA on as a virtual machine. I use one of the ethernet ports for virtual HASS and one for the operating system. I am a 100% linux shop for servers and desktops and have both Android and IPad tablets. Everytime I add a device, I add the static mapping to the router regardless of the function.

I also use a combination of Z-Wave switches, shelly switches, ecobee and MyQ. I have about 70 devices shared across two subnets and about 90 z-wave devices.

This has worked for me on both my original HA software (Homeseer) and on my conversion to Home Assistant from HomeSeer. If your router supports mapping it is definitely the way to go from my perspective.

Yes I have searched prior to asking, most of these were about setting static IP to the HA host. Thanks.

Static, and they should be setup in this order if available:

1-At the device if that option exists
2-At the router where the MAC address is mapped to a specific IP

I use both

HA has a Static IP ( so I can find it)

and anything else i want to find

so I set the DHCP to have a Range

???.???.???.10 → ???.???.???.239

I give my access points printer NAS a number under 10

HA and HA stuff above 239

so HA has 240
my zigbee has 252

in the my HA time I have had 3 routers

1st provider one that had shit WIFI

2rd pfsense on old PC That was a f…in leaning thing the PC die

now on a

unifi security gateway
and I be upgrading hole network to unifi stuff

Use DNS - then if the ip address changes it doesn’t matter.

This has been part of IP networking for many years.

2 Likes

it depends on your network.
size? if it’s small (few devices) static at the device should be no problem
if it’s large, for a home network, use static DHCP assignments.
it also depends on what device is handing out DHCP address’s.
is it something you own, or your internet provider? what capabilities it has.

you maybe mean mdns. But not all devices supports it. And again, if your device providing translation gets offline you lost all devices at all.

It’s all about being able of answering a question “what if something happened”. How devices will behave? Will be needed to reset them one by one after network recovery? How quick you can recover the system? How long outage you or your familly can afford. IMO people ask such questions because they don’t know consequences of particular choices.

No I mean DNS.

so really don’t know how it can help. dns provides name-ip translation. if ip changes and you don’t know new one… how dns can help?

Because if you use, say, dnsmasq then your dns server will know what IP address is allocated to each device and give the right answer.

ahhh, dnsmasq is not the dns. it’s several services (incl dhcp and dns) in one package.
Then it has all attributes I noted about mapping static ips in dhcp.

that doesn’t help my case though - as I said, problem is, sometimes the DHCP server bumps up the IP adresses by 1, making all IP-based entities invalid.

It’s my own TP-Link Archer AX10, it does have manual static IP assignment. It’s 28 devices and not all of them need to be addressed by IP, I think I can do it by hand. Thanks!

Thanks for your answers! My question was more like: is it even okay to set devices as static? Won’t some devices refuse to work or work intermittently with static IP?

Other than that, I’ll probably just go to my router DHCP settings and make the current IPs static. Many if not most of those devices do not provide a way to set static IP on their own.

Thanks!

Absolutely use static IP’s, just watch out for router’s DHCP range. Define a smaller window for Router’s DHCP so that you’ll have a space for your static IP’s. You reserve, say, 100 to 150 for static IP’s and set in your router IP range from 151 forward for DHCP. So both IP ranges won’t overlap each other.

Sorry, but no, it should be router first.
The DHCP might send additional configuration info, and at the very least the DNS configuration.

That and the headache of limiting the dhcp range to account device-based static IPs.
Much, much easier to centralize that at the router level than on each and every devices.

Additional bonus if you’re using dnsmasq both as dhcp and as a dns forwarder is that it creates “internal dns” entries (e.g. myrpi.lan), so you don’t have to bother with IP’s at all.

It’s true that when you change router (as I had to do three times in the last two years), your config is gone, so setting on device would be better but it’s not something things like wifi bulbs can do.

Not when you buy your routers explicitly to put openwrt on it.
Then you keep your config :wink: