Skip to contentSkip to conversation

Tc does not seem to be limiting bandwidth

DISCUSSION Neil Aggarwal 4 participants 16 messages Feb 1, 2013 – Feb 10, 2013

lore
Share & tools
lore
#0 lore raw

Hello:

I have these commands in my firewall startup script:

DEV=v1252
IP=a.b.c.d
/sbin/tc qdisc del dev $DEV root
/sbin/tc qdisc add dev $DEV root handle 1: htb default 30 /sbin/tc class add dev $DEV parent 1: classid 1:1 htb rate 10mbit /sbin/tc class add dev $DEV parent 1: classid 1:2 htb rate 10mbit /sbin/tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip dst $IP flowid 1:1
/sbin/tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip src $IP flowid 1:2

And tc qdisc list shows it has something for that dev:

qdisc htb 1: dev v1252 root refcnt 2 r2q 10 default 30 direct_packets_stat 3

But, I am still seeing huge consumption of bandwidth from that server. Take a look at the attached graph.

Any ideas why tc is not limiting the bandwidth?

Thanks,
Neil

--
Neil Aggarwal, (972)834-1565, http://UnmeteredVPS.net/centos
Virtual private server with CentOS 6 preinstalled Unmetered bandwidth = no overage charges

#1 lore raw

your device, may not have a queue length,

try

ip link set $DEV txqueuelen 1000

and see whether it limits correctly.

Quoted 31 lines · Neil Aggarwal

Hello:

I have these commands in my firewall startup script:

DEV=v1252
IP=a.b.c.d
/sbin/tc qdisc del dev $DEV root
/sbin/tc qdisc add dev $DEV root handle 1: htb default 30 /sbin/tc class add dev $DEV parent 1: classid 1:1 htb rate 10mbit /sbin/tc class add dev $DEV parent 1: classid 1:2 htb rate 10mbit /sbin/tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip dst $IP flowid 1:1
/sbin/tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip src $IP flowid 1:2

And tc qdisc list shows it has something for that dev:

qdisc htb 1: dev v1252 root refcnt 2 r2q 10 default 30 direct_packets_stat 3

But, I am still seeing huge consumption of bandwidth from that server. Take a look at the attached graph.

Any ideas why tc is not limiting the bandwidth?

Thanks,
Neil

--
Neil Aggarwal, (972)834-1565, http://UnmeteredVPS.net/centos
Virtual private server with CentOS 6 preinstalled Unmetered bandwidth = no overage charges

#2 lore raw
In reply to Neil Aggarwal

your device, may not have a queue length,

try

ip link set $DEV txqueuelen 1000

and see whether it limits correctly.

Quoted 40 lines · 叶雨飞

your device, may not have a queue length,

try

ip link set $DEV txqueuelen 1000

and see whether it limits correctly.

Quoted 31 lines · Neil Aggarwal

Hello:

I have these commands in my firewall startup script:

DEV=v1252
IP=a.b.c.d
/sbin/tc qdisc del dev $DEV root
/sbin/tc qdisc add dev $DEV root handle 1: htb default 30 /sbin/tc class add dev $DEV parent 1: classid 1:1 htb rate 10mbit /sbin/tc class add dev $DEV parent 1: classid 1:2 htb rate 10mbit /sbin/tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip dst $IP flowid 1:1
/sbin/tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip src $IP flowid 1:2

And tc qdisc list shows it has something for that dev:

qdisc htb 1: dev v1252 root refcnt 2 r2q 10 default 30 direct_packets_stat 3

But, I am still seeing huge consumption of bandwidth from that server. Take a look at the attached graph.

Any ideas why tc is not limiting the bandwidth?

Thanks,
Neil

--
Neil Aggarwal, (972)834-1565, http://UnmeteredVPS.net/centos
Virtual private server with CentOS 6 preinstalled Unmetered bandwidth = no overage charges

#3 lore raw
In reply to Neil Aggarwal

I added the call to ip link set and I am still seeing huge bandwidth consumption. Any other ideas?

Thanks,
Neil

--
Neil Aggarwal, (972) 834-1565
We lend money to investors to buy or refinance single family rent houses. No origination fees, quick approval, no credit check.

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Outofwall.com
Sent: Friday, February 01, 2013 2:00 PM
To: Neil Aggarwal
Cc: [email protected]
Subject: Re: Tc does not seem to be limiting bandwidth

your device, may not have a queue length,

try

ip link set $DEV txqueuelen 1000

and see whether it limits correctly.

Quoted 40 lines · 叶雨飞

your device, may not have a queue length,

try

ip link set $DEV txqueuelen 1000

and see whether it limits correctly.

Quoted 31 lines · Neil Aggarwal

Hello:

I have these commands in my firewall startup script:

DEV=v1252
IP=a.b.c.d
/sbin/tc qdisc del dev $DEV root
/sbin/tc qdisc add dev $DEV root handle 1: htb default 30 /sbin/tc class add dev $DEV parent 1: classid 1:1 htb rate 10mbit /sbin/tc class add dev $DEV parent 1: classid 1:2 htb rate 10mbit /sbin/tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip dst $IP flowid 1:1
/sbin/tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip src $IP flowid 1:2

And tc qdisc list shows it has something for that dev:

qdisc htb 1: dev v1252 root refcnt 2 r2q 10 default 30 direct_packets_stat 3

But, I am still seeing huge consumption of bandwidth from that server. Take a look at the attached graph.

Any ideas why tc is not limiting the bandwidth?

Thanks,
Neil

--
Neil Aggarwal, (972)834-1565, http://UnmeteredVPS.net/centos
Virtual private server with CentOS 6 preinstalled Unmetered bandwidth = no overage charges

--
To unsubscribe from this list: send the line "unsubscribe lartc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
In reply to Neil Aggarwal
Quoted 4 lines · Neil Aggarwal

Hello:

I have these commands in my firewall startup script:

Quoted 10 lines

DEV=v1252
IP=a.b.c.d
/sbin/tc qdisc del dev $DEV root
/sbin/tc qdisc add dev $DEV root handle 1: htb default 30 /sbin/tc class add dev $DEV parent 1: classid 1:1 htb rate 10mbit /sbin/tc class add dev $DEV parent 1: classid 1:2 htb rate 10mbit /sbin/tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip dst $IP flowid 1:1
/sbin/tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip src $IP flowid 1:2

You're setting a rate value but not a ceil value. Rate values can be exceeded, ceil values cannot.

You may also need an extra class with an overall rate limit, and then your leaf classes attached to that (I don't know if that's required, but the examples I have seen have used that). I can provide examples if needed.

Andy

#5 lore raw
In reply to Neil Aggarwal

Andy (Copy to LARTC):

Quoted 2 lines

You're setting a rate value but not a ceil value. [...] I can provide examples if needed.

An example would be nice.

I also tried using the token bucket filter:
/sbin/tc qdisc add dev $DEV root tbf rate 1mbit latency 5ms burst 2048

Which also does not seem to be limiting the bandwidth.

I appreciate any help you can offer.

Thank you,
Neil

--
Neil Aggarwal, (972) 834-1565
We lend money to investors to buy or refinance single family rent houses. No origination fees, quick approval, no credit check.

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Andrew Beverley
Sent: Sunday, February 03, 2013 3:35 PM
To: Neil Aggarwal
Cc: [email protected]
Subject: Re: Tc does not seem to be limiting bandwidth

Quoted 4 lines · Neil Aggarwal

Hello:

I have these commands in my firewall startup script:

Quoted 10 lines

DEV=v1252
IP=a.b.c.d
/sbin/tc qdisc del dev $DEV root
/sbin/tc qdisc add dev $DEV root handle 1: htb default 30 /sbin/tc class add dev $DEV parent 1: classid 1:1 htb rate 10mbit /sbin/tc class add dev $DEV parent 1: classid 1:2 htb rate 10mbit /sbin/tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip dst $IP flowid 1:1
/sbin/tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip src $IP flowid 1:2

Andy

--
To unsubscribe from this list: send the line "unsubscribe lartc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw
In reply to Neil Aggarwal

