Friday, May 11, 2012

Performance of Linux IP Aliased Network Interfaces

TL;DR &dash; I put together a setup to measure the performance of IP aliasing in Linux. As the numbers at the bottom of the post describe, observed throughput increases as the number of aliases increase. WTF?

For a couple of months I have been putting together some fancy hacks using IP aliasing feature in Linux, that is, associating more than one IP address to a network interface. The limits of IP aliasing are endless...

But obviously there is a price (overhead) to pay for this at kernel level. To shed some more light into the problem at hand, for experimentation purpose, I setup a simple network as follows.

First, I setup two identical Linux boxes with gigabit ethernet cards (RTL-8169 Gigabit Ethernet [10ec:8169] rev 10) connected through a Huawei gigabit switch. (Cable is CAT6 262M of length 1 meter.) Then, I started creating iperf instances binded to particular IP aliased interfaces. That is, first iperf instance is bind to 192.168.2.1 at eth1:1, second is bind to 192.168.2.2 at eth1:2, and so on. In other words, Nth iperf instance is bind to 192.168.2.N at eth1:N.

To ease the workflow, I put together a server.sh script as follows.

Using server.sh, I'll be able to start as many iperf instances (and necessary IP aliases for them) as I want. Next, I write client.sh as follows.

While going this further, nobody could stop me from writing a Gnuplot script to visualize these results.

Ok, too much talk so far. Let's get to results. (Timeout is set to 60 seconds.)

#

Kbits/sec

1

615,216

2

612,580

4

616,071

8

615,777

16

616,686

32

615,340

64

618,838

96

622,344

128

654,269

160

640,364

192

662,783

224

658,962

254

670,788

As the numbers suggest, Linux IP aliasing does a fairly good job that the overhead imposed by the aliases are nearly negligible. (At least I hope that is something I succeeded in measuring.) But the strange thing is, there is an improvement in the throughput as the number of network interfaces increase. What might be the explanation of this observation? Is my setup mistaken? I will be happy to hear your ideas.