Wednesday, May 30, 2012

Bandwidth limitation using "TC Command" RedHat /CentOS/Fedora/Ubuntu/SuSe

Use "tc" command.

# tc qdisc add dev eth0 root tbf limit 15Kb buffer 10Kb/8 rate 10Kbps

Check the configuration.

# tc -s qdisc
qdisc tbf 8001: dev eth0 root refcnt 2 rate 80000bit burst 10Kb lat 512.0ms
 Sent 994 bytes 14 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
qdisc pfifo_fast 0: dev eth1 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
 Sent 10861 bytes 156 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
qdisc pfifo_fast 0: dev eth2 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
 Sent 15932 bytes 100 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
qdisc pfifo_fast 0: dev eth3 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
 Sent 1836 bytes 10 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0



If you want to delete the configuration, execute the following command.

# tc qdisc del dev eth0 root

No comments: