Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Feb 2008 13:33:35 +0100
From:      Mel <fbsd.questions@rachie.is-a-geek.net>
To:        freebsd-questions@freebsd.org
Cc:        Olivier Nicole <on@cs.ait.ac.th>, Siraj Shaikh <siraj.shaikh@gmail.com>
Subject:   Re: IP Aliasing
Message-ID:  <200802211333.36144.fbsd.questions@rachie.is-a-geek.net>
In-Reply-To: <3b2ddd940802210407j7b83059duabadeccaec53a26c@mail.gmail.com>
References:  <3b2ddd940801280627m6d747cd1g27682bcd9e50ceb7@mail.gmail.com> <200801290234.m0T2YtLn074403@banyan.cs.ait.ac.th> <3b2ddd940802210407j7b83059duabadeccaec53a26c@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 21 February 2008 13:07:08 Siraj Shaikh wrote:

> ifconfig_ed0_alias0="inet 127.0.0.251 netmask 0xffffffff"
> ifconfig_ed0_alias1="inet 127.0.0.252 netmask 0xffffffff"
> ifconfig_ed0_alias2="inet 127.0.0.253 netmask 0xffffffff"
>
> Just want to know, as I want to configure about 253 addresses as an
> alias on a single machine (along with the primary address, this will
> be 254 address, a whole C-class subnet) - and would like these entries
> to hold when I boot. Also, is there any shortcut to adding a range of
> net/host address or would I have to add a line for each address?

Yes and yes. Yes it needs one line per alias and yes, there's a shortcut:

for i in $(jot - 0 254); do
  echo ifconfig_ed0_alias${i}="\"inet 127.0.0.$((i+1)) netmask 0xffffffff\""
done >>/etc/rc.conf

Wouldn't do this with 127.0.0 btw, but I figured you wouldn't. You'd also have 
to make a provision for the main IP, but then again, it's easier to remove 
the specific line by hand.
-- 
Mel



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200802211333.36144.fbsd.questions>