How to block LAN MAC from getting a DHCP address

I have an unknown MAC address on my lan. It is probably something of mine, but I want to block it from getting an IP address. I know I can block it from connections with a firewall rule, but I'd rather block it form getting an IP address (ipv4 or ipv6). I believe this is possible with dnsmasq:
https://community.ui.com/questions/Block-MAC-address-range-from-using-DHCP-with-DNSMASQ/9d96cfeb-412c-47bf-ae2c-c4488e17477f
how do you do this with Openwrt? CLI or LuCI?

Thanks

Use ignore as IP.

2 Likes

If you can't identify the device and either confirm that it is safe or shut it down, it would be safest to make a firewall rule to block it from everything.

So, I already have a Firewall rule set to reject. I added this to the firewall list:


I have added this to the DHCP reserved list:

Yet is still has an IP address in the Active DHCP leases. How do I get rid of it?

You have rejected forwarding. However getting an address by dhcp or querying the dns server is considered input, that means from lan without destination (or the device).

You'll have to wait for the lease to expire. Or find the device and reboot it :stuck_out_tongue:

2 Likes

put this in your rc.local (system > startup > local startup)

BOGONMAC="aa:bb:cc:dd:ee:ff"
ip neighbor replace 169.254.1.5 lladdr $BOGONMAC nud permanent dev br-lan 2>/dev/null
ip neighbor add 169.254.1.5 lladdr $BOGONMAC nud permanent dev br-lan 2>/dev/null
route add 169.254.1.5 gw 127.0.0.1 lo 2>/dev/null

or similar... (then reboot)

@trendy Thanks for the help.
Actually, I remembered that I could go into /tmp/dhcp.leases and delete the row, save the file, then select 'Reset' from the DHCP page in Luci and the address disappears from the list.
It would be a nice addition to Luci if we could select 'release', like we can for wireless connections to release the DHCP address.

Like this you just don't see it, but it is still there.
A DHCP release can be invoked only by the client, not the server.

1 Like