Thursday 26 February 2015

Inexpensive WAN Emulation with Linux

Quite frequently, when designing a WAN or evaluating a new networked application, it is interesting to try out the „user experience“ rather than believing the manufacturer‘s marketing flyers.
Commercial, closed source WAN emulators, even as pure software solutions are still in the range of approx. 5000€

As we had problems getting a commercial Software package installed under XP (because of - among others - license key issues) we used NETEM under Linux.
That worked flawlessly using Knoppix on a standard PC with two network cards.
Netem does not provide bandwidth management. This can be added easily - see the LARTC Howto or the example below.

In the following example the WAN Emulator is used as a bridge, i.e. without Layer 3 routing.

Simulating layer 2 ethernet connections has gained relevance since I did my tests in late 2006: Telco providers, eg. Colt, now offer national and international ethernet connections. These can be simulated realistically with the method described here.

Script to enable WAN emulation under Knoppix:

brctl addbr goldengate
brctl addif goldengate eth0
brctl addif goldengate eth1
ip link set up dev goldengate
ip link set up dev eth0
ip link set up dev eth1
ip link show
brctl showmacs goldengate

tc qdisc add dev eth0 root handle 1:0 netem delay 27ms
tc qdisc add dev eth0 parent 1:1 handle 10: tbf rate 1000kbit buffer 16000 limit 30000

tc qdisc add dev eth1 root handle 2:0 netem delay 27ms
tc qdisc add dev eth1 parent 2:1 handle 20: tbf rate 1000kbit buffer 16000 limit 30000

tc -s qdisc ls dev eth0
tc -s qdisc ls dev eth1


Disable:


tc qdisc del dev eth0 root handle 1:0

tc qdisc del dev eth1 root handle 2:0

tc -s qdisc ls dev eth0
tc -s qdisc ls dev eth1


In the 13/08 edition of the German c‘t magazine, an article about WANEM was published. While it‘s focus is apparently on routed links, the GUI it comes with mightbe interesting to try.

No comments:

Post a Comment