Skip to contentSkip to conversation

list of ip

DISCUSSION Pedro Drimel Neto 2 participants 2 messages Mar 13, 2006

lore
Share & tools
lore
#0 lore raw

How do I make a rule with a lot os ips like

IPS="{192.168.1.2, 192.168.1.50, 192.168.1.55}"

iptables -A INPUT -p tcp -s $IPS -j DROP

Regards.

#1 lore raw
Quoted 3 lines · Pedro Drimel Neto

How do I make a rule with a lot os ips like
IPS="{192.168.1.2, 192.168.1.50, 192.168.1.55}"
iptables -A INPUT -p tcp -s $IPS -j DROP

An iptables rule can only take one src and/org dst at the time, saying one host or network. Thus, shell scripting is your friend:

	IPS="192.168.1.2 192.168.1.50 192.168.1.55"
	for i in $IPS; do
		iptables -A INPUT -p tcp -s $i -j DROP;
	done
Signature · 2 lines
http://sid.rstack.org/
PGP KeyID: 157E98EE FingerPrint: FA62226DA9E72FA8AECAA240008B480E157E98EE
Quoted 2 lines
Quoted 2 lines

Hi! I'm your friendly neighbourhood signature virus. Copy me to your signature file and help me spread!