HTB.init / tc behind NAT
Posted
by
Ben K.
on Server Fault
See other posts from Server Fault
or by Ben K.
Published on 2011-01-28T04:03:46Z
Indexed on
2012/03/22
17:33 UTC
Read the original article
Hit count: 399
I have an Ubuntu 10 box that I'm trying to set up as a bandwidth-shaping router.
The machine has one WAN interface, eth0 and two LAN interfaces, eth1 and eth2. NAT is configured using MASQUERADE as described at InternetConnectionSharing.
I'm mostly concerned with shaping outbound traffic from the LAN interfaces -- in the end, I'd like to end up with a hard 768Kbps limit per-LAN-interface (rather than a limit on eth0 pooled across all interfaces).
I installed HTB.init, and riffing on the examples, tried to set this up on eth1 by putting three files into /etc/sysconfig/htb:
/etc/sysconfig/htb/eth1
DEFAULT=30
R2Q=100
/etc/sysconfig/htb/eth1-2.root
RATE=768Kbps
BURST=15k
/etc/sysconfig/htb/eth1-2:30.dfl
RATE=768Kbps
CEIL=788Kbps
BURST=15k
LEAF=sfq
I can /etc/init.d/htb start and /etc/init.d/htb stats and see information that /seems/ to suggest it's working...but when I try pulling a large file via the WAN interface the shaping clearly isn't in effect.
Any suggestions? My guess is it has something to do with where the shaping falls in the NAT chain, but I really have no idea where to begin troubleshooting this.
---- Update:
Here's my /etc/init.d/htb list output, it seems to make sense -- the default rate for eth1 is 768Kbps?
### eth0: queueing disciplines
qdisc htb 1: root refcnt 2 r2q 100 default 30 direct_packets_stat 0
qdisc sfq 30: parent 1:30 limit 127p quantum 1514b perturb 10sec
### eth0: traffic classes
class htb 1:2 root rate 768000bit ceil 768000bit burst 1599b cburst 1599b
class htb 1:30 parent 1:2 leaf 30: prio 0 rate 6144Kbit ceil 6144Kbit burst 15Kb cburst 1598b
### eth0: filtering rules
filter parent 1: protocol ip pref 100 u32
filter parent 1: protocol ip pref 100 u32 fh 800: ht divisor 1
filter parent 1: protocol ip pref 100 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:30
match 00000000/00000000 at 12
match 00000000/00000000 at 16
### eth1: queueing disciplines
qdisc htb 1: root refcnt 2 r2q 100 default 30 direct_packets_stat 0
qdisc sfq 30: parent 1:30 limit 127p quantum 1514b perturb 10sec
### eth1: traffic classes
class htb 1:2 root rate 768000bit ceil 768000bit burst 1599b cburst 1599b
class htb 1:30 parent 1:2 leaf 30: prio 0 rate 6144Kbit ceil 6144Kbit burst 15Kb cburst 1598b
© Server Fault or respective owner