Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Jun 2007 00:37:47 +0200
From:      Mark Martinec <Mark.Martinec@ijs.si>
To:        freebsd-ipfw@freebsd.org
Subject:   Re: ipfw, pipes, queues, weights and managing an Internet connection
Message-ID:  <200706130037.48372.Mark.Martinec@ijs.si>
In-Reply-To: <937e203f0706121302ga14ec97wab7f1b5e3c58cdfd@mail.gmail.com>
References:  <937e203f0706121302ga14ec97wab7f1b5e3c58cdfd@mail.gmail.com>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
Lubomir,

>   Here's what I want to do - i have a 3mbps Internet connection. I want to
> do something similar to QoS  - that is, I want to be able to browse without
> feeling that for example I /or someone else behind the NAT/ is leeching a
> torrent. Since I found out that there is no pure incarnation of QoS in ipfw
> I believe that there is a way to accomplish this using the queues and
> weights.

Indeed.

> I read something about putting in ACK's with a higher priority

Yes, it is a must.

> Please do share if you've done something similar and whether it's
> possible to NOT feel AT ALL that someone is leeching. That is,
> can the packets' speed /dropping, etc./ be so quickly managed by
> the gateway as to the end user not feeling anything?
> Most basically I would like to utilize a pipe at all times,
> but when someone starts browsing I don't want him to feel that 
> there's anything in the background.

I can't say about p2p traffic, but it works for me the way you
describe if I mix mail reading (IMAP/SMTP), web browsing and
running a backup (rsync) in the background over a 0.5/3 Mbps
cable link. Something like the following should get you going.

Btw, it pays off to slightly underestimate the link bandwidth,
which avoids it resorting to more crude methods. My complication
with specifying an interface makes traffic shaping only apply
to external interface. I'm sure it can be improved...


#define IF_EXT         rl0
#define IF_INT         rl1
#define IF_GIF         gif0

/* traffic shaping - 512 kbps / 3072 kbps */

/* outgoing */
pipe   1 config queue 1500bytes bw 498000bit/s

queue 10 config pipe 1 weight  1 mask all
queue 11 config pipe 1 weight  5 mask all
queue 12 config pipe 1 weight 10 mask all
queue 13 config pipe 1 weight 50 mask all

add 65001 queue 13 out iptos lowdelay iplen 0-250 xmit IF_EXT
add 65002 queue 13 out proto udp src-port 12334   xmit IF_EXT
add 65003 queue 13 out proto udp iplen 0-250      xmit IF_EXT
add 65004 queue 12 out proto udp                  xmit IF_EXT
add 65005 queue 12 out proto icmp                 xmit IF_EXT
add 65006 queue 12 out proto tcp tcpflags ack iplen 0-80 xmit IF_EXT
add 65007 queue 11 out proto tcp iplen 0-300      xmit IF_EXT
add 65008 queue 11 out proto tcp src-port 80,88   xmit IF_EXT
add 65009 queue 10 out proto tcp dst-port rsync   xmit IF_EXT
add 65010 queue 10 out proto tcp                  xmit IF_EXT
add 65011 queue 11 out proto ipv6 iplen 0-300     xmit IF_EXT
add 65012 queue 10 out proto ipv6                 xmit IF_EXT
add 65013 queue 11 out proto ospf                 xmit IF_EXT
add 65014 queue 11 log out frag                   xmit IF_EXT
add 65015 queue 11 out                            xmit IF_EXT
add 65019 pass     out

/* incoming */
pipe   2 config queue 4500bytes bw 3300Kbit/s

queue 20 config pipe 2 weight  1 mask all
queue 21 config pipe 2 weight  5 mask all
queue 22 config pipe 2 weight 10 mask all
queue 23 config pipe 2 weight 50 mask all

add 65101 queue 23 iptos lowdelay iplen 0-250     recv IF_EXT
add 65102 queue 23 proto udp src-port 12334       recv IF_EXT
add 65103 queue 22 proto udp iplen 0-250          recv IF_EXT
add 65103 queue 22 proto udp                      recv IF_EXT
add 65104 queue 22 proto icmp                     recv IF_EXT
add 65105 queue 22 proto tcp tcpflags ack iplen 0-80 recv IF_EXT
add 65106 queue 21 proto tcp iplen 0-300          recv IF_EXT
add 65107 queue 20 proto tcp dst-port rsync       recv IF_EXT
add 65108 queue 20 proto tcp                      recv IF_EXT
add 65109 queue 21 proto ipv6 iplen 0-300         recv IF_EXT
add 65110 queue 20 proto ipv6                     recv IF_EXT
add 65111 queue 21 proto ospf                     recv IF_EXT
add 65112 queue 21 log frag                       recv IF_EXT
add 65113 queue 21 in                             recv IF_EXT
add 65119 pass     in


  Mark



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?200706130037.48372.Mark.Martinec>