HTB Script Errors. What is wrong?

Linux Advanced Routing and Traffic Control

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

 



What can be wrong in this script? Any help is appreciated.
 
#!/bin/bash
tc=/sbin/tc
DEV_ISP=eth0
DEV_LAN=eth1
######################################################################################
# DEV_LAN = ETH 1
######################################################################################
$tc qdisc del dev $DEV_LAN root 2> /dev/null > /dev/null
$tc qdisc add dev $DEV_LAN root handle 1: htb r2q 100 default 58
# Main class
$tc class add dev $DEV_LAN parent 1: classid 1:2 htb rate 100mbit
# Samba
$tc class add dev $DEV_LAN parent 1:2 classid 1:21 htb rate 50mbit ceil 60mbit prio 7
# FTP Local
$tc class add dev $DEV_LAN parent 1:2 classid 1:22 htb rate 20mbit ceil 60mbit prio 7
# FTP Metropolitan
$tc class add dev $DEV_LAN parent 1:2 classid 1:23 htb rate 2mbit ceil 2mbit prio 6
# SSH Local
$tc class add dev $DEV_LAN parent 1:2 classid 1:24 htb rate 1mbit ceil 1mbit prio 7
# ICMP
$tc class add dev $DEV_LAN parent 1:2 classid 1:25 htb rate 24kbit ceil 512kbi t prio 1
# Counter Strike
$tc class add dev $DEV_LAN parent 1:2 classid 1:26 htb rate 5mbit ceil 5mbit prio 1
# International
$tc class add dev $DEV_LAN parent 1:2 classid 1:5 htb rate 600kbit
# ACK
$tc class add dev $DEV_LAN parent 1:5 classid 1:51 htb rate 40kbit ceil 40kbit prio 1
# DNS
$tc class add dev $DEV_LAN parent 1:5 classid 1:52 htb rate 40kbit ceil 40kbit prio 1
# HTTP
$tc class add dev $DEV_LAN parent 1:5 classid 1:53 htb rate 330kbit ceil 500kbit prio 2
# IRC
$tc class add dev $DEV_LAN parent 1:5 classid 1:54 htb rate 30kbit ceil 500kbit prio 3
# MAIL
$tc class add dev $DEV_LAN parent 1:5 classid 1:55 htb rate 30kbit ceil 500kbit prio 6
# DC++ Traffic
$tc class add dev $DEV_LAN parent 1:5 classid 1:56 htb rate 60kbit ceil 500kbit prio 4
# KaZZa Traffic
$tc class add dev $DEV_LAN parent 1:5 classid 1:57 htb rate 30kbit ceil 500kbit prio 6
# Default Traffic
$tc class add dev $DEV_LAN parent 1:5 classid 1:58 htb rate 30kbit ceil 500kbit prio 7
# Samba Filters
#10.0.2.1 Samba Filters
$tc filter add dev $DEV_LAN parent 1:0 protocol ip prio 7 u32 \
 match ip sport 139 0xffff \
 match ip src 10.0.2.1 \
 flowid 1:21
$tc filter add dev $DEV_LAN parent 1:0 protocol ip prio 7 u32 \
 match ip sport 138 0xffff \
 match ip src 10.0.2.1 \
 flowid 1:21
$tc filter add dev $DEV_LAN parent 1:0 protocol ip prio 7 u32 \
 match ip sport 137 0xffff \
 match ip src 10.0.2.1 \
 flowid 1:21
# FTP Local Filters
#10.0.2.1 FTP Local Filters
$tc filter add dev $DEV_LAN parent 1:0 protocol ip prio 7 u32 \
 match ip sport 20 0xffff \
 match ip src 10.0.2.1 \
 flowid 1:22
$tc filter add dev $DEV_LAN parent 1:0 protocol ip prio 7 u32 \
 match ip sport 21 0xffff \
 match ip src 10.0.2.1 \
 flowid 1:22
# FTP Metropolitan Filters
$tc filter add dev $DEV_LAN parent 1:0 protocol ip prio 6 u32 \
        match ip sport 20 0xffff \
        match ip src xxx.xxx.0.0/16 \
        flowid 1:23
