Re: Automatically maintaining unique list of addresses

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

You can use named sets ( https://wiki.nftables.org/wiki-nftables/index.php/Sets)
 or 
a dictionary...(https://wiki.nftables.org/wiki-nftables/index.php/Dictionaries) 

I think the best would be dictionaries...80)

best regards


----- Mensagem original -----
De: "Lars Noodén" <lars.nooden@xxxxxxx>
Para: "netfilter" <netfilter@xxxxxxxxxxxxxxx>
Enviadas: Quarta-feira, 19 de fevereiro de 2020 4:44:51
Assunto: Automatically maintaining unique list of addresses

If I add an IP address multiple times, I end up with it in the ruleset
three times.  Is there an easy way to try to add IP addresses such that
they aren't duplicated?

/Lars

$ sudo nft add rule ip filter4 input ip \
	saddr 198.51.100.209 counter reject

$ sudo nft add rule ip filter4 input ip \
	saddr 198.51.100.209 counter reject

$ sudo nft add rule ip filter4 input ip \
	saddr 198.51.100.209 counter reject

$ sudo nft list ruleset| grep 51
                ip saddr 198.51.100.209 counter packets 0 bytes 0 reject
                ip saddr 198.51.100.209 counter packets 0 bytes 0 reject
                ip saddr 198.51.100.209 counter packets 0 bytes 0 reject
-- 
Paulo Ricardo Bruck consultor 
tel 011 3596-4881 011 98140-9184(TIM/Whats) 
[ http://www.contatogs.com.br/ | http://www.contatogs.com.br ] 
gpg AAA59989 at wwwkeys.us.pgp.net 
skype: suportecontatogs




[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux