[Gllug] Two IPs and one NIC

Bruce Richardson itsbruce at workshy.org
Wed Mar 23 08:39:10 UTC 2011


On Tue, Mar 22, 2011 at 10:31:34PM +0000, Walter Stanish wrote:
> > Dumb question of the day. Is it possible for a box two have two ip addy's one one NIC?
> 
> Yes, IIRC this is referred to as aliasing.

It's called aliasing if you add an alias along with the ip address, as
you have to with ifconfig, as per your example.

> 
> Generally you can implement this old-style by going 'ifconfig eth0:1
> 192.168.0.3'

But the alias is not essential.  If you use the ip tool, you can just do

	ip address add <address/netmask> dev <ifname>

Unless you add an alias, though, ifconfig won't see or work with the
extra address (and some other reporting/monitoring tools may not see it
either).  This may or may not matter to you.  With the ip tool, that
would mean changing the line to

	ip address add <address/netmask> dev <ifname> label <label>

If I'm manipulating ip addresses and routes directly, I find the ip tool
much more precise and flexible than the legacy tools (ifconfig, route
and so on).  It offers a common syntax for managing addresses,
interfaces, routes, policy routing rules and a few other handy things.
The iproute suite of tools is available for any of the distros and
installed by default on many of them, these days.

-- 
Bruce

If the universe were simple enough to be understood, we would be too
simple to understand it.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 204 bytes
Desc: Digital signature
URL: <http://mailman.lug.org.uk/pipermail/gllug/attachments/20110323/d30bbd25/attachment.pgp>
-------------- next part --------------
--
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug


More information about the GLLUG mailing list