Skip to contentSkip to conversation

how to guarantee bandwidth for a service

LARTC Adam Schrader 2 participants 2 messages Apr 10, 2003

lore
Share & tools
lore
#0 lore raw

How can I guarantee a certain amount of bandwidth for a certain service, ie web browsing (port 80) or half-life (27015) or even per ip and then just leave the rest of the bw to be fought over. The problem is that people have file sharing programs edonkey, kazaa and so on and rather than keep track of them all and try to manage their bandwidth usage so as so leave some for the other services I would just like to let them fight over as much bw as they can take after guaranteeing a certain amount for certain services/ips.

-Adam

---------------------------------
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more

#1 lore raw

I have a similar situation in which I provide internet for about 12 people on a dorm floor. What I do is use iptables to mark everything to bulk to start with, and then I remark the stuff I want prioritized (ssh, icmp, www, smtp, pop, etc) and place those into htb classes with certain amounts of guaranteed bandwidth. Everything else that stays with the initial mark is placed in the lowest priority class with a small amount of guaranteed bandwidth. That class can borrow from others if there is not much traffic in them, but useful services definitely get the lions share of the link if needed. If you want to guarantee bandwidth for a specific service, just mark all packets related to that and place them in a class by themselves with a certain rate. Generally, create a parent class at just below your link's rate, then child-classes to hold all the different kinds of traffic you want.

perhaps for halflife, something like this:
iptables -t mangle -A POSTROUTING -p tcp --dport 27005:27015 -j
MARK --set-mark 0x1 <--- mark halflife packets with 1 (hex)

Create root qdisc and classes for traffic, defaulting to class 104 for bulk tc qdisc add dev eth1 root handle 1: htb default 104
tc class add dev eth1 parent 1:1 classid 1:10 htb rate 100kbps
tc class add dev eth1 parent 1:10 classid 1:101 htb rate 50kbps prio 1
ceil 95kbps <--- halflife class
tc class add dev eth1 parent 1:10 classid 1:104 htb rate 10kbps prio 4
ceil 95kbps <--- bulk class

tc filter add dev eth1 parent 1: protocol ip prio 1 handle 1 fw classid
1:101 <--- filter to catch the halflife packets marked with 1 and place
them in 101

Any corrections or suggestions are welcome
Jay

<snip>

Quoted 1 line

How can I guarantee a certain amount of bandwidth for a certain service, ie

web browsing (port 80) or half-life (27015) or even per ip and then >just leave the rest of the bw to be fought over. The problem is that people have file sharing programs edonkey, kazaa and so on and rather than >keep track of them all and try to manage their bandwidth usage so as so leave some for the other services I would just like to let them fight over as >much bw as they can take after guaranteeing a certain amount for certain services/ips

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/