6

Is it possible to limit internet speed of Android device

for example

  • Nexus 7 only internet speed has 300 kbps / 1mbps
  • Nexus 4 only internet speed has 150 kbps / 1mbps
1
  • Do you mean over your WiFi network? Typically you'd configure this on your router. (Yes, I realize this is an old question...)
    – derobert
    Jun 6, 2013 at 21:38

3 Answers 3

3

While not for the faint of heart, how about the Linux command Traffic Control? Check out the man page for a quick run-down.

You'll need root and the Android Terminal Emulator app (or similar). I think this guide will be helpful, especially the script quoted below (although because I'm not rooted I haven't tried it myself). You can either try to run the script using sh or using BASH, or simply type the commands from the script directly in terminal after replacing the variables with your desired values. Let us know how it goes.

#!/bin/bash
#
#  tc uses the following units when passed as a parameter.
#  kbps: Kilobytes per second 
#  mbps: Megabytes per second
#  kbit: Kilobits per second
#  mbit: Megabits per second
#  bps: Bytes per second 
#       Amounts of data can be specified in:
#       kb or k: Kilobytes
#       mb or m: Megabytes
#       mbit: Megabits
#       kbit: Kilobits
#  To get the byte figure from bits, divide the number by 8 bit
#

#
# Name of the traffic control command.
TC=/sbin/tc

# The network interface we're planning on limiting bandwidth.
IF=eth0             # Interface

# Download limit (in mega bits)
DNLD=1mbit          # DOWNLOAD Limit

# Upload limit (in mega bits)
UPLD=1mbit          # UPLOAD Limit

# IP address of the machine we are controlling
IP=216.3.128.12     # Host IP

# Filter options for limiting the intended interface.
U32="$TC filter add dev $IF protocol ip parent 1:0 prio 1 u32"

start() {

# We'll use Hierarchical Token Bucket (HTB) to shape bandwidth.
# For detailed configuration options, please consult Linux man
# page.

    $TC qdisc add dev $IF root handle 1: htb default 30
    $TC class add dev $IF parent 1: classid 1:1 htb rate $DNLD
    $TC class add dev $IF parent 1: classid 1:2 htb rate $UPLD
    $U32 match ip dst $IP/32 flowid 1:1
    $U32 match ip src $IP/32 flowid 1:2

# The first line creates the root qdisc, and the next two lines
# create two child qdisc that are to be used to shape download 
# and upload bandwidth.
#
# The 4th and 5th line creates the filter to match the interface.
# The 'dst' IP address is used to limit download speed, and the 
# 'src' IP address is used to limit upload speed.

}

stop() {

# Stop the bandwidth shaping.
    $TC qdisc del dev $IF root

}

restart() {

# Self-explanatory.
    stop
    sleep 1
    start

}

show() {

# Display status of traffic control status.
    $TC -s qdisc ls dev $IF

}

case "$1" in

  start)

    echo -n "Starting bandwidth shaping: "
    start
    echo "done"
    ;;

  stop)

    echo -n "Stopping bandwidth shaping: "
    stop
    echo "done"
    ;;

  restart)

    echo -n "Restarting bandwidth shaping: "
    restart
    echo "done"
    ;;

  show)

    echo "Bandwidth shaping status for $IF:"
    show
    echo ""
    ;;

  *)

    pwd=$(pwd)
    echo "Usage: tc.bash {start|stop|restart|show}"
    ;;

esac

exit 0
3

Checkout BradyBound. It's a system wide download speed shaper/limiter. Few things to note:

  • The app requires root access.
  • It works by dropping packets using iptables. This wastes some traffic - how much depends on the type of traffic (e.g. long running download, web browsing).
  • Rate measurement is done by number of packets instead of bytes so the speed limit won't be accurate.
  • This only limits TCP traffic (it makes no sense to drop UDP packets).

Note also that I'm the author of this app.

3
  • Any plans to implement upload speed limit and not just download ? Google photos sync is extremely annoying for a shared network. Dec 4, 2015 at 21:58
  • Any chance you could lower the required API version? I'm using Android 4.2.1 and cannot use your app...
    – Kamil
    May 19, 2016 at 15:45
  • A second request for upload limits too?
    – Chris
    Feb 9, 2017 at 17:14
1

Well There is no such app at the moment but google is planning to introduce this in the near future.. Bandwidth Throttling Feature

6
  • No, not data usage, I mean having an internet usage limit in android device
    – GLenn
    Nov 19, 2012 at 8:23
  • do you mean usage through the browser? but should not include apps internet usage such as gmail etc.
    – Dilberted
    Nov 19, 2012 at 8:26
  • All android apps...
    – GLenn
    Nov 19, 2012 at 8:27
  • if you use the application above it will limit the internet usage. you can define a limit and once that limit is reached the applications would not be able to access the internet. I think that is what you want. if not, please clarify in detail.
    – Dilberted
    Nov 19, 2012 at 8:29
  • do you really need an app in the phone? or you may want to use alternate methods as well such methods are without the phone app.
    – Dilberted
    Nov 19, 2012 at 8:48

You must log in to answer this question.

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