[Gllug] Two IPs and one NIC

Jason Clifford jason at ukfsn.org
Wed Mar 23 08:41:47 UTC 2011


On Tue, 2011-03-22 at 12:16 +0000, John Maclean wrote:
> Dumb question of the day. Is it possible for a box two have two ip addy's one one NIC?

Both of the replies you have already received are correct - you can use
virtual interfaces to achieve this - however the use of virtual
interfaces is no longer necessary. 

You can now have as many IP addresses on an interface as you like. Note
that this is currently true for IPv4 addresses. IPv6 addresses are
subject to a limit set in the kernel (which you can change via the proc
filesystem at /proc/sys/net/ipv6/conf/all/max_addresses)

An example:

ip addr add 192.168.0.2/24 dev eth0
ip addr add 192.168.0.3/24 dev eth0
ip addr add 192.168.0.4/24 dev eth0
...

I'm not sure what the limit is on IPv4 addresses these days. Certainly
modern Linux kernels do not specify a limit so it will be a matter of
resource capability rather than something specified. I've had thousands
of IPv4 addresses on a single interface in testing without any problems.

Jason

--
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list