Hello all:

It looks like tc thinks I set a token bucket filter on my interface:

# tc -s qdisc ls dev v1252
qdisc tbf 8006: root refcnt 2 rate 1000Kbit burst 2Kb lat 5.0ms
 Sent 6788208 bytes 51190 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0

But I am still seeing bandwidth consumption hitting 80mbit/sec.

Any ideas why it would not be working?
This is a CentOS server with all the latest updates installed. V1252 is a KVM guest running on the machine.

Thank you,
Neil

--
Neil Aggarwal, (972)834-1565, http://UnmeteredVPS.net/centos
Virtual private server with CentOS 6 preinstalled Unmetered bandwidth = no overage charges

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Neil Aggarwal
Sent: Friday, February 01, 2013 1:20 PM
To: [email protected]
Subject: Tc does not seem to be limiting bandwidth

Hello:

I have these commands in my firewall startup script:

DEV=v1252
IP=a.b.c.d
/sbin/tc qdisc del dev $DEV root
/sbin/tc qdisc add dev $DEV root handle 1: htb default 30 /sbin/tc class add dev $DEV parent 1: classid 1:1 htb rate 10mbit /sbin/tc class add dev $DEV parent 1: classid 1:2 htb rate 10mbit /sbin/tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip dst $IP flowid 1:1
/sbin/tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip src $IP flowid 1:2

And tc qdisc list shows it has something for that dev:

qdisc htb 1: dev v1252 root refcnt 2 r2q 10 default 30 direct_packets_stat 3

But, I am still seeing huge consumption of bandwidth from that server. Take a look at the attached graph.

Any ideas why tc is not limiting the bandwidth?

Thanks,
Neil

--
Neil Aggarwal, (972)834-1565, http://UnmeteredVPS.net/centos
Virtual private server with CentOS 6 preinstalled Unmetered bandwidth = no overage charges

#7 lore raw
In reply to Neil Aggarwal

To set a ceil value, just add ceil 10Mbit after your rate 10Mbit in your HTB script.

BTW, please fix your spam detector, i call it racism to think all email contains Chinese character as spam.

Quoted 66 lines · Neil Aggarwal

Hello all:

It looks like tc thinks I set a token bucket filter on my interface:

# tc -s qdisc ls dev v1252
qdisc tbf 8006: root refcnt 2 rate 1000Kbit burst 2Kb lat 5.0ms
 Sent 6788208 bytes 51190 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0

But I am still seeing bandwidth consumption hitting 80mbit/sec.

Any ideas why it would not be working?
This is a CentOS server with all the latest updates installed. V1252 is a KVM guest running on the machine.

Thank you,
Neil

--
Neil Aggarwal, (972)834-1565, http://UnmeteredVPS.net/centos
Virtual private server with CentOS 6 preinstalled Unmetered bandwidth = no overage charges

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Neil Aggarwal
Sent: Friday, February 01, 2013 1:20 PM
To: [email protected]
Subject: Tc does not seem to be limiting bandwidth

Hello:

I have these commands in my firewall startup script:

DEV=v1252
IP=a.b.c.d
/sbin/tc qdisc del dev $DEV root
/sbin/tc qdisc add dev $DEV root handle 1: htb default 30 /sbin/tc class add dev $DEV parent 1: classid 1:1 htb rate 10mbit /sbin/tc class add dev $DEV parent 1: classid 1:2 htb rate 10mbit /sbin/tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip dst $IP flowid 1:1
/sbin/tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip src $IP flowid 1:2

And tc qdisc list shows it has something for that dev:

qdisc htb 1: dev v1252 root refcnt 2 r2q 10 default 30 direct_packets_stat 3

But, I am still seeing huge consumption of bandwidth from that server. Take a look at the attached graph.

Any ideas why tc is not limiting the bandwidth?

Thanks,
Neil

--
Neil Aggarwal, (972)834-1565, http://UnmeteredVPS.net/centos
Virtual private server with CentOS 6 preinstalled Unmetered bandwidth = no overage charges

--
To unsubscribe from this list: send the line "unsubscribe lartc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw
In reply to Neil Aggarwal