# SSH Local Filters
# TOS Minimum Delay Traffic Filter
$tc filter add dev $DEV_LAN parent 1:0 protocol ip prio 7 u32 \
 match ip tos 0x10 0xff \
 flowid 1:24
#10.0.2.1 SSH Local Filters
$tc filter add dev $DEV_LAN parent 1:0 protocol ip prio 7 u32 \
 match ip sport 22 0xffff \
 match ip src 10.0.2.1 \
 flowid 1:24
# ICMP Filters
$tc filter add dev $DEV_LAN parent 1:0 protocol ip prio 1 u32 \
 match ip protocol 1 0xff \
 flowid 1:25
# Counter Strike Filters
$tc filter add dev $DEV_LAN parent 1:0 protocol ip prio 1 u32 \
 match ip sport 27015 0xffff \
 flowid 1:26
$tc filter add dev $DEV_LAN parent 1:0 protocol ip prio 1 u32 \
 match ip sport 27016 0xffff \
 flowid 1:26
$tc filter add dev $DEV_LAN parent 1:0 protocol ip prio 1 u32 \
 match ip sport 27017 0xffff \
 flowid 1:26
 
# Default Class Filters
$tc filter add dev $DEV_LAN parent 1:0 protocol ip prio 7 u32 \
        match ip src 0.0.0.0/0 \
        flowid 1:58
# ACKs Filters
$tc filter add dev $DEV_LAN parent 1:0 protocol ip prio 1 u32 \
 match ip protocol 6 0xff \
 match u8 0x05 0x0f at 0 \
 match u16 0x0000 0xffc0 at 2 \
 match u8 0x10 0xff at 33 \
 flowid 1:51
# DNS Filters
$tc filter add dev $DEV_LAN parent 1:0 protocol ip prio 1 u32 \
        match ip dport 53 0xffff \
        flowid 1:52
# HTTP Filters
$tc filter add dev $DEV_LAN parent 1:0 protocol ip prio 2 u32 \
 match ip sport 80 0xffff \
 flowid 1:53
$tc filter add dev $DEV_LAN parent 1:0 protocol ip prio 2 u32 \
 match ip sport 8080 0xffff \
 flowid 1:53
$tc filter add dev $DEV_LAN parent 1:0 protocol ip prio 2 u32 \
 match ip sport 443 0xffff \
 flowid 1:53
# MSN Filters
$tc filter add dev $DEV_LAN parent 1:0 protocol ip prio 2 u32 \
 match ip dport 1863 0xffff \
 flowid 1:53
# IRC Filters
$tc filter add dev $DEV_LAN parent 1:0 protocol ip prio 3 u32 \
 match ip sport 6665 0xffff \
 flowid 1:54
$tc filter add dev $DEV_LAN parent 1:0 protocol ip prio 3 u32 \
 match ip sport 6666 0xffff \
 flowid 1:54
$tc filter add dev $DEV_LAN parent 1:0 protocol ip prio 3 u32 \
 match ip sport 6667 0xffff \
 flowid 1:54
$tc filter add dev $DEV_LAN parent 1:0 protocol ip prio 3 u32 \
 match ip sport 6668 0xffff \
 flowid 1:54
$tc filter add dev $DEV_LAN parent 1:0 protocol ip prio 3 u32 \
 match ip sport 6669 0xffff \
 flowid 1:54
# Mail Filters
$tc filter add dev $DEV_LAN parent 1:0 protocol ip prio 6 u32 \
 match ip sport 25 0xffff \
 flowid 1:55
$tc filter add dev $DEV_LAN parent 1:0 protocol ip prio 6 u32 \
 match ip sport 110 0xffff \
 flowid 1:55
$tc filter add dev $DEV_LAN parent 1:0 protocol ip prio 6 u32 \
 match ip sport 143 0xffff \
 flowid 1:55
$tc filter add dev $DEV_LAN parent 1:0 protocol ip prio 6 u32 \
 match ip sport 220 0xffff \
 flowid 1:55
# DC++ Filters
$tc filter add dev $DEV_LAN parent 1:0 protocol ip prio 4 u32 \
 match ip sport 411 0xffff \
 flowid 1:56
