Gentoo Archives: gentoo-user

From: Jarry <mr.jarry@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] iptables: how can I include multiple hosts/IPs in "-s" and "-d"?
Date: Mon, 05 Apr 2010 17:36:24
Message-Id: 4BBA1EA1.2050608@gmail.com
1 Hi
2
3 I'd like to ask if there is some way to include multiple discrete
4 hosts/IP's in --source and --destination options of iptables.
5
6 I'm trying to write firewall rules for my server, but it has
7 12 IP's from different segments (and maybe it gets a few more
8 later), and the script grows up as I have to write nearly
9 identical rules with difference only in -s/-d IP's.
10
11 What I'm looking for is a way to define some variable at the
12 beginning of my script, like MY_IP="IP1 IP2 IP3 IP4..." and
13 later to use is in rules (iptables -A INPUT -s $MY_IP...).
14 But I do not know how to use it. As far as I understand it,
15 --source/--destination accepts only single IP's or continuous
16 IP-segments...
17
18 Jarry
19
20 --
21 _______________________________________________________________
22 This mailbox accepts e-mails only from selected mailing-lists!
23 Everything else is considered to be spam and therefore deleted.

Replies

Subject Author
Re: [gentoo-user] iptables: how can I include multiple hosts/IPs in "-s" and "-d"? Kostyantyn <fastinetserver@×××××.com>
Re: [gentoo-user] iptables: how can I include multiple hosts/IPs in "-s" and "-d"? Alex Schuster <wonko@×××××××××.org>
Re: [gentoo-user] iptables: how can I include multiple hosts/IPs in "-s" and "-d"? Stefan Schulte <stefan.schulte@×××××××××××.net>