Hello all:

I think I figured out something.

I am able to filter the download bandwidth to a VPS server, but not the upload bandwidth.

How do I filter the upload bandwidth for a VPS server?

Thank you,
Neil

--
Neil Aggarwal, (972)834-1565, http://UnmeteredVPS.net/centos
Virtual private server with CentOS 6 preinstalled Unmetered bandwidth = no overage charges

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Neil Aggarwal
Sent: Sunday, February 03, 2013 5:56 PM
To: [email protected]
Subject: RE: Tc does not seem to be limiting bandwidth

Hello all:

It looks like tc thinks I set a token bucket filter on my interface:

# tc -s qdisc ls dev v1252
qdisc tbf 8006: root refcnt 2 rate 1000Kbit burst 2Kb lat 5.0ms
 Sent 6788208 bytes 51190 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0

But I am still seeing bandwidth consumption hitting 80mbit/sec.

Any ideas why it would not be working?
This is a CentOS server with all the latest updates installed. V1252 is a KVM guest running on the machine.

Thank you,
Neil

--
Neil Aggarwal, (972)834-1565, http://UnmeteredVPS.net/centos
Virtual private server with CentOS 6 preinstalled Unmetered bandwidth = no overage charges

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Neil Aggarwal
Sent: Friday, February 01, 2013 1:20 PM
To: [email protected]
Subject: Tc does not seem to be limiting bandwidth

Hello:

I have these commands in my firewall startup script:

DEV=v1252
IP=a.b.c.d
/sbin/tc qdisc del dev $DEV root
/sbin/tc qdisc add dev $DEV root handle 1: htb default 30 /sbin/tc class add dev $DEV parent 1: classid 1:1 htb rate 10mbit /sbin/tc class add dev $DEV parent 1: classid 1:2 htb rate 10mbit /sbin/tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip dst $IP flowid 1:1
/sbin/tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip src $IP flowid 1:2

And tc qdisc list shows it has something for that dev:

qdisc htb 1: dev v1252 root refcnt 2 r2q 10 default 30 direct_packets_stat 3

But, I am still seeing huge consumption of bandwidth from that server. Take a look at the attached graph.

Any ideas why tc is not limiting the bandwidth?

Thanks,
Neil

--
Neil Aggarwal, (972)834-1565, http://UnmeteredVPS.net/centos
Virtual private server with CentOS 6 preinstalled Unmetered bandwidth = no overage charges

--
To unsubscribe from this list: send the line "unsubscribe lartc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#9 lore raw
In reply to Neil Aggarwal
Quoted 8 lines · Neil Aggarwal

Hello all:

I think I figured out something.

I am able to filter the download bandwidth to a VPS server, but not the upload bandwidth.

How do I filter the upload bandwidth for a VPS server?

A VPS server shouldn't be any different to a normal server (although I have never tried). Are you sure you are attaching to the correct interface and doing the correct egress/ingress shaping? It won't limit both ways by default.

Can you post your rules that are/aren't working please?

Andy

#10 lore raw
In reply to Neil Aggarwal
Quoted 2 lines · 叶雨飞

BTW, please fix your spam detector, i call it racism to think all email contains Chinese character as spam.

Nope, I'm getting the delivery failures as well. Neil - please turn off your spam rejections for people who are trying to help you ;-)

#11 lore raw
In reply to Neil Aggarwal

Andrew:

Quoted 1 line

Can you post your rules that are/aren't working please?

Here are the rules I am using. They throttle the bandwidth into the VPS just fine, but they are not working to throttle the bandwidth out of the VPS:

IP=a.b.c.d
DEV=v1208
/sbin/tc qdisc del dev $DEV root
/sbin/tc qdisc add dev $DEV root handle 1: htb default 30
/sbin/tc class add dev $DEV parent 1: classid 1:1 htb rate 500kbit /sbin/tc class add dev $DEV parent 1: classid 1:2 htb rate 500kbit /sbin/tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip dst $IP flowid 1:1 /sbin/tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip src $IP flowid 1:2

Thank you,
Neil

