QoS upstream and downstream...
Hi
I know this question is being asked in some other forms but I am getting confused with the answers. I'll re-form the question again.
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.
------------------
Private --------| eth1 eth0 |-------Internet
ipaddresses | |
------------------
Linux firewall
with masquerade.eth1 : internal interface
eth0/ppp0 : outgoing interface
The private ip-addresses are NATed before they go out to Internet.
The users will be distinguished on the basis of their private ip-addresses.
So far I know we can apply HTB,SFQ (as given in examples) on eth0 for outgoing traffic and marking packets in the PREROUTING stage using iptables. This will implement the QoS for upstream traffic.
Is it okay , if I simply mark packets on the basis of source ip-addresses only and put them in the appropriate classes or do I have to further consider classification of traffic on the basis of services like telnet, http, ftp, smtp etc as well ?
Similarly can I apply HTB,SFQ on eth1 for incoming traffic and mark packets using iptables in the PREROUTING stage and this time on the basis of destination ipaddresses to implement the QoS requirements on download speeds ?
Will it give me the desired results as per requirements ?
If not, do we have any other solution to implement the above requirement ?
Help is invaluably appreciated.
Thanks,
Rajesh
_______________________________________________
No banners. No pop-ups. No kidding.
Introducing My Way - http://www.myway.com
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Quoted 5 lines
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:
Quoted 2 lines
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.
Signature · 9 lines
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 _______________________________________________ LARTC mailing list / [email protected] http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Quoted 2 lines
Hi Thanks for your reply.One question - The lartc documentation says -
that in a NATed environment you should mark packets in the PREROUTING
stage
Quoted 1 line
while you have done in FORWARD stage - is that ok ?
I did this on purpose because you can check for incoming and outgoing interface here (-i and -o). On my box I needed both options and as in PREROUTING only -i is available I had to take the FORWARD chain. This is working absolutely perfect with me.
Quoted 4 lines
Actually, I had asked
this question earlier in this forum and I was told to mark packets in the PREROUTING stage. Similarly while receiving packets (downstream) on eth1 ; which stage should I mark packets ? I am not that conversant with
iptables.
Quoted 1 line
TIA,Rajesh
To my point of view it does NOT matter because you read out the mark for HTB in/after PREROUTING stage and it's not important where the mark has been set. If you don't need the -o option to identify the packets just replace FORWARD with PREROUTING ;-)
Cheers,
Mike
Signature · 9 lines
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 _______________________________________________ LARTC mailing list / [email protected] http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/