Add an IP address to an nftables blocklist
nftables block ip address | nft add element to set | add ip to nftables blocklist | nftables | nft | banCaution: This command changes the system. Understand what it does before you run it.
nft add element inet filter blocklist '{ 203.0.113.25 }'Adds the address to the previously created blocklist set, and the associated drop rule takes effect immediately. Multiple entries can be specified inside the curly braces, separated by commas. nft list set inet filter blocklist shows the contents, and an entry is removed with nft delete element using the same syntax.
Note: The set only accepts IPv4. IPv6 needs a second set with type ipv6_addr and a rule with ip6 saddr.
Also searched as
- nftables block ip address
- nft add element to set
- add ip to nftables blocklist