LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-21-2005, 07:25 AM   #1
ddaas
Member
 
Registered: Oct 2004
Location: Romania
Distribution: Ubuntu server, FreeBsd
Posts: 474

Rep: Reputation: 30
HTB as a child of another HTB - doesn't work


Hi,
I am new to HTB and in the learning process I want to simulate a slower link on my server to see how qdisc works.
I have a 100Mbit connection.
I want to simulate a 100K connection and to divide traffic between FTP and SMB. (like in HTB user guide).
The problem is that it doesn’t work. I can transfer files with FTP of SAMBA at the wire speed. (Just like when there was no HTB and qdisc). What do I do wrong?

Here is my script:



Code:
#!/bin/bash

tc qdisc del dev eth0 root
iptables -F
iptables -F -t mangle

# qdisc for delay simulation
tc qdisc add dev eth0 root handle 100: htb
tc class add dev eth0 parent 100: classid 100:1 htb rate 100kbps

tc qdisc add dev eth0 parent 100:1 handle 1: htb

tc class add dev eth0 parent 1: classid 1:1 htb rate 100kbps
tc class add dev eth0 parent 1:1 classid 1:10 htb rate 50kbps ceil 100kbps prio 1
tc class add dev eth0 parent 1:1 classid 1:20 htb rate 50kbps ceil 100kbps prio 2

tc qdisc add dev eth0 parent 1:10 handle 22: sfq perturb 10
tc qdisc add dev eth0 parent 1:20 handle 23: sfq perturb 10
I've tried with u32 and with fw filter


Code:
 
tc filter add dev eth0 parent 1: protocol ip u32 match ip sport 20 0xffff flowid 1:10
tc filter add dev eth0 parent 1: protocol ip u32 match ip sport 139 0xffff flowid 1:20
OR
Code:
iptables -A OUTPUT -o eth0 -t mangle -p tcp --sport 20 -j MARK --set-mark 22
tc filter add dev eth0 parent 1: protocol ip handle 22 fw classid 1:10

iptables -A OUTPUT -o eth0 -t mangle -p tcp --sport 139 -j MARK --set-mark 33
tc filter add dev eth0 parent 1: protocol ip handle 33 fw classid 1:20
 
Old 07-22-2005, 02:44 AM   #2
born4linux
Senior Member
 
Registered: Sep 2002
Location: Philippines
Distribution: Slackware, RHEL&variants, AIX, SuSE
Posts: 1,127

Rep: Reputation: 49
what kind of setup do you have? you can only limit outgoing traffic only if you are the bottleneck ofyour networ like this:


internet-----YOU----LAN

or LAN1----YOU---LAN2

if won't work with YOU---LAN setup if you are only working with one interface.
 
Old 07-22-2005, 02:58 AM   #3
ddaas
Member
 
Registered: Oct 2004
Location: Romania
Distribution: Ubuntu server, FreeBsd
Posts: 474

Original Poster
Rep: Reputation: 30
I have just a testing environment:

LINUX SERVER(where QoS is done) -> LAN

Quote:
if won't work with YOU---LAN setup if you are only working with one interface.
You say it doesn't work if I have 1 NIC? That's not true. Every outbound packet can be shaped. If I have just 2 computers with a crossover cable attached with each other I can shape the outgoing packets. I can shape packets on OUTGOUING and PREROUTING chain of netfilter/iptables.

My problem is that it doesn't work with 2 qdisc (as in HTB User guide - page 6 of 8)

Something like this:
Quote:
# qdisc for delay simulation
tc qdisc add dev eth0 root handle 100: htb
tc class add dev eth0 parent 100: classid 100:1 htb rate 100kbps

tc qdisc add dev eth0 parent 100:1 handle 1: htb
------------------------------------------------------------
I've tried other setups and everything works as expected.

Any idea with this setup (2 qdisc, one simulates a slower link)?
 
Old 07-22-2005, 03:32 AM   #4
born4linux
Senior Member
 
Registered: Sep 2002
Location: Philippines
Distribution: Slackware, RHEL&variants, AIX, SuSE
Posts: 1,127

Rep: Reputation: 49
he he, my mistake. i didn't think YOU<--->LAN (was thinking just one direction.) and as i've said - only for outgoing.

ok. i'll try and run your settings.

Last edited by born4linux; 07-22-2005 at 03:47 AM.
 
Old 07-24-2005, 10:52 PM   #5
born4linux
Senior Member
 
Registered: Sep 2002
Location: Philippines
Distribution: Slackware, RHEL&variants, AIX, SuSE
Posts: 1,127

Rep: Reputation: 49
uh well i can't figure it out or i'm interpreting the docs in a different way. anyway, i've seen your post in lartc mailing list (and that's the best place where to raise issues like this.
good luck.
 
Old 07-25-2005, 03:21 AM   #6
ddaas
Member
 
Registered: Oct 2004
Location: Romania
Distribution: Ubuntu server, FreeBsd
Posts: 474

Original Poster
Rep: Reputation: 30
ok,
thanks
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
QoS with HTB diaskimo Linux - Networking 3 08-08-2005 12:57 AM
htb interface roopunix Linux - Networking 7 07-29-2005 08:32 AM
How To HTB linuxcolor Fedora 1 02-15-2005 07:46 AM
htb.init Ipolit Slackware 2 05-02-2004 01:23 PM
HTB.. qos or what? bcc1981 Mandriva 0 04-16-2004 02:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration