User avatar
ksharindam
Posts: 162
Joined: Sat Jan 09, 2016 4:16 pm

how to limit internet speed?

Sun Feb 02, 2020 6:17 am

I am using Raspbian, i want to limit internet speed (browsing and downloading) in my computer.
I have tried to use wondershaper by using the command.

Code: Select all

sudo wondershaper wlan0 128 128
But it is not working.
Is there another way to do it?

ktb
Posts: 1447
Joined: Fri Dec 26, 2014 7:53 pm

Re: how to limit internet speed?

Sun Feb 02, 2020 12:59 pm

Why do you think it's not working? Perhaps show us the commands and the resulting output of those commands you are using to test it. It seems to be working for me.

Code: Select all

pi@raspberrypi:~/Downloads $ wget -O /dev/null http://speedtest.wdc01.softlayer.com/downloads/test500.zip
--2020-02-02 07:50:31--  http://speedtest.wdc01.softlayer.com/downloads/test500.zip
Resolving speedtest.wdc01.softlayer.com (speedtest.wdc01.softlayer.com)... 158.85.230.20, 2607:f0d0:3001:78::2
Connecting to speedtest.wdc01.softlayer.com (speedtest.wdc01.softlayer.com)|158.85.230.20|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 524288000 (500M) [application/zip]
Saving to: ‘/dev/null’

/dev/null           100%[==================>] 500.00M  9.69MB/s    in 64s     

2020-02-02 07:51:35 (7.83 MB/s) - ‘/dev/null’ saved [524288000/524288000]

pi@raspberrypi:~/Downloads $ sudo wondershaper wlan0 128 128
pi@raspberrypi:~/Downloads $ sudo wondershaper wlan0
qdisc cbq 1: root refcnt 2 rate 10Mbit (bounded,isolated) prio no-transmit
 Sent 872 bytes 8 pkt (dropped 0, overlimits 2 requeues 0) 
 backlog 0b 0p requeues 0
  borrowed 0 overactions 0 avgidle 12500 undertime 0
qdisc sfq 30: parent 1:30 limit 127p quantum 1514b depth 127 divisor 1024 perturb 10sec 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
qdisc sfq 10: parent 1:10 limit 127p quantum 1514b depth 127 divisor 1024 perturb 10sec 
 Sent 396 bytes 6 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
qdisc sfq 20: parent 1:20 limit 127p quantum 1514b depth 127 divisor 1024 perturb 10sec 
 Sent 476 bytes 2 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
qdisc ingress ffff: parent ffff:fff1 ---------------- 
 Sent 1080 bytes 10 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
class cbq 1: root rate 10Mbit (bounded,isolated) prio no-transmit
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
  borrowed 0 overactions 0 avgidle 12500 undertime 0
class cbq 1:1 parent 1: rate 128Kbit (bounded,isolated) prio 5
 Sent 872 bytes 8 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
  borrowed 0 overactions 0 avgidle -57781 undertime 125863
class cbq 1:10 parent 1:1 leaf 10: rate 128Kbit prio 1
 Sent 396 bytes 6 pkt (dropped 0, overlimits 2 requeues 0) 
 backlog 0b 0p requeues 0
  borrowed 0 overactions 1 avgidle -57781 undertime 125863
class cbq 1:20 parent 1:1 leaf 20: rate 115Kbit prio 2
 Sent 476 bytes 2 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
  borrowed 0 overactions 0 avgidle 12500 undertime 0
class cbq 1:30 parent 1:1 leaf 30: rate 102Kbit prio 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
  borrowed 0 overactions 0 avgidle 12500 undertime 0
pi@raspberrypi:~/Downloads $ wget -O /dev/null http://speedtest.wdc01.softlayer.com/downloads/test500.zip
--2020-02-02 07:52:39--  http://speedtest.wdc01.softlayer.com/downloads/test500.zip
Resolving speedtest.wdc01.softlayer.com (speedtest.wdc01.softlayer.com)... 158.85.230.20, 2607:f0d0:3001:78::2
Connecting to speedtest.wdc01.softlayer.com (speedtest.wdc01.softlayer.com)|158.85.230.20|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 524288000 (500M) [application/zip]
Saving to: ‘/dev/null’

/dev/null             0%[                   ]   4.33M  14.6KB/s    eta 9h 30m ^C

User avatar
DougieLawson
Posts: 38810
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: how to limit internet speed?

Sun Feb 02, 2020 1:20 pm

Try
sudo pip3 install speedtest-cli
speedtest-cli

Code: Select all

dougie@apollo:~$ speedtest-cli
Retrieving speedtest.net configuration...
Testing from Plusnet (146.200.xxx.xxx)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Zzoomm (Henley-on-Thames) [29.13 km]: 24.278 ms
Testing download speed................................................................................
Download: 11.41 Mbit/s
Testing upload speed......................................................................................................
Upload: 4.56 Mbit/s
dougie@apollo:~$
That should show whether your traffic shaping with tc (hidden inside the wondershaper script) is working.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
ksharindam
Posts: 162
Joined: Sat Jan 09, 2016 4:16 pm

Re: how to limit internet speed?

Sun Feb 02, 2020 1:34 pm

ok, it's working in case of downloading. but when I am watching youtube video, the speed is same. even after throttling the speed, youtube is buffering very fast.

User avatar
ksharindam
Posts: 162
Joined: Sat Jan 09, 2016 4:16 pm

Re: how to limit internet speed?

Sun Feb 02, 2020 1:35 pm

Why youtube buffering speed is not controlled?
I am using chromium browser.

ktb
Posts: 1447
Joined: Fri Dec 26, 2014 7:53 pm

Re: how to limit internet speed?

Sun Feb 02, 2020 1:54 pm

Did you refresh the YouTube page after configuring wondershaper?

I just tested https://www.youtube.com/watch?v=44wDwMQVqCc

And I get pretty slow, non-continuous playback with 128. Buffering is not fast and I'm frequently running out of buffered content.

User avatar
ksharindam
Posts: 162
Joined: Sat Jan 09, 2016 4:16 pm

Re: how to limit internet speed?

Sun Feb 02, 2020 3:53 pm

ktb wrote:
Sun Feb 02, 2020 1:54 pm
Did you refresh the YouTube page after configuring wondershaper?
Yes, even I have restarted chromium. But it is still buffering very fast.

ktb
Posts: 1447
Joined: Fri Dec 26, 2014 7:53 pm

Re: how to limit internet speed?

Sun Feb 02, 2020 5:34 pm

I don't know why that is... What type of internet connection are you using? A mobile broadband (3G/4G/5G) connection?

User avatar
ksharindam
Posts: 162
Joined: Sat Jan 09, 2016 4:16 pm

Re: how to limit internet speed?

Mon Feb 03, 2020 8:40 am

I have connected my raspberry pi to a mobile phone hotspot. the phone has 4G data connection.

Return to “Raspberry Pi OS”