Re: [LARTC] how to guarantee bandwidth for a service

Linux Advanced Routing and Traffic Control

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

 



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>
>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



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