Skip to content

Commit 32b9078

Browse files
author
Catalin(ux) M. BOIE
committed
Added a good example for tc prio classification.
1 parent ee8ee8e commit 32b9078

2 files changed

Lines changed: 36 additions & 2 deletions

File tree

README

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,21 @@ Examples:
9696
14: Force priority (between 0 and 6 for non-root users). You can
9797
use 'tc' command from iproute to set-up 'prio' qdisc and to
9898
assign prio to queues:
99+
# 0. setup
99100
export FORCE_NET_VERBOSE=1
100-
export FORCE_NET_PRIO=2
101101
export LD_PRELOAD=${LD_PRELOAD}:/usr/lib/force_bind.so
102-
your_program_here
102+
# 1. Make sure you have a 'prio' qdisc attached to eth0, for example:
103+
tc qdisc add ev eth0 root handle 1: prio
104+
# 2. Assign applications to classed (bands):
105+
export FORCE_NET_PRIO=6 # interactive, band 0
106+
your_voip_program_here
107+
export FORCE_NET_PRIO=0 # best effort, band 1
108+
your_mail_program_here
109+
export FORCE_NET_PRIO=2 # bulk, band 2
110+
your_remote_backup_program_here
111+
# 3. Run tc statistics so you can see the classification:
112+
tc -s class show dev eth0
113+
103114

104115
Installation:
105116
- ./configure

test_bw4.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/sh
2+
3+
# Test setting priority and clasification in prio qdisc
4+
5+
ulimit -c2000000
6+
7+
export FORCE_NET_VERBOSE=1
8+
9+
export LD_PRELOAD="${LD_PRELOAD}:./force_bind.so"
10+
11+
# 6 = Interactive (band 0)
12+
export FORCE_NET_PRIO=6
13+
strace -o ${0}.band0 ./send_udp 123 3000 &
14+
15+
# 0 = best effors (band 1)
16+
export FORCE_NET_PRIO=0
17+
strace -o ${0}.band1 ./send_udp 123 3000 &
18+
19+
# 2 = bulk (band 2)
20+
export FORCE_NET_PRIO=2
21+
strace -o ${0}.band2 ./send_udp 123 3000 &
22+
23+
wait

0 commit comments

Comments
 (0)