Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Joel Newkirk <netfilter@newkirk.us>
To: netfilter@lists.samba.org
Subject: Re: HELP : How to group IP addresses by refering to them as a single name ?
Date: Thu, 19 Sep 2002 22:55:41 -0400	[thread overview]
Message-ID: <200209192255.41959.netfilter@newkirk.us> (raw)
In-Reply-To: <20020919193311.UPJU287.mta02-svc.ntlworld.com@there>

On Thursday 19 September 2002 03:33 pm, Antony Stone wrote:
> On Thursday 19 September 2002 7:00 pm, Alok Shukla wrote:
> > Let me say if i am able to sort out the lab in the
> > accordance that i start my ip settings of lab2
> >  like 192.168.9.1-63 for lab 1
> >
> > and next 64 for lab 2 , would that help and how ?
>
> I think it would help a lot, yes.   I would recommend putting machines into
> three groups:
> 1. User machines in Lab1
> 2. User machines in Lab2
> 3. System machines such as servers, routers, etc.
>
> Separate the IP addresses for each of these three groups so that you can
> specify a single group with an easy netmask.

[snip excellent mask explanation, insert quick'n'dirty script excerpts]

# define convenient symbols for the IPTables rules
#
IPTABLES=/sbin/iptables
# everything from 0.0 to 0.63 is administrator territory
SERVERS="192.168.0.0/26"
# Lab 1 from 0.64 to 0.127
LAB1="192.168.0.64/26"
#Lab2 from 0.128 to 0.191
LAB2="192.168.0.128/26"
#0.192 to 0.255 unassigned for now
FUTUREEXPANSION="192.168.0.192/26"
#
$IPTABLES -t nat -A POSTROUTING -s $LAB1 -j MASQUERADE
# et cetera

The four address ranges can of course be used in any order, this one means reconfiguring 54 machines, changing the server addresses would mean reconfiguring all machines.  (Of course, you'll use student labor anyway... ;^)

You can also create simple scripts to run either manually or on schedule, that do nothing but -A(dd) and -D(elete) the rule for a given lab's address range.
like:

#!/bin/sh
# lab1off
/sbin/iptables -t nat -D -s 192.168.0.64/26 -j MASQUERADE




  reply	other threads:[~2002-09-20  2:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200209041320.g84DKjv31137@vulcan.rissington.net>
2002-09-19  7:45 ` HELP : How to group IP addresses by refering to them as a single name ? Alok Shukla
2002-09-19  9:37   ` Rohan Almeida
2002-09-19 13:01   ` Antony Stone
2002-09-19 18:00     ` Alok Shukla
2002-09-19 19:33       ` Antony Stone
2002-09-20  2:55         ` Joel Newkirk [this message]
2002-09-20 12:43         ` Alok Shukla
2002-09-20 13:11           ` Antony Stone
2002-09-21  5:34             ` Darrell A. Escola
2002-09-21  8:01               ` Antony Stone

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200209192255.41959.netfilter@newkirk.us \
    --to=netfilter@newkirk.us \
    --cc=netfilter@lists.samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox