How to stop SYN packets using fw4?

Hello,

I recently installed stable openwrt-22.03 by hnyman. I don't know how to handle SYN scans on the WAN interface that show up every few seconds. I don't want the router to respond to them, just drop them.

syn1

I have tried several commands which unfortunately do not work. I am not sure if they are correct and if I need to reload firewall.

nft add rule inet fw4 input_wan tcp flags \& \(syn\|rst\) == \(syn\|rst\) drop
nft add rule inet fw4 input_wan tcp flags \& \(fin\|syn\|rst\|psh\|ack\|urg\) == 0x0 counter drop

Can someone point me in the right direction?

I would think that any changes to the user firewall would require a restart.

uci commit firewall; /etc/init.d/firewall restart

Actually, that would wipe out the nft rules added manually as per OPs post.

I had a similar inquiry:

1 Like

I inserted the recommended rules from another thread into each input and input_wan chain without any effect. I also tried putting them in /etc/nftables.d/10-custom-filter-chains.nft

        # Drop XMAS packets.
        tcp flags & (fin|syn|rst|psh|ack|urg) == fin|syn|rst|psh|ack|urg counter drop

        # Drop NULL packets.
        tcp flags & (fin|syn|rst|psh|ack|urg) == 0x0 counter drop

Only after I changed the input action in the wan zone from reject to drop it works as intended.