I have written a script to setup my iptables and I only want to give certain
IP's from different networks access to my webserver. I forgot how to use a
variable to use a bunch of IP's... can you tell me how?
basically instead of this:
iptables -A INPUT -j ACCEPT -p tcp -i eth0 --dport www -s 209.7.7.7 \
-d 209.209.209.2
iptables -A INPUT -j ACCEPT -p tcp -i eth0 --dport www -s 124.8.8.8 \
-d 209.209.209.2
iptables -A INPUT -j ACCEPT -p tcp -i eth0 --dport www -s 63.9.9.9 \
-d 209.209.209.2
iptables -A INPUT -j ACCEPT -p tcp -i eth0 --dport www -s 12.5.5.5 \
-d 209.209.209.2
I'd rather do something like this:
MYWWW = [209.7.7.7, 124.8.8.8, 63.9.9.9, 12.5.5.5]
iptables -A INPUT -j ACCEPT -p tcp -i eth0 -dport www -s $MYWWW -d
209.209.209.2
but I don't have the syntax down yet.
Would you please correct my syntax?
Thanks,
Jeff