Networking Forums

Networking Forums > Computer Networking > Linux Networking > HTB + NAT on Debian (outgoing traffic shaping problems)

Reply
Thread Tools Display Modes

HTB + NAT on Debian (outgoing traffic shaping problems)

 
 
Laurynas Butkus
Guest
Posts: n/a

 
      05-12-2004, 12:17 PM
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
 
 
 
 
joseph philip
Guest
Posts: n/a

 
      05-14-2004, 01:04 AM
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
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 On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
traffic-shaping? peter pilsl Linux Networking 0 04-15-2007 08:20 PM
Traffic Shaping Question X Linux Networking 16 03-15-2006 07:36 PM
MN-100 and traffic shaping Nikitas Broadband Hardware 1 07-25-2004 01:19 AM
shaping traffic Benjamin Hirsch Home Networking 3 02-12-2004 07:51 PM
Traffic Shaping Leonardo H. Machado Linux Networking 0 10-12-2003 03:26 AM



1 2 3 4 5 6 7 8 9 10 11