Network Traffic Shaping Tool
During the self-validation phase, it's necessary to confirm the accurate reporting of buffering and error events. Conviva offers Network Traffic Shaping Tool to simulate different network conditions for devices like SmartTVs and Settop Boxes where you cannot use a proxy tool such as Charles or Fiddler proxy.
To use the tool, download the .zip file and unpack it into a convenient folder.
Note: To obtain permission to use this script on your work computer, please run it by your IT department.
To see a demonstration of utilizing the tool, watch this video:
Network Traffic Shaping Tool |
Using the script:
-
To start using the script, the script file must have the permission to execute. Run the following command:
chmod +x throttle.sh
Make sure that you entered the correct path to the throttle.sh file.
Note: Before launching the script, start internet sharing as the script relies on internet sharing.
-
After the permission is granted, you can launch the script by running the following command:
./throttle.sh
If the script is not in root, then provide the full path to the script.
-
When the script is started, it requires the admin password due to the usage of sudo directive.
-
Now, you can enter commands in the <target(IP)> <command> format. The following is an example of possible commands (for the full list, please refer to the README section when the script is started.):
block
- drop all packets from the targetblockd
orbd
- delete targetIP from the blocking list100
- throttle the target to 100kbp/s100d
- delete the targetIP from the 100kbit/s throttle list -
You can use each command with the flush word to clear the respective lists. When you run <command>flush, (for example,
100flush
) there is no need to call the targetIP. So, you can just type100flush
and hit enter. This clears the 100kbit/s list. -
Other commands available are
flush
,show
, andq
.flush
clears all IPs previously added to any of the rules.q
clears all IPs previously added to any of the rules and exits the script.show
displays all currently active rules with a break down by rule.Note: When the script starts, the README section is displayed first. Please read it for the full list of available commands.
Using CIDR prefixes for IP:
When you enter a target IP you can use slash notation to block a wider range of IPs. Usually, 3 notations are used – 8, 16, and 24. In short, to block all IPs from 192.0.0.0 host you can use an IP with the /8 notation in the end. For example, 192.168.2.2/8. Similarly, 16 notation blocks all IPs from 192.168.0.0 and 24 notation blocks all IPs falling in the range of 192.168.2.0.
Note: Local IP address (192.168.2.2) is used for reference and the real addresses will be different.
Using iftop to find a CDN IP (Optional):
Iftop is a free CLI application that allows you to see the traffic passing through the specific interface. You can also use other ways to find the IPs that you are interested in (for example, Wireshark). To install iftop, you can use Homebrew:
brew install iftop
If you do not have Homebrew, please follow the instructions from the official iftop page here.
When iftop is installed, you can launch it using the following command:
Iftop -n
Where, -n
means do not resolve hostnames. Only IPs are shown.
You can also use -i
option to set a correct interface. To see which interface your machine is using at the moment, call ifconfig
command and it will display all active interfaces.
If iftop is not working after installing due to the command is not found error, you must do the following:
-
Open Terminal and run
nano .bash_profile
. A file opens. -
In the file, type
export PATH=${PATH}:/usr/local/sbin
and save the file. -
On the keyboard, press Control + X. Then, press Y.
-
When you are back in the terminal, run
source .bash_profile
.Note: You do not need to run this command every time you are testing. It is only needed the first time so that, you do not have to restart the terminal.
-
Start iftop.