I have installed chilli, apache2, hostapd in raspberry pi. User can connect hostspot created by hostapd. Captive portal will open asking id password(because of chilli). Once user sign in, user redirect to the ip(say of raspberry pi,which open local webpages stored in apache server which contains mp4 files to play. and in background user can access internet routed from ethernet to wifi hostspot.

Everything works fine. :)

Now i want to give fix bandwidth (say 128kbps(16KB/s)) to all user so that, they can use all messaging app(whatsapp,hangout,facebook massanger.) which use low traffic, and will not use steaming apps like youtube, torrent, google play update etc.

Besides local server(say ip which contain movies in raspberry pi itself can be accessed friction free without any bandwidth restrictions by users.(exception of traffic control).

How to accomplish this. Please suggest software or packages.

2 Answers 2


This can be done with iproute2 and iptables packages which you probably already have. You will need to mark traffic from different users using iptables, then use those marks to apply rate limits using tc. In simple cases, tc filters can be used to sort packets without the help of iptables. Since you want to limit the Internet traffic of each user individually, you will need as many traffic classes as you have users (plus the unlimited local traffic class).

Here is a nice tutorial explaining how to configure traffic control in Linux.

  • Find the below answer, it works the system without coova-chilli(replaced it with isc-dhcp-server). I mean all local data( server) will be accessed with 10mbit bandwidth and all other site will be accessed with 160kbit. But with coova chilli same script doesn't work. Is that any way to find why this happen? Jan 3, 2018 at 8:04

Install sudo apt-get update sudo apt-get install iproute2

Creat file nano /root/tc.sh. and Enter following commands:

tc qdisc del dev wlan0 root

tc qdisc add dev wlan0 root handle 1: htb default 30
tc class add dev wlan0 parent 1: classid 1:1 htb rate 12mbit burst 15k

tc class add dev wlan0  parent 1:1 classid 1:10 htb rate 11mbit burst 15k
tc class add dev wlan0  parent 1:1 classid 1:30 htb rate 160kbit ceil 160kbit burst 15k

tc qdisc add dev wlan0 parent 1:10 handle 10: sfq perturb 10
tc qdisc add dev wlan0 parent 1:30 handle 30: sfq perturb 10

tc filter add dev wlan0 protocol ip parent 1: prio 1 u32 match ip src match ip sport 80 0xffff flowid 1:10

echo -e 'qdisq:\n'
tc qdisc show dev wlan0

echo -e '\nclass:\n'  
tc class show dev wlan0

echo -e '\nfilter:\n'
tc filter show dev wlan0

run it on boot by placing sh /root/tc.sh before exit0 in nano /etc/rc.local

all details of above script will be find here here and here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.