Lots of alias addresses on an IP interface?

It’s easy to add multiple IP addresses to an interface in Linux. For example, you want to have both the address 172.16.0.13 and 192.168.0.17 for your Ethernet device. But, can we create LOTS and LOTS of addresses?

For fun, I wrote a little script to create bunches of alias addresses. I tested on a RedHat Enterprise 6.8 64bit VM (running kernel 2.6.32-642.el6.x86_64), since there’s still lots of this older o/s out there. I tried 50,000 alias addresses, and ta da! it works fine:

# ip addr
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 08:00:27:76:75:29 brd ff:ff:ff:ff:ff:ff
inet 172.16.47.139/16 brd 172.16.255.255 scope global eth0
inet 192.168.0.1/32 scope global eth0:3232235521
inet 192.168.0.2/32 scope global eth0:3232235522
inet 192.168.0.3/32 scope global eth0:3232235523
inet 192.168.0.4/32 scope global eth0:3232235524
. . .
inet 192.168.195.77/32 scope global eth0:3232285517
inet 192.168.195.78/32 scope global eth0:3232285518
inet 192.168.195.79/32 scope global eth0:3232285519
inet 192.168.195.80/32 scope global eth0:3232285520
inet6 fe80::a00:27ff:fe76:7529/64 scope link
valid_lft forever preferred_lft forever

The network seems plenty responsive still; and I can ping any of the alias addresses.  Creation of 50,000 aliases took about a minute.  FWIW.