WANem running on Ubuntu 20.04
-
Install Software
- apt-get install apache2 php7.4 libapache2-mod-php7.4
-
Adjust system configuration
- /etc/sudoers -> Add lines to your file
- /etc/apache2 -> Adjust Default Webshare accordingly.
- /etc/php/7.4/[apache2|cli]/php.ini -> Verify all parameters are set as in provided files.
- copy /root/* to your /root folder
- copy /var/www/* to your /var/www
-
Restart apache
- systemctl restart apache2
-
Open Browser to http://localhost/WANem to configure your WANem.
Depending on the current set buffer for RX/TX network traffic, it might be necessary to adjust them to match the speed tests. Ie. You want to test 1Gbit lines but the buffers only match 50Mbit.
A 1Gbit Link has roughly 125.000.000 bytes/sec. Which equals 83.333 Frames per seconds (each Frame has 1.500 bytes)
If there should be no latency added for the packets, we could use 83.333 as configured value. In my tests I found a value of 9.000 frames per host as sufficient.
The 9.000 frames per host are used below in the commands. Feel free to adjust the Value to your needs.
There is only one input queue in linux, which is shared for all network cards.
You can see the current set value using:
cat /proc/sys/net/core/netdev_max_backlog
For a temporary increasement use the following commands:
sudo -i
cat 18000 > /proc/sys/net/core/netdev_max_backlog
To adjust the values permanently edit the file: /etc/sysctl.conf. Add / adjust the following lines to match for two testing hosts:
net.core.netdev_max_backlog = 18000
The transmit buffers are configured for each network card.
You can see the values with the following command, displayed as "qlen":
ip addr
For a temporary increasement use the following commands:
sudo -i
ip link set eth0 txqueuelen 9000
ip link set eth1 txqueuelen 9000
To set those values permament add a new rules file in /etc/udev/rules.d/99_eth_txqueuelen.rules
KERNEL=="eth0", RUN+="/sbin/ip link set %k txqueuelen 9000"
KERNEL=="eth1", RUN+="/sbin/ip link set %k txqueuelen 9000"
When using a bridge configuration, make sure when setting the latency / Bandwidth to apply it to all physical interfaces from the bridge!
As example, you want to have 30ms latency with 10Mbit Bandwidth. In this case you need to set to each interface 15ms (30ms / 2) and 10Mbit. With this configuration the sending and receiving packets, between two hosts, are applied 15ms latency in each direction, when passing the interface. The 10Mbit on alll Interfaces is needed to enforce the 10Mbit bandwidth in all possible directions.
- Install Software
-
apt-get install bridge-utils (only needed if bridge mode is wanted)
-
Create a netplan file: /etc/netplan/02-bridge.yaml, with the following content:
-
vi /etc/netplan/02-switch.yaml
Inhalt:
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: no
dhcp6: no
eth1:
dhcp4: no
dhcp6: no
bridges:
br0:
interfaces: [eth0, eth1]
dhcp4: no
stp: false
addresses: [192.168.1.250/24]
gateway4: 192.168.1.1
nameservers:
addresses: [192.168.1.1]
parameters:
stp: false
forward-delay: 0
* Replace the interface names with the interfaces on your pc.
* Edit the IPs as needed.
- Run "sudo netplan apply"
- Reboot PC
- Upper right -> User -> Account settings:
- Unlock button on window bar
- set automatic logon
- windows button -> open "startup applications"
- add:
Name: Firefox
Command: /usr/bin/firefox
Comment: "Start Firefox with WANem"
- Open Firefox -> Edit -> Preferences
- Home
- Custom URL: http://localhost/WANem
When enabling this script, it sets the latency of 15ms and 50Mbit Bandwidth to all Interfaces, that are connected on bootup.
- sudo
- crontab -e
- add the line:
@reboot sudo /root/default_tc_settings.sh
These are the source files from WANem (http://wanem.sourceforge.net/).
Update 2016.08.23 : WANem Beta 3.0.3. >> These files are corrected for the depedency on a debian 8 environment based on Beta 3.0.2.
WANem is a Wide Area Network Emulator, meant to provide a real experience of a Wide Area Network/Internet, during application development / testing over a LAN environment. Typically application developers develop applications on a LAN while the intended purpose for the same could be, clients accessing the same over the WAN or even the Internet. WANem thus allows the application development team to setup a transparent application gateway which can be used to simulate WAN characteristics like Network delay, Packet loss, Packet corruption, Disconnections, Packet re-ordering, Jitter, etc. WANem can be used to simulate Wide Area Network conditions for Data/Voice traffic and is released under the widely acceptable GPL v2 license. WANem thus provides emulation of Wide Area Network characteristics and thus allows data/voice applications to be tested in a realistic WAN environment before they are moved into production at an affordable cost. WANem is built on top of other FLOSS [Free Libre and OpenSource] components and like other intelligent FLOSS projects has chosen not to re-invent the wheel as much as possible.
From a functionality perspective WANem hooks into the Linux kernel towards provisioning the network emulation characteristics and extends the functionality with additional modules. Based on a re-mastered Knoppix cd WANem allows quick and easy setup in any development environment with an intuitive web interface for purposes of configuration.
WANEM is Open Source software licensed under the GNU General Public License. You are free to download WANem and use it in your own environments. We encourage you to write to us using the SourceForge forums. You may let us know your perspective on scope for improvement, or if you would like to contribute in anyway possible or of course just to drop us a note of encouragement.