Skip to contentSkip to conversation

Transfer rate above the desired (tc+htb)

LARTC Alvaro Motta 4 participants 6 messages Jul 20, 2005 – Jul 24, 2005

lore
Share & tools
lore
#0 lore raw

Hi folks.

I started to play with tc+htb last week, and I must confess that this thing is really driving me nuts.

All we want to do is control bw, with no borrowing.

In order to get the feeling on this subject, I have setup the following test bed.

---A---B---C---

On B: eth0 connecting A and eth1 connecting C.

The script.

tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 1: htb default 50
tc class add dev eth0 parent 1: classid 1:1 htb rate 32kbit ceil 32kbit tc filter add dev eth0 protocol ip parent 1:0 prio 100 u32 match ip src 10.4.0.0/16 match ip dst 0.0.0.0/0 classid 1:1

If I try to transfer a 1M file from C to A:

[root@localpost tmp]# wget 192.168.0.23/1M --09:22:32-- http://192.168.0.23/1M => `1M.8' Connecting to 192.168.0.23:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1,024,000 [text/plain]
100%[===========>] 1,024,000 183.12K/s ETA 00:00
09:22:38 (182.88 KB/s) - `1M' saved [1,024,000/1,024,000]

Wasn't it supposed to be around the 32KB/s?

If I play with the numbers (rateÎil) I get the following results:
128k => 404.78 KB/s
64k => 337.9 KB/s
16k => 68.86 KB/s
8k => 31.12 KB/s
1k => 3.77 KB/s

I even tried to set the rate to 1kbps in root, but also led to pretty much the same results.

With no qdisc, the rate will go close to 1000 KB/s

B machine:
2.6.11-1.1369_FC4
iproute-2.6.11-1
TC HTB version 3.3

I have no clue on what I am doing wrong. Could anyone browse the above script and give me hint?

Thanks in advance,

AL
_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

#1 lore raw
Quoted 14 lines · Alvaro Motta

Hi folks.

I started to play with tc+htb last week, and I must confess that this thing is really driving me nuts.

All we want to do is control bw, with no borrowing.

In order to get the feeling on this subject, I have setup the following test bed.

---A---B---C---

On B: eth0 connecting A and eth1 connecting C.

Quoted 7 lines

The script.

tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 1: htb default 50
tc class add dev eth0 parent 1: classid 1:1 htb rate 32kbit ceil 32kbit tc filter add dev eth0 protocol ip parent 1:0 prio 100 u32 match ip src 10.4.0.0/16 match ip dst 0.0.0.0/0 classid 1:1

Should be src 192.168.0.0/24.

Andy.

Quoted 33 lines

If I try to transfer a 1M file from C to A:

[root@localpost tmp]# wget 192.168.0.23/1M --09:22:32-- http://192.168.0.23/1M => `1M.8' Connecting to 192.168.0.23:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1,024,000 [text/plain]
100%[===========>] 1,024,000 183.12K/s ETA 00:00
09:22:38 (182.88 KB/s) - `1M' saved [1,024,000/1,024,000]

Wasn't it supposed to be around the 32KB/s?

If I play with the numbers (rateÎil) I get the following results:
128k => 404.78 KB/s
64k => 337.9 KB/s
16k => 68.86 KB/s
8k => 31.12 KB/s
1k => 3.77 KB/s

I even tried to set the rate to 1kbps in root, but also led to pretty much the same results.

With no qdisc, the rate will go close to 1000 KB/s

B machine:
2.6.11-1.1369_FC4
iproute-2.6.11-1
TC HTB version 3.3

I have no clue on what I am doing wrong. Could anyone browse the above script and give me hint?

Quoted 8 lines

Thanks in advance,

AL
_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

#2 lore raw
In reply to Alvaro Motta

Hi Andy, thanks for your reply.

I don't see why the src should be the culprit, since the AB segment is 10.4 network and the BC is 192.168. And IMHO 0.0.0.0/0

Also, after modifying the src, the traffic rate was the same as if no qdisc were attached to the interface. I even played with the interfaces and the only way to throttle the traffic, is assigning the qdisc to the eth0 and having the src and dst as in the script I've sent.

AL

Quoted 23 lines · Andy Furniss
Quoted 14 lines · Alvaro Motta

Hi folks.

I started to play with tc+htb last week, and I must confess that this thing is really driving me nuts.

All we want to do is control bw, with no borrowing.

In order to get the feeling on this subject, I have setup the following test bed.

---A---B---C---

On B: eth0 connecting A and eth1 connecting C.

Quoted 7 lines

The script.

tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 1: htb default 50
tc class add dev eth0 parent 1: classid 1:1 htb rate 32kbit ceil 32kbit tc filter add dev eth0 protocol ip parent 1:0 prio 100 u32 match ip src 10.4.0.0/16 match ip dst 0.0.0.0/0 classid 1:1

Quoted 48 lines

Should be src 192.168.0.0/24.

Andy.

Quoted 41 lines

If I try to transfer a 1M file from C to A:

[root@localpost tmp]# wget 192.168.0.23/1M --09:22:32-- http://192.168.0.23/1M => `1M.8' Connecting to 192.168.0.23:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1,024,000 [text/plain]
100%[===========>] 1,024,000 183.12K/s ETA 00:00
09:22:38 (182.88 KB/s) - `1M' saved [1,024,000/1,024,000]

Wasn't it supposed to be around the 32KB/s?

If I play with the numbers (rateÎil) I get the following results:
128k => 404.78 KB/s
64k => 337.9 KB/s
16k => 68.86 KB/s
8k => 31.12 KB/s
1k => 3.77 KB/s

I even tried to set the rate to 1kbps in root, but also led to pretty much the same results.

With no qdisc, the rate will go close to 1000 KB/s

B machine:
2.6.11-1.1369_FC4
iproute-2.6.11-1
TC HTB version 3.3

I have no clue on what I am doing wrong. Could anyone browse the above script and give me hint?

Thanks in advance,

AL
_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

#3 lore raw
In reply to Alvaro Motta
Quoted 9 lines · Alvaro Motta

Hi Andy, thanks for your reply.

I don't see why the src should be the culprit, since the AB segment is 10.4 network and the BC is 192.168. And IMHO 0.0.0.0/0

Also, after modifying the src, the traffic rate was the same as if no qdisc were attached to the interface. I even played with the interfaces and the only way to throttle the traffic, is assigning the qdisc to the eth0 and having the src and dst as in the script I've

Hmm I am confused now :-)

If you run wget on machine A with address 10.4.x.y and request a file from machine C address 192.168.0.23 then the source address of the packets passing egress eth0 on machine B should be 192.168.0.23 - unless there is some sort of NAT going on in machine B.

FWIW you use default 50 on your htb rule but don't have a class 1:50 and your filter rule dst 0.0.0.0/0 matches any dst ipaddress and so is redundant.

Maybe you should as a test limit all IP traffic on eth0 and see if that works -

tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 1: htb
tc class add dev eth0 parent 1: classid 1:1 htb rate 32kbit ceil 32kbit tc filter add dev eth0 protocol ip parent 1:0 prio 100 u32 match u32 0 0 classid 1:1

Andy.
_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

#4 lore raw
In reply to Alvaro Motta
Quoted 1 line · Alvaro Motta

Hi folks.

Hola.

Quoted 2 lines

I started to play with tc+htb last week, and I must confess that this thing is really driving me nuts.

If you started last week, you have a loooong way to go.... :-)

Quoted 27 lines

All we want to do is control bw, with no borrowing.

In order to get the feeling on this subject, I have setup the following test bed.

---A---B---C---

On B: eth0 connecting A and eth1 connecting C.

The script.

tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 1: htb default 50
tc class add dev eth0 parent 1: classid 1:1 htb rate 32kbit ceil 32kbit tc filter add dev eth0 protocol ip parent 1:0 prio 100 u32 match ip src 10.4.0.0/16 match ip dst 0.0.0.0/0 classid 1:1

If I try to transfer a 1M file from C to A:

[root@localpost tmp]# wget 192.168.0.23/1M --09:22:32-- http://192.168.0.23/1M => `1M.8' Connecting to 192.168.0.23:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1,024,000 [text/plain]
100%[===========>] 1,024,000 183.12K/s ETA 00:00
09:22:38 (182.88 KB/s) - `1M' saved [1,024,000/1,024,000]

Quoted 1 line

Wasn't it supposed to be around the 32KB/s?

Around 32 kilobits/s. Besides this, the rate calculation includes not only the ip packet effective payload, but all the packet size, and I guess that wget's speed calculation only includes the payload.

The tc manpage have a section on "Units".

Quoted 20 lines

If I play with the numbers (rateÎil) I get the following results:
128k => 404.78 KB/s
64k => 337.9 KB/s
16k => 68.86 KB/s
8k => 31.12 KB/s
1k => 3.77 KB/s

I even tried to set the rate to 1kbps in root, but also led to pretty much the same results.

With no qdisc, the rate will go close to 1000 KB/s

B machine:
2.6.11-1.1369_FC4
iproute-2.6.11-1
TC HTB version 3.3

I have no clue on what I am doing wrong. Could anyone browse the above script and give me hint?

Quoted 9 lines

Thanks in advance,

AL
_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

#5 lore raw
In reply to Alvaro Motta
Quoted 6 lines · Alvaro Motta

Hi Andy, thanks for your reply.

I don't see why the src should be the culprit, since the AB segment is 10.4 network and the BC is 192.168. And IMHO 0.0.0.0/0

Quoted 7 lines

Also, after modifying the src, the traffic rate was the same as if no qdisc were attached to the interface. I even played with the interfaces and the only way to throttle the traffic, is assigning the qdisc to the eth0 and having the src and dst as in the script I've sent.

AL

Al,

Somebody may have already helped you solve this; I have not read all messages from LARTC yet. If not:
Create 3 filters, each with the same (non zero) prio. The first to match 10.4.0.0/16, the second to match 192.168.0.0/24 and the last to match 0.0.0.0/0 - then see where the packets go by running tc -s class ls dev eth0

32kbit = 32,000 bits per second. 32,000 / 8 bits per byte = 4,000 bytes per second = 4Kbytes per second, and the reported flow rate should be close to that for the packets that match the filter.
--
gypsy

Quoted 72 lines · Andy Furniss
Quoted 23 lines
Quoted 14 lines · Alvaro Motta

Hi folks.

I started to play with tc+htb last week, and I must confess that this thing is really driving me nuts.

All we want to do is control bw, with no borrowing.

In order to get the feeling on this subject, I have setup the following test bed.

---A---B---C---

On B: eth0 connecting A and eth1 connecting C.

Quoted 7 lines

The script.

tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 1: htb default 50
tc class add dev eth0 parent 1: classid 1:1 htb rate 32kbit ceil 32kbit tc filter add dev eth0 protocol ip parent 1:0 prio 100 u32 match ip src 10.4.0.0/16 match ip dst 0.0.0.0/0 classid 1:1

Quoted 48 lines

Should be src 192.168.0.0/24.

Andy.

Quoted 41 lines

If I try to transfer a 1M file from C to A:

[root@localpost tmp]# wget 192.168.0.23/1M --09:22:32-- http://192.168.0.23/1M => `1M.8' Connecting to 192.168.0.23:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1,024,000 [text/plain]
100%[===========>] 1,024,000 183.12K/s ETA 00:00
09:22:38 (182.88 KB/s) - `1M' saved [1,024,000/1,024,000]

Wasn't it supposed to be around the 32KB/s?

If I play with the numbers (rateÎil) I get the following results:
128k => 404.78 KB/s
64k => 337.9 KB/s
16k => 68.86 KB/s
8k => 31.12 KB/s
1k => 3.77 KB/s

I even tried to set the rate to 1kbps in root, but also led to pretty much the same results.

With no qdisc, the rate will go close to 1000 KB/s

B machine:
2.6.11-1.1369_FC4
iproute-2.6.11-1
TC HTB version 3.3

I have no clue on what I am doing wrong. Could anyone browse the above script and give me hint?

Thanks in advance,

AL
_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

Quoted 4 lines

_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc