How to enable Home Assistant to find the IP addresses of all my things automatically, when my router is set to reboot every 24 hours?

great! thanks!

not anymore.

so i see. bummer.

Well I don’t want to fan the flame of this heated discussion, but since reserving the IP addresses of all my things (and on this case, just for the sake of testing) keeping everything within the DHCP range (not least because the section to reserve IP addresses is under the section (second entry) of DHCP settings for my router, I am now getting some pretty nonsensical results from a local IP scan of my connected devices? (See attached.) By all accounts I am almost running out of IP addresses to assign to anything new? (Hosts alive 241! I only have about ~30 connected devices).

All equipment connected to HA i’ve given an ip reservation in my dhcp server, so they will always get the same ip number.

If your router does not support dhcp reservation, you can always disable it, and set one up on HA :wink:

# Home Assistant Add-on: DHCP server

@jebus2504 and you can’t increase your netmask to f.e. 255.255.255.252 ??

That would give you 1024 addresses…

https://www.calculator.net/ip-subnet-calculator.html?cclass=any&csubnet=22&cip=192.168.1.1&ctype=ipv4&printit=0&x=82&y=24

After reading the whole thread, my recommendation is to contact TP-Link. Something you’re doing in your configuration is causing issues if you’ve gone through 3 routers.

If these routers all had factory settings and hit these issues day 1, then something on your network is causing these issues with your router. Typically that’s caused by another device attempting to ‘run the network’ with it’s own dhcp server. You can’t have 2 dhcp’s on 1 network without custom configurations.

No, sorry, I don’t have anything like that. I only have one router and nothing else on my network capable of assigning IP addresses. And no it wasn’t a ‘day 1 thing’. It took over a year for my first ISP provided router/modem to crap out. The second ISP provided router didn’t work at all and this is now the 3rd. (Which I have bought). All I did was follow exactly the instructions I was given here.

That doesn’t explain what on earth is happening? Why are so many of my current addresses shown as being in use, when for the majority there’s nothing attached to them?

? My router does support address reservation. Otherwise, how would I have been able to assign reserved addresses as per the above comment?

On windows you could do a command line
arp -a
which will return a list of mac-addresses in the arp-table. I guess there would be something similar on mac?

And the mac-address would allow you to track it to specific device…

Thanks. Sorry. The purpose of which is?

I have access to Windows.

If you know the mac address, you can trace it back to a device…
https://www.macvendorlookup.com/

It could well be a device pulling a new ip number all the time…knowing which device it is will get you a step closer…

And while at it… what is the lease expiration time on dhcp server??
Could well be all numbers are reserved and the buggy device takes a new number every time.
Also on the dhcp-server there should be a list of which mac address reserved which ip…

1 Like

Yesterday, I returned a tp-link AC1750 router ($248AUD of crap that caused all sorts of problems) for a refund. The customer service fellow said they always have problems with routers.

I stick with advice I gave above; switch to OPNsense, a good access point and your troubles will end.
@nickrout Have you switched yet?

No, it is still on the list. Interruption to internet service (even to improve it) breaks EAF (entitled kids who still live at home acceptance factor).

1 Like

You can set up the OPNsense box by plugging the WAN port into your current router because it will use DHCP anyway. Take a pic of the static leases on the old one and once OPNsense is set up with gateway address, WAN, LAN, DHCP range, DNS, anti-virus plugins installed, unplug the old router, plug in the OPNsense box then assign static leases. Change over time is less than a minute.
Surely the bludgers can’t complain about a minutes interruption?

One of the objects of the exercise is to get rid of the isp supplied modem/router. Because of the idiotic ISP dsl setup, it is not the simplest.

But you are correct, in the interim I could leave the ISP device there and do as you suggest.

just for info,
my router used to be a tp-link WDR3600 (which i modded with openwrt as the original firmware was not as stable as i wanted it to be)

After my internet upgrade i had to change it, as the tp-link wasn’t fast enough (network speed not exceeding 250Mbs). This might also explain that the tp-link wasn’t very stable on my old internet as it was already close to being overloaded (250Mbs was also the speed of my internet).

So i changed my router to a edgerouterX (but still use the tp-link as witeless AP😋)

Please could you guys take a look at my video and tell me what you think is going on? I’m sorry if you can’t understand my accent. (I’m Scottish.) Spending more money right now on other routers, custom PC/router builds etc. isn’t really an option right now.

The first step I would take is to open a terminal and execute arp -a directly after you have performed the IP-scan. My suspicion would be, that there one or more devices that react to multiple IPs. You could identify this situation my comparing the lines from the command above and check if multiple hosts (there’s one per line) share their mac addresses. The mac addresses are the ones that look like aa:bb:cc:dd....

Apart from that, a 60 minute lease time is very short. It might be useful for debugging some issues. But it may also be part of why you are seeing the IP addresses being eaten up. In the sense that the clients receive their new IPs way earlier then they expect, and therefore retaining that old address as well.

Oh, and this ESP_... devices are Wifi-IoT devices like light bulbs, Tuya switches, Tasmota etc… The ESP-chip is a popular choice for IoT devices that communicate over WiFi.

Edit: You can use arp -an instead if you don’t care about the hostnames.

Edit 2: I’ve written a short Python script that parses the output form the command above and displays it a bit more clear where the duplicates are.

This is the script:

#!/usr/bin/python
import pprint
import subprocess

p = subprocess.Popen(["arp", "-axn"], stdout=subprocess.PIPE)
output, err = p.communicate()
entries = output.splitlines()[1:]
hosts = {}

for entry in entries:
    parts = entry.split()
    if parts[1] not in hosts:
        hosts[parts[1]] = []
    hosts[parts[1]].append(parts[0])

pprint.pprint(hosts)

Put that code into some file (like arp_dupes.py) and make it executable via the command chmod 755 arp_dupes.py. The execute it with the command ./arp_dupes.py. The output will contain, ideally, one host per line, where the IP address is within the square bracket. If there are multiple IPs within the square brackets, then that’s a host that reacts to multiple IPs.

2 Likes