All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Mihai Tanasescu" <Mihai.Tanasescu@skyraven.pcnet.ro>
To: lartc@vger.kernel.org
Subject: [LARTC] Need help with HTB
Date: Mon, 27 Oct 2003 22:37:18 +0000	[thread overview]
Message-ID: <marc-lartc-106729452827597@msgid-missing> (raw)


 Hello,

 1.

 I currently have a 128kbps cable link to the internet..and I'm sharing
 this connection with others.
 I've made the following script(for alocating bandwidth depending on the
 services used: browsing, squid, games like counter-strike, icmp, ssh),
 which unfortunately isn't working very well  as the response times I'm
 getting upon pinging the server are almost the same I get without the
 htb script being loaded.
 Any ideas ?

 Here goes my script:
 where eth1 = the internal network card
            eth0 = the link to my ISP

 ipt="/sbin/iptables"
 tc="/sbin/tc"
 IF_EXT=eth0
 IF_LOC=eth1


########################################################################
 #####
 $tc qdisc del dev $IF_EXT root
 $tc qdisc add dev $IF_EXT handle 1: root htb default 99 r2q 1
 $tc class add dev $IF_EXT parent 1: classid 1:1 htb rate 100kbit
 $tc class add dev $IF_EXT parent 1:1 classid 1:2 htb rate 20kbit ceil
 20kbit prio 1
 $tc class add dev $IF_EXT parent 1:1 classid 1:3 htb rate 60kbit ceil
 90kbit prio 3
 $tc class add dev $IF_EXT parent 1:1 classid 1:99 htb rate 20kbit ceil
 90kbit prio 7

 //I'm letting 1:2 use FIFO...for low-latency
 $tc qdisc add dev $IF_EXT parent 1:3 handle 30: sfq perturb 10
 $tc qdisc add dev $IF_EXT parent 1:99 handle 990: sfq perturb 10

 # ICMP
 $tc filter add dev $IF_EXT protocol ip prio 1 parent 1: u32 \
         match ip protocol 1 0xff flowid 1:2

 #Counter-strike
 $tc filter add dev $IF_EXT protocol ip prio 1 parent 1: u32 \
         match ip dport 27015 0xffff flowid 1:3
 $tc filter add dev $IF_EXT protocol ip prio 1 parent 1: u32 \
         match ip dport 28015 0xffff flowid 1:3

 # TOS Minimum Delay (ssh, NOT scp) in 1:10:
 $tc filter add dev $IF_EXT protocol ip prio 2 parent 1: u32 \
       match ip tos 0x10 0xff  flowid 1:3

 ######################################
 #acks
 $tc filter add dev $IF_EXT parent 1: protocol ip prio 2 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:3
 #dns query-uri
 $tc filter add dev $IF_EXT protocol ip prio 2 parent 1: u32 \
         match ip dport 53 0xffff flowid 1:3

 #############################################
 # other services - web + irc
 $tc filter add dev $IF_EXT parent 1: protocol ip prio 2 u32 \
         match ip dport 80 0xffff flowid 1:3
 $tc filter add dev $IF_EXT parent 1: protocol ip prio 2 u32 \
         match ip dport 6667 0xffff flowid 1:3
 #############################################
 # All others go to 1:99
 $tc filter add dev $IF_EXT protocol ip prio 2 parent 1: u32 \
        match ip dst 0.0.0.0/0 flowid 1:99


