Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Our main interface is eth0
- export DEV=eth0
- export MAXRATE=2mbit
- # Reset the qdisc
- tc qdisc del dev $DEV root
- # We want to use htb for our qos on the server
- tc qdisc add dev $DEV root handle 1:0 htb r2q 100
- # Remember: mbit = megabit/sec, mbps = megabyte/sec
- # Add class: define main interface
- tc class add dev $DEV parent 1:0 classid 1:1 htb rate $MAXRATE
- # Split in the interface into two main streams:
- # 1.2 the main one (web, nfs, cifs), but we deal with web for now, limiting to 1mbyte/sec
- tc class add dev $DEV parent 1:1 classid 1:2 htb rate 1mbps ceil $MAXRATE
- # 1.3 the out of band, service one (ssh)
- tc class add dev $DEV parent 1:1 classid 1:3 htb rate 0.5mbps ceil $MAXRATE
- tc class add dev $DEV parent 1:1 classid 1:4 htb rate 0.5mbps ceil $MAXRATE
- # I'm not sure if pfifo or sfq is better for these:
- tc qdisc add dev $DEV parent 1:2 handle 120: pfifo limit 10
- tc qdisc add dev $DEV parent 1:3 handle 130: pfifo limit 10
- tc qdisc add dev $DEV parent 1:4 handle 140: pfifo limit 10
- # Finally define which IP
- # Port 80
- tc filter add dev $DEV parent 1:0 prio 1 protocol ip u32 match ip sport 80 0xffff flowid 1:2
- tc filter add dev $DEV parent 1:0 prio 1 protocol ip u32 match ip sport 443 0xffff flowid 1:2
- # SSH is port 22
- tc filter add dev $DEV parent 1:0 prio 2 protocol ip u32 match ip sport 22 0xffff flowid 1:3
- #tc filter add dev $DEV parent 1:0 prio 2 protocol ip u32 flowid 1:4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement