I'm developing an embedded device which has access to the internet through LAN. I'm in the testing phase now, and I would like to test how the device performs when the connection to the internet is poor. Currently, the device is connected to a router through a hub, which I use to monitor the packets with Wireshark. What's the best way to throttle down the internet speed of the device to mimic a scenario that may happen?
Can I do it through a PC? Do I need access to the router? If so, is it possible to limit the speed of each IP in the router interface?
Actually, a friend suggested that I will purchase a usb2lan ethernet card, and to bridge the PC lan connection to the embedded device, and then using a software QoS limiter. do you think it will work ?
You can try using "Fiddler"
You have options to simulate bad network (like old modems 33k or 56k)
You need to plug in your device to your PC and turn on the proxy (every request will be transfered through Fiddler)
Then you could test your code with a bad network then see what happening ;)
If you have a Mac handy, Macs have kernel facility called
dummynet
built in, which you control throughipfw
. It allows you to simulate a slow connection, randomly drop packets with certain probabilities, and more.The same facility exists in Linux and other OSes.
From the dummynet homepage:
It can do a lot for you:
limit the total incoming TCP traffic to 2Mbit/s, and UDP to 300Kbit/s
limit incoming traffic to 300Kbit/s for each host on network 10.1.2.0/24.
simulate an ADSL link to the moon:
This is another OSX solution, have a look at the Network Link Conditioner.
The following quote is ripped from the following blog (All credit for the below should go to Matt Gemmell):
http://mattgemmell.com/2011/07/25/network-link-conditioner-in-lion/
You may use (almost) any linux distribution from liveCd (like ubuntu, mandriva, others) to run it on any hardware you want, and use the kernel-based tool netem, aka "Network Emulation" with the "iproute2" package tools. It lets you control delays, package loss, corruption, duplication and other possible problems of wide area network.
There is list of most used simulations, like:
Rate control using Token Bucket Filter:
Delay all packets by fixed time:
tc qdisc add dev eth0 root netem delay 100ms
tc qdisc change dev eth0 root netem loss 0.1%