Stuck how to flush DHCP leases

Ok, I have asked questions about PiAlert and was told to ask there, I did.

I read that PiAlert gets the entries from PiHole and if you are getting unknown devices connecting to your network: Check PiHole's DHCP

Then FLUSH the old IP reservations.
Fair enough, I get that - now.

Did it and they keep coming back.


So are the old DHCP leases I deleted.

I go to settings/system scroll to the bottom and click flush network table.
But that doesn't seem to delete (flush) old DHCP reservations.

How do I do that?

More information:

Ok, I am partly wrong with what I said..... Learning is not my greatest skill. But when the documentation is vague - for me - it is not made easier.

PiHole is my DHCP server.
I go to tools/network and see a list of devices.
At the bottom of this list are some red entries. So ok: These are marked as NOT USING PiHole.

I press the rubbish bin icon on the right.
They get deleted. But they come back again. (Which raises the question: What is the use of the rubbish bin icon?)

Now, before you say: Of course they will... They don't use PiHole.

So SOMEONE/THING is somehow rebroadcasting their details.
Yes, maybe not PiHole's problem. but I am really not understanding what is going on.

Is it they are stored in a file PiHole uses?

Your question is vague - what do you mean by "flushing DHCP leases"?

That's clearing entries from Pi-hole's Network overview.
That network overview is a historic view of IP addresses as observed on the same network link attached to Pi-hole and/or sending DNS requests to Pi-hole, aggregated by a device's NIC's MAC address and potentially an associated name.
It is not associated with DHCP lease management in any way.

DHCP leases can only be managed (and observed) by Pi-hole if Pi-hole is acting as your network's sole DHCP server, via Pi-hole's DHCP pane.

You could clear an existing DHCP lease (static ort not) for a currently active device by clicking the trash bin next to any entry under Currently active DHCP leases.

You could also clear a static DCHP lease reservation by clicking the trash bin next to any entry under Static DHCP leases configuration.

I wonder why PiAlert would retrieve any information from Pi-hole at all?
Why would they rely on Pi-hole to provide information that Pi-Alert claims to offer?
Are they embedding Pi-hole as (optional) part of their solution?
If so, would they perhaps run a tailored fork of Pi-hole?

I seem to be stuck in this endless loop of phantom devices which are showing up in PiHole's network list.

PiHole is my DHCP server.

There are more off the bottom of the screen.

Quick trip into history:
I had a home network that was the typical flat network and everyone lived on ONE network.
I got curious and bought an Edge Router and made multiple VLANS - with a managed switch.

Initially the Edgerouter was the DHCP server and I moved from totally FIXED IP addresses to FULLY DHCP with assigned static IP for devices.
It was a steep learning curve but I now see huge advantages of this way. But anyway.
So in the early days devices got initial IP addresses and as time went on they got moved - as can be seen in the screen shot with one device that has two IP addresses (in the red section).

The edge router being the DHCP server caused some problems for me - I've posted and asked here before - that devices were not showing their NAME when I am looking at the logs: only their IP address.
It was pointed out to me that if PiHole isn't/wasn't the DHCP server that is to be expected.

I learnt my lesson there.

So I have PiHole as the DHCP server.

Just for the fun of it I also got PiAlert - of which I am sure you are aware from my other more recent posts.

I asked there about these rogue devices that would appear on my system and was told that PiHole sends PiAlert the list and it is PiHole's cause as it broadcasts a list of devices that are known on the network with their IP, MAC and names - where set.

So this list of RED devices.

I click on the rubbish bin on the right of the screen.
No sooner have I completed this and they are gone: They come back! Time after time after time.

Ok, maybe not PiHole's problem. This is a whole new world for me.
But someone IS broadcasting this list.

I will admit that this list DOES contain recent additions by me of my Edge router and Managed switch.
They are OUTSIDE the DHCP range (1 - 5) and I accept they will be in the Doesn't use PiHole for DHCP allocation.

But all these OTHER devices. Nah. They are relics of times gone by and I want to remove them so I am not constantly chasing ghosts on my network claiming to be in IP numbers that they aren't.

Most of them are actually not even (now) connected. Yes they will/maybe in the future, but NOT NOW.

So HELP ME understand how they keep appearing in/on the list.

If I knew how it was happening I wouldn't be asking. Be it PiHole's problem or not is beyond me so I am asking here as a start.

Is that any clearer?

The network page entries are being picked up from the cache in Pi's own OS. In a Pi-hole terminal window run the command below and check you can see them as a load of STALE entries.

ip neigh

You can clear these with the command

sudo ip neigh flush nud stale

Then Pi-hole Settings > System > Flush network table. After a few moments the table will be repopulated and contain only current devices.

Edit: just wanted to add the following notes

There is really no need to do any of the above. The red entries in Pi-hole's network page are not using Pi-hole, they are (or were) merely visible to the OS on which Pi-hole is running. It is best left to the OS to manage these under normal conditions. The network page is more useful for the other entries, in green, yellow, orange, as these have been active now or recently. If you're doing some detective work, a flush can be useful to pick up what is present right now, but otherwise I would not be concerned by the red entries and just let the OS handle them.

The DHCP leases will expire as per the lease time configured in Settings> DHCP > DHCP lease time. Active leases can be seen on this page. The network page, and the above commands, have no bearing on these.

1 Like

What I didn't know was the sudo ip neigh flush nud stale bit.

That seemed to work.

Thanks very much.

I'll mark it as solved now.

Note that this is about clearing the OS's ARP/neighbour tables.
It is not "how to flush DHCP leases" (your topic's title).

To manage Pi-hole's DHCP leases, use the UI options under Currently active DHCP leases and/or Static DHCP leases configuration as mentioned above.

Thanks @Bucking_Horn

It is that I am new to these things and knowing where the lines are for which discipline it falls.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.