TC (HTB) doesn't work well when network is congested?

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I have a server and ten clients in a Gigabit network. The server has 125mbps network bandwidth. I want that the server has 40Mbps bandwidth reserved for client 1 (IP 192.168.5.141), and the
rest bandwidth is for all other clients.

My script looks like this (I use IFB for incoming traffic):

#!/bin/bash

export TC="/sbin/tc"

$TC qdisc add dev ifb0 root handle 1: htb default 30 r2q 100

$TC class add dev ifb0 parent 1:0 classid 1:1 htb rate 125mbps mtu 9000
$TC class add dev ifb0 parent 1:1 classid 1:10 htb rate 40mbps ceil 125mbps mtu 9000 prio 0 $TC class add dev ifb0 parent 1:1 classid 1:30 htb rate 85mbps ceil 125mbps mtu 9000 prio 1

$TC filter add dev ifb0 parent 1: protocol ip prio 1 u32 match ip src 192.168.5.141/32 flowid 1:10

$TC qdisc add dev eth2 ingress
$TC filter add dev eth2 parent ffff: protocol ip prio 1 u32 \
       match u32 0 0 flowid 1:1 \
       action mirred egress redirect dev ifb0

$TC qdisc add dev eth2 root handle 1: htb default 30 r2q 100

$TC class add dev eth2 parent 1: classid 1:1 htb rate 125mbps mtu 9000
$TC class add dev eth2 parent 1:1 classid 1:10 htb rate 40mbps ceil 125mbps mtu 9000 prio 0 $TC class add dev eth2 parent 1:1 classid 1:30 htb rate 85mbps ceil 125mbps mtu 9000 prio 1

$TC filter add dev eth2 parent 1: protocol ip prio 1 u32 match ip dst 192.168.5.141/32 classid 1:10

I ran a test in which all 10 clients send/receive packets to/from the server simultaneously. But Client 1 only got 20mbps bandwidth for sending, and 38mpbs for receiving. If I limit the rate of both classes 1:1 to 60mbps instead of 125mbps, Client 1 got 39mbps for sending, and 40mbps for
receiving.

I am not sure what might cause this. Is it because TC doesn't work well when network is congested?
Or my script is not right?

Thanks a lot,
william



_______________________________________________
LARTC mailing list
LARTC@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux