HTB + NAT on Debian (outgoing traffic shaping problems)

This is a discussion on HTB + NAT on Debian (outgoing traffic shaping problems) within the Linux Networking forums, part of the Linux Forums category; hello, I'm running Debian Woody with 2.4.26 kernel. I have 3 NIC: eth0 - 192.168.0.0 ...


Go Back   Usenet Forums > Linux Forums > Linux Networking

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-12-2004
Laurynas Butkus
 
Posts: n/a
Default HTB + NAT on Debian (outgoing traffic shaping problems)

hello,

I'm running Debian Woody with 2.4.26 kernel. I have 3 NIC:
eth0 - 192.168.0.0 subnet
eth1 - 192.168.2.0 subnet
eth2 - DSL link

there are ~5 computers in every subnet and I want them to get equal
incoming and outgoing traffic with possibility to borrow unused
channel.

I have successfully used htb.init to shape my incoming traffic but I
ran into problems with outgoing. I try to mark outgoing packets with
iptables, but it doesn't work...

I do marking like this:
iptables -t mangle -A PREROUTING -s 192.168.2.10 -j MARK --set-mark
101

then NAT:
$IPT -t nat -A POSTROUTING -s $FRIEND -j SNAT --to $IP_BLUE

then in sysconfig:

cat ./eth2
DEFAULT=2

cat ./eth2-2.root
# root class containing total bandwidth
RATE=320Kbit
MTU=300

cat ./eth2-2\:101.madcrock
RATE=1Kbit
MARK=101
LEAF=sfq

I try to shape myself down to 1Kbit but during upload I get 2 and more
Kb/s...
Please help me to solve this problem.

Thanks in advance,
Laurynas
Reply With Quote
  #2 (permalink)  
Old 05-14-2004
joseph philip
 
Posts: n/a
Default Re: HTB + NAT on Debian (outgoing traffic shaping problems)

On Wed, 12 May 2004 05:17:27 -0700, Laurynas Butkus wrote:

> hello,
>
> I'm running Debian Woody with 2.4.26 kernel. I have 3 NIC: eth0 -
> 192.168.0.0 subnet
> eth1 - 192.168.2.0 subnet
> eth2 - DSL link
>
> there are ~5 computers in every subnet and I want them to get equal
> incoming and outgoing traffic with possibility to borrow unused channel.
>
> I have successfully used htb.init to shape my incoming traffic but I ran
> into problems with outgoing. I try to mark outgoing packets with
> iptables, but it doesn't work...
>
> I do marking like this:
> iptables -t mangle -A PREROUTING -s 192.168.2.10 -j MARK --set-mark 101
>
> then NAT:
> $IPT -t nat -A POSTROUTING -s $FRIEND -j SNAT --to $IP_BLUE
>
> then in sysconfig:
>
> cat ./eth2
> DEFAULT=2
>
> cat ./eth2-2.root
> # root class containing total bandwidth RATE=320Kbit MTU=300
>
> cat ./eth2-2\:101.madcrock
> RATE=1Kbit
> MARK=101
> LEAF=sfq
>
> I try to shape myself down to 1Kbit but during upload I get 2 and more
> Kb/s...
> Please help me to solve this problem.
>
> Thanks in advance,
> Laurynas



I don't know about the scripts that you are using but here are a few
general things.

HTB is not recomemded for these 1Kbit stuff. For that use cbq.


Traffic control is implimented by:
a) Classes : These are the transmission classes which send the data out.



$TC qdisc add dev $EXT root handle 1:0 cbq $AVPKT $BW

$TC class add dev $EXT parent 1:0 classid 1:1 cbq rate 300kbit $ALLOT prio
5 $AV PKT $BW bounded isolated

$TC class add dev $EXT parent 1:1 classid 1:10 cbq rate 220kbit $ALLOT
prio 5 $A VPKT mpu 64 maxburst 40 $BW weight 1000kbit isolated



b) Queues: These are queues, one to EACH class that you created. If you
did not specify a particular type of queue, it will use FIFO. A class will
get it's packets from its associated queue.



$TC qdisc add dev $EXT parent 1:10 sfq perturb 10 quantum 1492

c) Filters: These are rules that identify a packet and send it to a
particular class-queue combination (called a "flowid"). "fw" tells it to
use the mark on the packet.


$TC filter add dev $EXT parent 1:0 protocol IP prio 10 handle $DEFAULT fw
flowid
1:10


Without filters, it won't work.

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 12:34 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0