how to add a few hundred ip on one interface?

Matthew Seaman m.seaman at infracaninophile.co.uk
Fri Feb 11 06:07:55 UTC 2011


On 10/02/2011 23:52, patrick wrote:
> The standard way is to configure this in your /etc/rc.conf[.local]:
> 
> ifconfig_re0="inet xxx.xxx.yyy.134 netmask 0xffffffnn"
> ifconfig_re0_alias0="inet xxx.xxx.yyy.135 netmask 0xffffffff"
> ifconfig_re0_alias1="inet xxx.xxx.yyy.136 netmask 0xffffffff"
> ... etc.

That used to be the case, but in fact no longer.  Nowadays you can put
this single line into /etc/rc.conf to configure a whole raft of IP
addresses on an interface:

ipv4_addrs_re0="xxx.xxx.yyy.134-147/23"

See rc.conf(5) for details.

> See http://www.freebsd.org/doc/en/books/faq/networking.html#ETHERNET-ALIASES
> for more info. Note that aliases should have a netmask of 0xffffffff
> (255.255.255.255).

Also something that was once true, but is actually no longer required.
Nowadays you can give alias IPs the natural netmask of the network they
belong to.  Which has the handy consequence that there's no real
distinction between what was the first address, and what are aliases --
so you can easily renumber an interface on the fly, simply by adding a
new address/netmask, then removing the old one.

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey     Ramsgate
JID: matthew at infracaninophile.co.uk               Kent, CT11 9PW

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 267 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20110211/6415953d/signature.pgp


More information about the freebsd-questions mailing list