Netem Interface help
Introduction:PHP Netem GUI is a user interface for the tc (traffic control) tool for creating and running various network emulation rules on any network interface; including packet delay, packet loss, packet duplication, packet reordering and bandwidth limiting. The interface is split into two different sections which allow you to enter rules in different ways. These sections are basic mode and advanced mode. The differences between these to modes are explained below.
Basic Mode:
You can add netem rules to more than one interface at once, but, unlike advanced mode, you can not add more than one set of netem rules to a single interface in this mode. If there has already been more than one set of rules added to an interface in advanced mode, then you won't be able to edit those rules while in basic mode and you must either reset all of the rules or go into advanced mode and edit them from there. However, you can still edit the rules for other interfaces even if some interfaces have more than one set of rules running.
Advanced Mode:
You can use this mode to add more than one set of IP-address-matched netem rules to a particular interface. You can only view the rules for the particular interface you selected, unlike in basic mode where you can see every running interface on the screen at the same time. If you want to have more than one set of netem rules running on a single interface then they must be unique in some way. The way to make them unique is to give each set of rules different and mutually exclusive IP address matching rules. This means that you cannot have two rule sets matching the same source address and/or the same destination address. If there are rules for source and destination addresses on more than one rule set then either the source or destination IP addresses must be mutually exclusive for them to be valid.
General notes:
Enter the required values for the network emulation rules in the relevant boxes and click the "apply settings" button to run them. Only type numbers and don't add decimal points.
The boxes for each rule must be filled in from the top down. Each box below the top one in each section must have the box above filled in. e.g. for delay, the delay time box must be filled in before the jitter box, the jitter must be filled in before the delay correlation box.
Most of the boxes are self explanatory but for a detailed explanation of the Netem functions, see the examples on the Netem homepage.
IP address matching:
You can make certain netem rules only apply to packets that are coming from and/or going to a certain IP address or block of addresses. The default values in the IP source and destination address boxes is "any" This means that all packets going out of the interface will have the netem rules applied to them. If you want to specify IP addresses you must type the IP address and the subnet into the relevant boxes. e.g. to apply netem rules to packets going to IP address 1.2.3.4 you need to type "1.2.3.4"(without the quotes) in the "IP destination addr" box, then type "32"(without the quotes) into the "IP destination subnet" box. To apply the netem rules to packets going to IP addresses in the range of 1.2.3.0 - 1.2.3.255 then you need to type "1.2.3.0"(without the quotes) in the "IP destination addr" box, then type "24"(without the quotes) into the "IP destination subnet" box.
Buttons:
Apply settings: Apply any entered network emulation values to all interfaces being displayed.
Reset settings: Removes all network emulation rules from all interfaces being displayed.
Refresh settings: Re-populates the form with the currently running network emulation values for all interfaces being shown.
Check current status: Opens a new page that displays all network emulation rules running on all displayed interfaces. It also shows the bytes and packets sent and the number of packets dropped.
Stop netem and Start netem: The "Stop netem" button will remove all currently running netem rules from all interfaces and store the rules in a temporary file. Then when you click the "Start netem" button the netem rules will be re-applied. This is useful if you want to temporarily stop and start many netem rules without having to re-enter the values each time. These buttons will only appear if you have rules running, and only one of the buttons appears at once.
Display commands only: If you check this box before you click the 'Apply settings' button then the netem commands will be displayed at the top of the page instead of being run in the background. This is useful because you can see how the netem commands are formed and also copy and paste them for later use on any machine with netem. The commands that are displayed can only be applied on a machine where you have root privileges.
Advanced mode buttons:
Add rule set: Adds a new empty rule set to the screen. This new
rule set must be filled in with valid data and then the apply settings button
clicked or else it will be ignored and disappear.
Delete last rule set: When there is more than one rule set in use for an interface, clicking the delete rule set button will remove
the last rule set from the screen. Only after the apply settings button is clicked will the rule set be completely
removed from the system.
Bridges:
If there are any bridges configured on the machine then they will appear in a dropdown list at the top of the page in basic mode. You can select one of these bridges in the dropdown list, then when you click the 'Select bridge' button the page will display only the interfaces used in the selected bridge. Click the 'Unselect bridge' button to restore any interfaces that were hidden.
Software bugs and crashes:
If you apply a number of different rules to different interfaces, you may experience problems where the network emulation results are not as you expected, or you may find that the machine running Netem freezes for no apparent reason. The Netem package in Linux is not perfect and bug-free software and is still in regular development. At the time of writing, the Linux kernel version 2.6.12-rc4 has just been released and this includes several bug-fixes for Netem. As the software matures it will become more stable, but for now the best way to prevent problems with bugs is to run the very latest Linux kernel on your Netem machine.
Questions should be sent to phpnetemgui@smyles.plus.com