[LARTC] QoS upstream and downstream...

Linux Advanced Routing and Traffic Control

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

 



> Say I want to implement QoS for users like - 
> 512 kpbs downstream (incoming) and 128 kbps upstream (outgoing),
> 1 Mbps downstream (incoming) and 256 kbps upstream (outgoing), etc.
> Is it possible to implement the above QoS scheme using HTB,SFQ etc ?
> If yes how ? The network diagram is as given below.
Yes indeed! All you need is create the appropriate classes on the
network-interfaces. As I'm only using HTB and iptables I can give you just a HTB
example:

> eth1 : internal interface
> eth0/ppp0 : outgoing interface
Ok, let's say you create the following classes according to your
information:
eth1: 
-1:1 512kbps (user1)
-1:2 1Mbps (user2)

ppp0:
-2:1 128kbps (user1)
-2:2 256kbps (user2)       

user1's ip is 192.168.0.1
user2's ip is 192.168.0.2

The iptables rules would be:

#marking packets
iptables -t mangle -A FORWARD -s 192.168.0.1 -j MARK --set-mark 1
iptables -t mangle -A FORWARD -d 192.168.0.1 -j MARK --set-mark 1
iptables -t mangle -A FORWARD -s 192.168.0.2 -j MARK --set-mark 2
iptables -t mangle -A FORWARD -d 192.168.0.2 -j MARK --set-mark 2

#putting packets in HTB classes
iptables -t mangle -A POSTROUTING -o eth1 -m mark --mark 1 -j CLASSIFY
--set-class 1:1

iptables -t mangle -A POSTROUTING -o eth0 -m mark --mark 1 -j CLASSIFY
--set-class 2:1

iptables -t mangle -A POSTROUTING -o eth1 -m mark --mark 1 -j CLASSIFY
--set-class 1:2

iptables -t mangle -A POSTROUTING -o eth0 -m mark --mark 1 -j CLASSIFY
--set-class 2:2

As I don't know your setup you can make sure that nothing goes wrong by
adding the incoming and outgoing interfaces at the marking part like this:
iptables -t mangle -A FORWARD -i eth1 -o ppp0 -s 192.168.0.1 -j MARK
--set-mark 1

For putting the packets into HTB classes you can also use tc filter if
you're not familar with CLASSIFY.

Hope that helps!
M.

-- 
COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test
--------------------------------------------------
1. GMX TopMail - Platz 1 und Testsieger!
2. GMX ProMail - Platz 2 und Preis-Qualitätssieger!
3. Arcor - 4. web.de - 5. T-Online - 6. freenet.de - 7. daybyday - 8. e-Post



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