--
Neil Aggarwal, (972)834-1565, http://UnmeteredVPS.net/centos
Virtual private server with CentOS 6 preinstalled Unmetered bandwidth = no overage charges

#12 lore raw
In reply to Neil Aggarwal
Quoted 8 lines · Neil Aggarwal

Andrew:

Quoted 1 line

Can you post your rules that are/aren't working please?

Here are the rules I am using. They throttle the bandwidth into the VPS just fine, but they are not working to throttle the bandwidth out of the VPS:

Quoted 8 lines

IP=a.b.c.d
DEV=v1208
/sbin/tc qdisc del dev $DEV root
/sbin/tc qdisc add dev $DEV root handle 1: htb default 30
/sbin/tc class add dev $DEV parent 1: classid 1:1 htb rate 500kbit /sbin/tc class add dev $DEV parent 1: classid 1:2 htb rate 500kbit /sbin/tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip dst $IP flowid 1:1 /sbin/tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip src $IP flowid 1:2

Assuming that these are your only rules, these will be doing the egress from device v1208, which I am assuming is the upload for the VPS.

If that is the case, you'll need an ingress for the download. The following page has an example:

http://blog.stevedoria.net/20050906/ingress-policing-with-linux-and-tc

#13 lore raw
In reply to Neil Aggarwal
Quoted 4 lines · Neil Aggarwal

Andrew:

Just post your responses to the list.
There is no need to send me email directly.

Of course, I can try to remember to do so for your particular posts to that particular mailing list, although I'd have to rearrange the email addresses as neither a reply-to or reply-all would work.

But it's better netiquette for you not to reject people's emails.

#14 lore raw
In reply to Neil Aggarwal

Andy:

Quoted 1 line

If that is the case, you'll need an ingress

You were right, I needed to add an ingress filter to limit the upload speed of the VPS. So, now here are my rules:

IP=a.b.c.d
DEV=v1208
/sbin/tc qdisc del dev $DEV root
/sbin/tc qdisc add dev $DEV root handle 1: htb default 30
/sbin/tc class add dev $DEV parent 1: classid 1:1 htb rate 5mbit
/sbin/tc class add dev $DEV parent 1: classid 1:2 htb rate 5mbit
/sbin/tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip dst $IP flowid 1:1
/sbin/tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip src $IP flowid 1:2
/sbin/tc qdisc del dev $DEV ingress
/sbin/tc qdisc add dev $DEV ingress handle ffff:
/sbin/tc filter add dev $DEV parent ffff: protocol ip prio 50 u32 match ip src 0.0.0.0/0 police rate 5mbit burst 500k drop flowid :1

I am attaching a graph that shows the bandwidth during two large file transfers.

The first part of the graph is when I was doing a large download. It sits exactly at 5mbit/sec which is what I want it to do.

Next, I stopped the download and started an upload. That is sitting at about 60kbit/sec and not going any higher.

Any ideas why the ingress rules are limiting the bandwidth so much?

Thank you,
Neil

--
Neil Aggarwal, (972)834-1565, http://UnmeteredVPS.net/centos
Virtual private server with CentOS 6 preinstalled Unmetered bandwidth = no overage charges

#15 lore raw
In reply to Neil Aggarwal
Quoted 16 lines · Andrew Beverley
Quoted 4 lines · Neil Aggarwal

Hello:

I have these commands in my firewall startup script:

Quoted 10 lines

DEV=v1252
IP=a.b.c.d
/sbin/tc qdisc del dev $DEV root
/sbin/tc qdisc add dev $DEV root handle 1: htb default 30 /sbin/tc class add dev $DEV parent 1: classid 1:1 htb rate 10mbit /sbin/tc class add dev $DEV parent 1: classid 1:2 htb rate 10mbit /sbin/tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip dst $IP flowid 1:1
/sbin/tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip src $IP flowid 1:2

Quoted 1 line

You're setting a rate value but not a ceil value.

I should correct this statement that I made. If not specified, a ceil value defaults to the rate value.

Quoted 1 line

Rate values can be exceeded, ceil values cannot.

This, of course, is still true.

Andy