Why my nftables do not block DHCP ?
from SpongeB0B@programming.dev to linux@lemmy.ml on 16 Jan 06:39
https://programming.dev/post/24122905

Hi,

On my Debian 12 Bookworm ( raspberry pi )

My nftables do not block DHCP packets ! according to this basic rules

nft -y list rulesset

table ip Tip {

	chain chIN {
		type filter hook input priority 0; policy drop;
		ct state established,related accept
	}
	chain chFW {
		type filter hook forward priority 0; policy drop;
	}
	chain chOUT {
		type filter hook output priority 0; policy drop;
		udp dport 67 drop #DHCP
		udp dport 53 accept
		tcp dport { 80, 443} accept
		ct state established,related accept
	}

}

DHCP should be blocked… but it’s not as I get an IP from it…

Any ideas ?

Thanks.

#linux

threaded - newest

synestine@sh.itjust.works on 16 Jan 07:25 next collapse

Block port 68 as well as 67. And are you sure the output rule is the best place for that?

SpongeB0B@programming.dev on 16 Jan 13:46 collapse

As I want the system to be quite ( not sending data ) I was suspected the output hook to be the one. what are you suggesting ?

synestine@sh.itjust.works on 18 Jan 03:25 collapse

Ah. It just didn’t compute for me. I’d think stopping the DHCP server or making it not listen on that interface would be easier than trying to firewall it off.

Yeah, blocking thise inbound and outbound will quiet that service.

lazynooblet@lazysoci.al on 16 Jan 09:16 next collapse

Why block from the firewall. Normally you would set a static ip to not use dhcp. You could also uninstall or disable the dhcp client service.

SpongeB0B@programming.dev on 16 Jan 13:42 collapse

Obviously, but I’m anyway wondering why it doesn’t blocking like it should
I hope nftables do not let other pass like this…

Morphit@lemmy.wtf on 16 Jan 15:25 next collapse

DHCP uses raw sockets so it gets to skip the normal networking stack. See here for the same question on Reddit: reddit.com/…/nftables_not_blocking_incoming_dhcp_…

AnnaFrankfurter@lemmy.ml on 19 Jan 03:39 collapse

I know nftable is more secure and robust but sometimes I feel like iptables is the way.

Auli@lemmy.ca on 20 Jan 12:27 collapse

They are literally the same now. Use IPtables it’s getting converted to nftables now. Just a different interface.