12

I'd like to simulate packet loss on a rooted Android device to see how different levels affect video streaming quality. I've tried netem and iptables, without success:

netem:

# tc qdisc change dev rmnet0 root netem loss 0.1%
tc qdisc change dev rmnet0 root netem loss 0.1%
Android does not support qdisc 'netem'
Garbage instead of arguments "loss ...". Try "tc qdisc help".

Is the format wrong or is it possible to add netem support somehow?

iptables:

# iptables -A INPUT -m statistic --mode random --probability 0.01 -j DROP
iptables -A INPUT -m statistic --mode random --probability 0.01 -j DROP
iptables v1.3.7: Couldn't find match `statistic'

Try `iptables -h' or 'iptables --help' for more information.

Is there any other alternative in Android?

3
  • 3
    Good question! My thought: as an alternative, maybe connect to a wifi router and throttle the connection there if your router does quality of service or similar?
    – Bryan Denny
    Nov 1, 2011 at 15:57
  • Kind of related, here is how to capture packets on a rooted Android device: vbsteven.be/blog/…
    – Bryan Denny
    Nov 1, 2011 at 16:01
  • The router configuration is probably the proper way of doing it, and I do have that simulation in place by using WANem. However, I'd like to have a portable way that does not rely on the network configuration, or the network interface for that matter. Basically I want to do a unit test where I run video streaming, increase the packet loss and run the same video again.
    – fejd
    Nov 2, 2011 at 8:02

3 Answers 3

2

Since your device is rooted you can install a Proxy. I've used TransparentProxy. Then setup a proxy on another machine on your local network. Point TransparentProxy to that proxy and then set your Proxy to throttle. A few proxies that might work include CharlesProxy or Service Capture.

If that doesn't work then you can come at it from the router level. A machine running BSD or Linux can function as a router. Or you can get a Virtual appliance or bootable CD to do it for you.

2

It is possible to set network latency and speed using the emulator control functions of the standard Android Developer tools.

If using eclipse: Select Window\Open Perspective\DDMS On the screen you will see a tab named "Emulator Control". In this tab, you will find the Speed and Latency options. The 'Telephony Settings' at the very top have speed and latency selections.

There are other ways to modify these settings (including scripting them in your emulator setup), but this is the simplest way to access the settings.

0

I would reference this thread: https://serverfault.com/questions/201588/configuring-a-router-to-drop-packets-introduce-latency-corrupt-data

Doesn't seem to be any reason iptables shouldn't work.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .