All of lore.kernel.org
 help / color / mirror / Atom feed
From: Optimum Wireless Services <wilson@optimumwireless.com>
To: Andrew Beverley <andy@andybev.com>
Cc: netfilter@vger.kernel.org
Subject: Re: How can I test my tc script?
Date: Sun, 06 Feb 2011 12:35:13 -0400	[thread overview]
Message-ID: <1297010113.3928.12.camel@debian-laptop.OptimumWireless> (raw)
In-Reply-To: <1297008953.1613.24.camel@andybev>

On Sun, 2011-02-06 at 16:15 +0000, Andrew Beverley wrote:
> On Sat, 2011-02-05 at 22:14 -0400, Optimum Wireless Services wrote:
> > On Sat, 2011-02-05 at 12:27 +0000, Andrew Beverley wrote:
> > > On Sat, 2011-02-05 at 02:07 -0400, Optimum Wireless Services wrote:
> > > > Now, for the upload I cant get it shape with squid running in the
> > > > middle. If I remove squid then, traffic shaping works ok.
> > > > 
> > > 
> > > If you are doing egress shaping on the internet facing interface for the
> > > upload (which I assume you are - you can't use HTB on ingress), then it
> > > will not work for Squid. That's because Squid's traffic leaving the
> > > server is coming from the server's IP address, not from the client's IP
> > > address (Squid is generating the traffic, not the client). Therefore,
> > > your filter will never match the traffic. Normal traffic from a client
> > > is forwarded and retains its source IP address.
> > > 
> > 
> > Do you think I should go back to this method?
> > 
> > I have 120 users now but, that number should be increasing. Which method
> > do you recommend?
> 
> I think that you should forget the per-user stuff as per my other email
> and classify traffic. Just my personal opinion - I'd be interested to
> hear what others think.

I just need a way that would allow users to experience a reliable
connection that would always be 15% +- the contracted bandwidth.

This turned to be more complicated than what I first thought. 

After adding the new ruleset, I added this little script to try to
prioritize some traffic, just installed it so, don't know yet how would
traffic behave:

#!/bin/bash
#set -v
iptables='sudo iptables'
tc='sudo tc'

# This script should run before tcshaper.sh
# It will try to improve traffic: low latency, fast up, fast down.

# upload
$tc class add dev eth0 parent 1:1 classid 1:7 htb rate 3000kbit ceil
3000kbit prio 1
$tc class add dev eth0 parent 1:1 classid 1:8 htb rate 3000kbit ceil
3000kbit prio 2
#$tc class add dev eth0 parent 1:1 classid 1:9 htb rate 100kbit ceil
150kbit prio 3

$tc filter add dev eth0 parent 1:0 protocol ip prio 1 handle 7 fw
classid 1:7
$tc filter add dev eth0 parent 1:0 protocol ip prio 2 handle 8 fw
classid 1:8
#$tc filter add dev eth0 parent 1:0 protocol ip prio 3 handle 9 fw
classid 1:9

$tc qdisc add dev eth0 parent 1:7 handle 110: sfq perturb 10
$tc qdisc add dev eth0 parent 1:8 handle 120: sfq perturb 10
#$tc qdisc add dev eth0 parent 1:9 handle 130: sfq perturb 1

# FW Marks
# 7 = prio 1, 8 = prio 2, 9 = prio 3

############ Set the iptables rules ###################################
$iptables -A PREROUTING -t mangle -p tcp --sport 22     -j TOS --set-tos
Minimize-Delay

$iptables -A PREROUTING -t mangle -p tcp --sport 22     -j TOS --set-tos
Minimize-Delay
$iptables -A PREROUTING -t mangle -p tcp --dport 22     -j TOS --set-tos
Minimize-Delay
$iptables -A PREROUTING -t mangle -p udp --sport 53     -j TOS --set-tos
Minimize-Delay
$iptables -A PREROUTING -t mangle -p udp --dport 53     -j TOS --set-tos
Minimize-Delay
$iptables -A PREROUTING -t mangle -p icmp               -j TOS --set-tos
Minimize-Delay

$iptables -t mangle -A PREROUTING -p tcp -m tcp --tcp-flags SYN,RST,ACK
SYN -j MARK --set-mark 7
$iptables -t mangle -A PREROUTING -p tcp -m tcp --tcp-flags SYN,RST,ACK
SYN -j RETURN

$iptables -t mangle -A PREROUTING -m tos --tos Minimize-Delay -j MARK
--set-mark 7
$iptables -t mangle -A PREROUTING -m tos --tos Minimize-Delay -j RETURN

#$iptables -t mangle -A PREROUTING -p udp --dport 53 -j MARK  --set-mark
8
#$iptables -t mangle -A PREROUTING -p udp --dport 53 -j RETURN

########################################################################################
# download
$tc class add dev eth1 parent 2:1 classid 2:7 htb rate 5000kbit ceil
5000kbit prio 1
$tc class add dev eth1 parent 2:1 classid 2:8 htb rate 5000kbit ceil
5500kbit prio 2

$tc filter add dev eth1 parent 2:0 protocol ip prio 1 handle 7 fw
classid 2:7

$tc filter add dev eth1 parent 2:0 protocol ip prio 2 handle 8 fw
classid 2:8

$tc qdisc add dev eth1 parent 2:7 handle 110: sfq perturb 10
$tc qdisc add dev eth1 parent 2:8 handle 111: sfq perturb 10


> 
> Andy
> 
> 


  reply	other threads:[~2011-02-06 16:35 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-03  2:17 How can I test my tc script? Optimum Wireless Services
2011-02-03 11:01 ` Marek Kierdelewicz
2011-02-03 14:13   ` Optimum Wireless Services
2011-02-03 15:06     ` Marek Kierdelewicz
2011-02-03 16:18   ` Optimum Wireless Services
2011-02-04 13:45   ` Optimum Wireless Services
2011-02-04 16:49     ` Optimum Wireless Services
2011-02-04 19:57       ` Optimum Wireless Services
2011-02-05 12:29         ` Andrew Beverley
2011-02-05 19:32         ` Marek Kierdelewicz
2011-02-05 19:29       ` Marek Kierdelewicz
2011-02-05 20:21     ` Marek Kierdelewicz
2011-02-06  0:05       ` Marek Kierdelewicz
2011-02-06  2:24         ` Optimum Wireless Services
2011-02-04 14:22   ` Michele Petrazzo - Unipex
2011-02-05  2:08     ` Andrew Beverley
2011-02-05 14:58     ` Marek Kierdelewicz
2011-02-05 16:37       ` Andrew Beverley
2011-02-05 16:48         ` good tutorial J Webster
2011-02-05 19:22           ` Andrew Beverley
2011-02-05 19:33             ` J Webster
2011-02-05 19:51               ` Bob Miller
2011-02-05 22:47                 ` Andrew Beverley
2011-02-05 22:44               ` Andrew Beverley
2011-02-05 17:04         ` How can I test my tc script? Marek Kierdelewicz
2011-02-06  2:12         ` Optimum Wireless Services
2011-02-06 16:13           ` Andrew Beverley
2011-02-07  8:20       ` Michele Petrazzo - Unipex
2011-02-03 19:38 ` Andrew Beverley
2011-02-05  2:44   ` Optimum Wireless Services
2011-02-05  6:07     ` Optimum Wireless Services
2011-02-05 12:27       ` Andrew Beverley
2011-02-06  2:14         ` Optimum Wireless Services
2011-02-06 16:15           ` Andrew Beverley
2011-02-06 16:35             ` Optimum Wireless Services [this message]
2011-02-06 17:02               ` Andrew Beverley
2011-02-06 23:27                 ` Optimum Wireless Services
2011-02-08  0:56                   ` Andrew Beverley
2011-02-08  2:11                     ` Optimum Wireless Services
2011-02-08  6:52                       ` Andrew Beverley
2011-02-08  2:20                     ` Optimum Wireless Services
2011-02-08  6:53                       ` Andrew Beverley
2011-02-06 16:44             ` Marek Kierdelewicz
2011-02-06 23:31               ` Optimum Wireless Services
2011-02-08  0:58                 ` Andrew Beverley
2011-02-05 12:35     ` Andrew Beverley
2011-02-06  2:17       ` Optimum Wireless Services
2011-02-06 15:54         ` Andrew Beverley
2011-02-06 16:28           ` Optimum Wireless Services
2011-02-06 17:11             ` Andrew Beverley
2011-02-06 23:33               ` Optimum Wireless Services
2011-02-08  1:01                 ` Andrew Beverley

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=1297010113.3928.12.camel@debian-laptop.OptimumWireless \
    --to=wilson@optimumwireless.com \
    --cc=andy@andybev.com \
    --cc=netfilter@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.