# KaZZa Filters
$tc filter add dev $DEV_LAN parent 1:0 protocol ip prio 6 u32 \
 match ip sport 1214 0xffff \
 flowid 1:57
 
 
Local traffic and Counter-Strike traffic are ok. But when it comes to HTTP I'm getting huge delays, lost packets on MSN Messenger. I also found these errors with dmesg command:
HTB init, kernel part version 3.10
htb*g j=3410244
htb*r7 m=0
htb*r6 m=0
htb*r5 m=0
htb*r4 m=0
htb*r3 m=0
htb*r2 m=0
htb*r1 m=0
htb*r0 m=0
HTB: quantum of class 10025 is small. Consider r2q change.
HTB: quantum of class 10005 is small. Consider r2q change.
HTB: quantum of class 10051 is small. Consider r2q change.
HTB: quantum of class 10052 is small. Consider r2q change.
HTB: quantum of class 10053 is small. Consider r2q change.
HTB: quantum of class 10054 is small. Consider r2q change.
HTB: quantum of class 10055 is small. Consider r2q change.
HTB: quantum of class 10056 is small. Consider r2q change.
HTB: quantum of class 10057 is small. Consider r2q change.
HTB: quantum of class 10058 is small. Consider r2q change.
htb*g j=3413237
htb*r7 m=0
htb*r6 m=0
htb*r5 m=0
htb*r4 m=0
htb*r3 m=0
htb*r2 m=0
htb*r1 m=0
htb*r0 m=0
htb*c10011 m=2 t=173653 c=90932 pq=0 df=98304 ql=0 pa=0 f:
htb *c10001 m=2 t=65536 c=25258 pq=0 df=24543232 ql=0 pa=0 f:
htb*c10010 m=2 t=136159 c=136159 pq=0 df=24535040 ql=0 pa=0 f:
htb*c10013 m=2 t=-894657 c=-894657 pq=0 df=0 ql=0 pa=0 f:
htb*c10012 m=2 t=31232 c=25908 pq=0 df=3784704 ql=0 pa=0 f:
htb*g j=3413237
htb*r7 m=0
htb*r6 m=0
htb*r5 m=0
htb*r4 m=0
htb*r3 m=0
htb*r2 m=0
htb*r1 m=0
htb*r0 m=0
htb*c10022 m=2 t=8691 c=8358 pq=0 df=24502272 ql=0 pa=0 f:
htb*c10055 m=2 t=349439 c=28672 pq=0 df=24469504 ql=0 pa=0 f:
htb*c10023 m=2 t=13189 c=13189 pq=0 df=24502272 ql=0 pa=0 f:
htb*c10054 m=2 t=323839 c=27136 pq=0 df=2801664 ql=0 pa=0 f:
htb*c10002 m=2 t=8289 c=8289 pq=0 df=0 ql=0 pa=0 f:
htb*c10057 m=2 t=349439 c=28672 pq=0 df=24469504 ql=0 pa=0 f:
htb*c10021 m=2 t=8298 c=8281 pq=0 df=11747328 ql=0 pa=0 f:
htb*c10056 m=2 t=178773 c=28672 pq=0 df=24469504 ql=0 pa=0 f:
htb*c10026 m=2 t=10190 c=10190 pq=0 df=24494080 ql=0 pa=0 f:
htb*c10051 m=2 t=256479 c=256479 pq=0 df=0 ql=0 p a=0 f:
htb*c10005 m=2 t=24746 c=24746 pq=0 df=0 ql=0 pa=0 f:
htb*c10024 m=2 t=17738 c=17738 pq=0 df=8192 ql=0 pa=0 f:
htb*c10053 m=2 t=37354 c=27444 pq=0 df=843776 ql=0 pa=0 f:
htb*c10025 m=2 t=327999 c=23189 pq=0 df=4866048 ql=0 pa=0 f:
htb*c10052 m=2 t=264159 c=264159 pq=0 df=24485888 ql=0 pa=0 f:
htb*c10058 m=2 t=-483727 c=11367 pq=0 df=32768 ql=0 pa=0 f:
 
Thanks in advance.


Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online

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