readenglishbook.com » Computers » ADSL Bandwidth Management HOWTO, Dan Singletary [free ebook reader for ipad .txt] 📗

Book online «ADSL Bandwidth Management HOWTO, Dan Singletary [free ebook reader for ipad .txt] 📗». Author Dan Singletary



1 2 3 4 5 6 7 8
Go to page:

tc class add dev $DEV parent 1:1 classid 1:25 htb rate $[$RATEUP/7]kbit ceil ${RATEUP}kbit prio 5

tc class add dev $DEV parent 1:1 classid 1:26 htb rate $[$RATEUP/7]kbit ceil ${RATEUP}kbit prio 6

attach qdisc to leaf classes - here we at SFQ to each priority class. SFQ insures that within each class connections will be treated (almost) fairly.

tc qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 10

tc qdisc add dev $DEV parent 1:21 handle 21: sfq perturb 10

tc qdisc add dev $DEV parent 1:22 handle 22: sfq perturb 10

tc qdisc add dev $DEV parent 1:23 handle 23: sfq perturb 10

tc qdisc add dev $DEV parent 1:24 handle 24: sfq perturb 10

tc qdisc add dev $DEV parent 1:25 handle 25: sfq perturb 10

tc qdisc add dev $DEV parent 1:26 handle 26: sfq perturb 10

filter traffic into classes by fwmark - here we direct traffic into priority class according to the fwmark set on the packet (we set fwmark with iptables later). Note that above we've set the default priority class to 1:26 so unmarked packets (or packets marked with unfamiliar IDs) will be defaulted to the lowest priority class.

tc filter add dev $DEV parent 1:0 prio 0 protocol ip handle 20 fw flowid 1:20

tc filter add dev $DEV parent 1:0 prio 0 protocol ip handle 21 fw flowid 1:21

tc filter add dev $DEV parent 1:0 prio 0 protocol ip handle 22 fw flowid 1:22

tc filter add dev $DEV parent 1:0 prio 0 protocol ip handle 23 fw flowid 1:23

tc filter add dev $DEV parent 1:0 prio 0 protocol ip handle 24 fw flowid 1:24

tc filter add dev $DEV parent 1:0 prio 0 protocol ip handle 25 fw flowid 1:25

tc filter add dev $DEV parent 1:0 prio 0 protocol ip handle 26 fw flowid 1:26

add MYSHAPER-OUT chain to the mangle table in iptables - this sets up the table we'll use to filter and mark packets.

iptables -t mangle -N MYSHAPER-OUT

iptables -t mangle -I POSTROUTING -o $DEV -j MYSHAPER-OUT

add fwmark entries to classify different types of traffic - Set fwmark from 20-26 according to desired class. 20 is highest prio.

iptables -t mangle -A MYSHAPER-OUT -p tcp --sport 0:1024 -j MARK --set-mark 23 # Default for low port traffic

iptables -t mangle -A MYSHAPER-OUT -p tcp --dport 0:1024 -j MARK --set-mark 23 # ""

iptables -t mangle -A MYSHAPER-OUT -p tcp --dport 20 -j MARK --set-mark 26 # ftp-data port, low prio

iptables -t mangle -A MYSHAPER-OUT -p tcp --dport 5190 -j MARK --set-mark 23 # aol instant messenger

iptables -t mangle -A MYSHAPER-OUT -p icmp -j MARK --set-mark 20 # ICMP (ping) - high prio, impress friends

1 2 3 4 5 6 7 8
Go to page:

Free e-book «ADSL Bandwidth Management HOWTO, Dan Singletary [free ebook reader for ipad .txt] 📗» - read online now

Comments (0)

There are no comments yet. You can be the first!
Add a comment