I have what is probably a bit of an unusual problem. I'm developing a network stress testing tool for internal use, and one of the things I need is to simulate a lot of entities each with their own IP Address.
To achieve this, I've turned to interface aliases. A typical config looks like this:
auto eth1:1 iface eth1:1 inet static address 188.8.131.52 netmask 255.255.0.0 broadcast 184.108.40.206
The problem is that at the moment I have 10,000 of these. Linux seems to cope well (Surprised me I must admit), but I had some problems setting them up.
The first problem was that the scripts in if-up.d/ seem to be run for every interface. Among the scripts we find ntdate and openssh-server. Trying to create 10,000 instances of those caused some problems. I hacked both scripts like this:
if [[ "$IFACE" == *":"* ]]; then exit 0 fi
So the script now returns immediately if the interface is an alias.
But I still have problems. The aliased interfaces are not automatically created on boot it seems, so to start them I run
ifup -a -i my_interface_file
This works, but it takes about 3 minutes to run.
Now, one reason that it takes a long time to run is presumably that it needs to create one shell interpreter per interface per script, which translates into 40,000 of them in my case.
So, I guess my question is twofold:
Is there some smarter way I can solve my actual problem which is having 10,000 entities with their own IP Address (localhost is not an option, they do interact with stuff on the outside)
If not, are there ways to configure this that are better than the way I do it now? Specifically, a way to avoid hacking the if-up.d scripts, and preferably something a little faster. And it should automatically start up at boot.