Bad internet box running Althea
If you intend to test Althea you probably want at least one ‘bad internet’ box.
What we’re going to do is install ‘netem’ (network emulator) on a althea router and then use that to make the router drop packets or add latency.
Sadly kmod-netem is a kernel module, which makes installing it against our firmware quite difficult unless build the firmware with it.
Clone the althea firmware repo, and then before you start edit the config for the device your interested in. Replace glb1300 with whatever device config are you working on.
git clone althea-firmware
if you are testing the latest release you’ll need to run this. For specific releases checkout their tag. If you want to test master ignore this next line.
git checkout origin/release
cd althea-firmware echo "CONFIG_PACKAGE_kmod-netem=y" >> config/glb1300
Next build and install the firmware. If you have the router steup so that your machine can ssh into it this script will login and upload the firmware for you. If not grab the results from
build/bin/ and flash however you like.
ansible-playbook -e @profiles/devices/glb1300.yml -e @profiles/management/althea-release.yml build-and-upgrade.yml
Now that the router is flashed with a firmware containing netem it’s time to actually set it up. Login and run the following.
We need to delete the cake qdisk that’s currently in control of the router. After that we can add netem with our own parameters.
tc qdisc del dev eth0 tc qdisc add dev eth0 root netem delay 100ms
So now we’ve added 100ms latency, but what about packet loss or jitter? This adds 100ms of latency ± 10ms of jitter, with 25% packet loss. You can refer here for more examples. A really good test would go even further and use this guide to include duplication, corruption, and out of order packets in testing.
tc qdisc change dev eth0 root netem delay 100ms 10ms 25%
Take note that you must
del the default qdisk then
add a new one using netem, after that you can
a footnote on interface names:
note that I used eth0 in this example, you can repeat this example on different interfaces, but beware eth0.5 is really the vlan5 of eth0 so you’ll probably just want to edit eth0. This may modify one port or all ports on a device depending on the port layout. The N750 for example only has one port attached to a switch, so loss is always added to every port. Netem only works on outgoing traffic so keep in mind that incoming will always be good unless you put a device running netem north.