delicious

How to block unwanted IP addresses on Linux efficiently

Een murb'ed feed, meer 9 jaar geleden geplaatst onder server, configuration, debian, linux, ip & filtering.

tl;dr: You can block IP’s using IPtables DROP command:

sudo iptables -A INPUT -s i.p.add.ress -p TCP -j DROP 

However, this is hard to maintain. Use the ipset tool:

sudo apt-get install ipset 
sudo ipset create banthis hash:net 
sudo ipset list 
sudo ipset add banthis i.p.add.ress
sudo ipset add banthis i.p.add.ress
sudo ipset add banthis i.p.add.ress

then add the ipset:

sudo iptables -I INPUT -m set --match-set banthis src -p tcp --destination-port 80 -j DROP 

Lees meer op de oorspronkelijke bron.

Op de hoogte blijven?

Maandelijks maak ik een selectie artikelen en zorg ik voor wat extra context bij de meer technische stukken. Schrijf je hieronder in:

Mailfrequentie = 1x per maand. Je privacy wordt serieus genomen: de mailinglijst bestaat alleen op onze servers.