On Monday 28 January 2002 00:35, tc@bens-house.org.uk wrote: > Hi all, > > I am new to traffic management and I am having some difficulty working = out > how to differentiate between my ADSL link and LAN. > > Background: I recently purchased an "Audiotron", which is a networked > device that allows me to play MP3's over my LAN and also allows me to > listen to Internet Radio, through my ADSL link (512Kb/s) and then over = the > LAN. I discovered, however, that when I am doing large downloads, the > Internet Radio on the Audiotron suffers (no bandwidth), so I have start= ed > looking into traffic shaping. > Seeing as I am doing this, I decided that I would also like to give > priority to web, news and mail, over any other service, so that large F= TP > downloads would not affect web browsing speed. > My LAN consists of a Linux box with a USB ADSL modem (ppp) and a 100Mb/= s > network card (eth0). The other machines on my network are all 100Mb/s > > To sum it up simply: Top priority is Audiotron, which should never take= up > ALL of the bandwidth (it should never need to), but I would like it to = have > 256 Kb/s if needed. > Next up is web, news and mail, which should take priority over everythi= ng > else, so I reckon 248Kb/s, leaving 8Kb/s for the rest (which will borro= w > from the others alot :) > > I have read the documentation and I think that the rules included at th= e > bottom of this email should work. However, I am not sure whether this w= ould > also restrict the bandwidth between machines, which I would like to rem= ain > at 100Mb/s. > > I would appreciate opinions from more experienced people as to how I ca= n > manage this. Also, if there are any flaws (read: stupid mistakes) in my > rules, I would appreciate comments! The script is OK, except : The last filter is not needed since all not-matched packets will ended up= in=20 1:20 by default (you specified this when you added the qdisc). Is this script for the internet NIC or for the LAN NIC? =20 If it's for the LAN nic, you will end up with all traffic (also LAN) traf= fic=20 bounded to 512 kbit. Solution : create an extra class with 2 subclasses.= =20 Put all LAN traffic in the first class and all internet traffic in the ot= her.=20 Give the second class a bounded rate of 512 kbit and attach all the othe= r=20 classes to this class. And the filter uses dport. But you have to use s= port. > > Cheers, > > Ben > > Rules: > > # Add HTB as the queue discipline on eth0. > tc qdisc add dev eth0 root handle 1: htb default 20 > > # Add a root class rated at 512kbit (the speed of my adsl downloads) > tc class add dev eth0 parent 1: classid 1:1 htb rate 512kbit burst 2k > > # Add a class with a guaranteed rate of 256kbit and ceiling of 512kbit = for > the Audiotron > tc class add dev eth0 parent 1:1 classid 1:10 htb rate 256kbit ceil 512= kbit > burst 2k > > # Add a class for all web, news and mail traffic, rated at 248kbit with > 512kbit ceiling > tc class add dev eth0 parent 1:1 classid 1:15 htb rate 248kbit ceil 512= kbit > burst 2k > > # Add default class for all other traffic, rated at 8kbit with 512kbit > ceiling > tc class add dev eth0 parent 1:1 classid 1:20 htb rate 8kbit ceil 512kb= it > burst 2k > > # OK, we have our classes, now add some filters. > > # First the Audiotron > tc filter add dev eth0 protocol ip parent 1: prio 1 u32 match ip dst > 192.168.0.9/32 flowid 1:10 > > # Next for Web, News and Mail > # http/https > tc filter add dev eth0 protocol ip parent 1: prio 2 u32 match ip dport = 80 > 0xffff flowid 1:15 > tc filter add dev eth0 protocol ip parent 1: prio 2 u32 match ip dport = 443 > 0xffff flowid 1:15 > # pop3/smtp > tc filter add dev eth0 protocol ip parent 1: prio 2 u32 match ip dport = 25 > 0xffff flowid 1:15 > tc filter add dev eth0 protocol ip parent 1: prio 2 u32 match ip dport = 110 > 0xffff flowid 1:15 > > # news/home news > tc filter add dev eth0 protocol ip parent 1: prio 2 u32 match ip dport = 119 > 0xffff flowid 1:15 > > # Everything else comes under the default. > tc filter add dev eth0 protocol ip parent 1: prio 3 flowid 1:20 Not needed. Class 1:10 wil allready contain all not matched packets. Stef --=20 stef.coene@docum.org More QOS info : http://www.docum.org/ Title : "Using Linux as bandwidth manager" =20