I really need to know this for a linux server, but since it also applies to client OSes, I figured the question should be posed here instead of server fault.
According to the replies to this post to the linux-net mailing list,
- At one point, the Linux kernel had a limit of 255 aliases per physical interface device.
- As of Linux kernel version 2.2, there is no (practical) limit, with the second response citing personal experience with having aliased over 5,000 addresses to a single ethernet card.
Of course, binding large numbers of aliases to a single device will impose memory requirements and may have performance implications, so it's entirely possible that your hardware may limit the number of aliases you can add, even if the kernel itself doesn't.
The linux kernel has a feature called AnyIP which allows you to answer for a contiguous block of IPv4 or IPv6 addresses via your linux loopback interface for very little cost in DRAM/CPU.
For instance, assume I want my linux machine to answer for any address in 10.7.0.0/16:
- On the linux system add a local route:
ip -4 route add local 10.7.0.0/16 dev lo
- Ask your network engineers to advertise a route for 10.7.0.0/16 pointing to the eth0 address of the machine you did this with.
Congratulations, you now answer for a massive number of addresses (over 65,000 in this example), and your RAM consumption is practically nothing from this exercise. In terms of scalability, this solution is far better than adding individual interface aliases on eth0 for all the IPs you want to answer for.
There is no limit for how many addresses you can answer for like this.