########################################################################
 ##################


 and for download I have the following:

 $tc qdisc del dev $IF_LOC root
 $tc qdisc add dev $IF_LOC handle 2: root htb default 99 r2q 1
 $tc class add dev $IF_LOC parent 2: classid 2:1 htb rate 100kbit

 $tc class add dev $IF_LOC parent 2:1 classid 2:2 htb rate 70kbit ceil
 90kbit prio 1
 $tc class add dev $IF_LOC parent 2:1 classid 2:99 htb rate 30kbit ceil
 90kbit prio 5

 #PRIO FIFO...for 2:2 = low latency for counter-strike packets
 $tc qdisc add dev $IF_LOC parent 2:99 handle 299: sfq perturb 10

 #Counter-strike
 $tc filter add dev $IF_LOC protocol ip prio 1 parent 2: u32 \
         match ip dport 27005 0xffff flowid 2:2
 #WEB
 $tc filter add dev $IF_LOC protocol ip prio 1 parent 2: u32 \
         match ip sport 80 0xffff flowid 2:2
 #SQUID
 $tc filter add dev $IF_LOC protocol ip prio 1 parent 2: u32 \
         match ip sport 3128 0xffff flowid 2:2

 # Restu
 $tc filter add dev $IF_LOC protocol ip prio 1 parent 2: u32 \
        match ip dst 0.0.0.0/0 flowid 2:99

 pinging the server without htb script loaded:
 [mihai@...mihai]$ ping -c 5 ip
 PING ip(ip) from .....: 56(84) bytes of data.
 64 bytes from ip: icmp_seq=1 ttl` time”.0 ms
 64 bytes from ip: icmp_seq=2 ttl` timeA.3 ms
 64 bytes from ip: icmp_seq=3 ttl` time\x10.4 ms
 64 bytes from ip: icmp_seq=4 ttl` time%.5 ms
 64 bytes from ip: icmp_seq=5 ttl` time\x14.1 ms

 --- ip ping statistics ---
 5 packets transmitted, 5 received, 0% loss, time 4036ms
 rtt min/avg/max/mdev = 10.454/37.105/94.057/30.443 ms

 pinging the server with htb script loaded:

 [mihai@.. mihai]$ ping -c 5 ip_addr
 PING ip(ip) from ...: 56(84) bytes of data.
 64 bytes from ip: icmp_seq=1 ttl` time1.1 ms
 64 bytes from ip: icmp_seq=2 ttl` time\x11.8 ms
 64 bytes from ip: icmp_seq=3 ttl` time8.5 ms
 64 bytes from ip: icmp_seq=4 ttl` time”.8 ms
 64 bytes from ip: icmp_seq=5 ttl` time1.5 ms

 --- ip ping statistics ---
 5 packets transmitted, 5 received, 0% loss, time 4041ms
 rtt min/avg/max/mdev = 11.839/41.584/94.829/28.064 ms

 and tc -s qdisc shows:
 tc -s qdisc
 qdisc sfq 990: dev eth0 quantum 1514b perturb 10sec
  Sent 7574 bytes 75 pkts (dropped 0, overlimits 0)

  qdisc sfq 30: dev eth0 quantum 1514b perturb 10sec
  Sent 123614 bytes 1413 pkts (dropped 0, overlimits 0)

  qdisc htb 1: dev eth0 r2q 1 default 99 direct_packets_stat 0
  Sent 149780 bytes 1678 pkts (dropped 87, overlimits 0)

  qdisc sfq 299: dev eth1 quantum 1514b perturb 10sec
  Sent 824005 bytes 1000 pkts (dropped 0, overlimits 0)
  backlog 3p

  qdisc htb 2: dev eth1 r2q 1 default 99 direct_packets_stat 2
  Sent 1055635 bytes 1398 pkts (dropped 0, overlimits 2046)

 2.

 I have the same problem with a htb script on an adsl connection (with
 the htb script I get ping response times of 80-90..without it I get
 200-300 ms...but these response times aren't very stable..it's
something
 like I'm getting 40 ms..then 100 ms..then 50 ms..)

 Sorry about the size of this message.

 Hope you can help,
Mihai Tanasescu



_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

             reply	other threads:[~2003-10-27 22:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-27 22:37 Mihai Tanasescu [this message]
2003-10-28 18:12 ` [LARTC] Need help with HTB Stef Coene
2003-10-28 20:38 ` Mihai Tanasescu
2003-10-28 21:05 ` Stef Coene
2003-10-29  0:32 ` Andy Furniss

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-lartc-106729452827597@msgid-missing \
    --to=mihai.tanasescu@skyraven.pcnet.ro \
    --cc=lartc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.