Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bandwidth throttling using netem?

I am trying to emulate a network as (bitrate: 200kbps , packetloss: 0.03, delay: 400ms) and I am using netem.

tc qdisc add dev eth1 root handle 1:0 netem delay 400ms loss 0.03%
tc qdisc add dev eth1 parent 1:1 handle 10: tbf rate 200kbit buffer 1600 limit 3000

When i run this i am getting error stating

RTNETLINK answers: No such file or directory

Where am I going wrong? how can I do it better?

like image 432
confused1 Avatar asked May 07 '12 11:05

confused1


People also ask

How can i throttle the bandwidth of a Linux server?

In the current environment (as seen in Figure 1), the Linux server plays the role of a router and a NetEM bandwidth throttling device. All the traffic goes through this server. Our requirement was to throttle the bandwidth by adding delay/packet loss/jitter, etc, and also to throttle incoming traffic on TCP port 7001 on eth1, down to 512 kbit/s.

What is netem and how does it work?

Instead it simulates how the page would have loaded on a slower connection. Netem is an OS-level network throttling tool for Linux. There are cross-platform wrappers around it, for example comcast. Here are the timing results for a website with just a single document request.

What is the limit parameter in netem?

The "limit" parameter refers to the number of buffers allocated in the netem module. The limit must be adjusted to support the number of frames delayed (500ms for e.g.) at a given data rate.

Is your ISP throttling your bandwidth?

ISPs usually throttle bandwidth when users download, stream, watch videos and play games, or during the peak hours; Measure your speed once again. If you see that it has improved, it’s quite likely that your ISP throttles you.


2 Answers

tc qdisc add dev eth1 root handle 1:0 tbf rate 200kbit buffer 1600 limit 3000
tc qdisc add dev eth1 parent 1:0 handle 10: netem delay 400ms loss 0.03%

This worked. Seriously not sure about the difference between this two,

like image 148
confused1 Avatar answered Oct 05 '22 07:10

confused1


Please refer http://edseek.com/~jasonb/articles/traffic_shaping/classes.html

--> edseek link is dead - try the archive.is page: http://archive.is/o4UTQ

--> or perhaps better: http://www.lartc.org

==:> and yet another good resource: http://myconfigure.blogspot.com/2012/03/traffic-shaping.html

Please get the below cmds to set eth as per your requirements.

tc qdisc del dev eth1 root
tc qdisc add dev eth1 root handle 1: htb default 1
tc class add dev eth1 parent 1: classid 0:1 htb rate 200kbit
tc qdisc add dev eth1 parent 1:1 handle 10: netem delay 400000 5 loss 0.03%
tc qdisc ls dev eth1
tc class ls dev eth1
like image 32
Kamal Kumar Avatar answered Oct 05 '22 05:10

Kamal Kumar