[LARTC] ADSL/Ethernet differentiation

Linux Advanced Routing and Traffic Control

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

 



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 started 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 FTP 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 everything
else, so I reckon 248Kb/s, leaving 8Kb/s for the rest (which will borrow
from the others alot :)

I have read the documentation and I think that the rules included at the
bottom of this email should work. However, I am not sure whether this would
also restrict the bandwidth between machines, which I would like to remain
at 100Mb/s.

I would appreciate opinions from more experienced people as to how I can
manage this. Also, if there are any flaws (read: stupid mistakes) in my
rules, I would appreciate comments!

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




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