Hi,

you can define a rule like that:

iptables -A FORWARD -s 192.168.235.43,192.168.235.46 -d
10.0.0.1,192.168.0.1 -j ACCEPT

it will create 4 rules.

be sure to activate Networking support->Networking options->Network
packet filtering framework->Core Netfilter Configuration->iprange
address range match support

Now you can do something like

iptables -A FORWARD -m iprange --src-range '10.0.0.1-10.0.0.44' -j
ACCEPT

hope it helps

-Stefan

On Mon, Apr 05, 2010 at 07:32:17PM +0200, Jarry wrote:
> Hi
> 
> I'd like to ask if there is some way to include multiple discrete
> hosts/IP's in --source and --destination options of iptables.
> 
> I'm trying to write firewall rules for my server, but it has
> 12 IP's from different segments (and maybe it gets a few more
> later), and the script grows up as I have to write nearly
> identical rules with difference only in -s/-d IP's.
> 
> What I'm looking for is a way to define some variable at the
> beginning of my script, like MY_IP="IP1 IP2 IP3 IP4..." and
> later to use is in rules (iptables -A INPUT -s $MY_IP...).
> But I do not know how to use it. As far as I understand it,
> --source/--destination accepts only single IP's or continuous
> IP-segments...
> 
> Jarry
> 
> -- 
> _______________________________________________________________
> This mailbox accepts e-mails only from selected mailing-lists!
> Everything else is considered to be spam and therefore deleted.
> 

Attachment: pgp8CBCXDQtso.pgp
Description: PGP signature

Reply via email to