Skip to contentSkip to conversation

Tc - Class HTB - Filter u32 - Match ip dport

LARTC Somesh Banerji 2 participants 2 messages Oct 8, 2003

lore
Share & tools
lore
#0 lore raw

My setup....

[A]FTP Server ----> [B]QOS Server ----> [C]Host

What I want to do.....

Setup a HTB class for 32kbps with a u32 filter to match a Destination IP.

I get a perfect result for a ftp `get' on [C].

ftp> get test
local: test remote: test
227 Entering Passive Mode (203,200,72,102,12,231)
150 Opening BINARY mode data connection for test (1025830 bytes).
##############################################################
########...................################
226 Transfer complete.
1025830 bytes received in 262 secs (3.8 Kbytes/sec) ftp>

The working cfg on [B] is as under...

tc qdisc add dev eth0 root handle 10: htb
tc class add dev eth0 parent 10 classid 10:10 htb rate 32kbit ceil 32kbit tc filter add dev eth0 parent 10: protocol ip prio 100 u32 match ip dst
203.200.72.91 flowid 10:10

But download becomes out of control when I delete, just the filter to replace it with...

tc filter add dev eth0 parent 10: protocol ip prio 100 u32 match ip sport
20 0xffff flowid 10:10

                       ---OR---

any sport/dport with a valu of 20,21,22 14,15,16 0014,0015,0016

When the test setup & the test procedure is the same. It should work for the Protocol if it worked for the IP

!!!What could be wrong!!!!

I only change from `u32 match ip dst 203.200.72.91' to 'u32 match ip
<sport|dport> <ftp-ports> 0xffff'
I tried with all known <ftp-ports> as sport' & dport' both in decimal &
Hex.

Regards,

Somesh Banerji
Sr. Engineer
HCL Comnet System & Services
NOIDA U.P. INDIA
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#1 lore raw

Hi,

Quoted 3 lines

ftp> get test
local: test remote: test
227 Entering Passive Mode (203,200,72,102,12,231)

                ^^^^^^^^^^^^
Quoted 6 lines

150 Opening BINARY mode data connection for test (1025830 bytes).
##############################################################
########...................################
226 Transfer complete.
1025830 bytes received in 262 secs (3.8 Kbytes/sec) ftp>

This log shows that you are using Passive FTP

Quoted 2 lines

tc filter add dev eth0 parent 10: protocol ip prio 100 u32 match ip sport 20 0xffff flowid 10:10

now you put up a rule for sport 20.
Passiv FTP does not use sport 20, it uses any port > 1024, only "active" FTP uses port 20 as sport for data transfare,..

Jan Gerritsen
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿË™¨¥Šx%ŠË,S ùšŠYšŸ÷lõ¯ç–m§ÿÿ™¨¥™©ÿvÏZşy™¨¥™©ÿ–+-ŠwèşV«µÁÎY3ÿ†Ûiÿÿåj»\şŠà