LinuxQuestions.org
Review your favorite Linux distribution.
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 09-06-2013, 10:50 PM   #1
psycroptic
Member
 
Registered: Aug 2011
Location: USA
Distribution: ArchLinux - 3.0 kernel
Posts: 349

Rep: Reputation: Disabled
tc htb - trying to rate limit traffic on 1 single port


i have this htb qdisc on a particular interface in my router:

Code:
tc qdisc add dev internal root handle 1: htb default 1
tc class add dev internal parent 1: classid 1:1 htb rate 51.88mbit ceil 51.88mbit
tc class add dev internal parent 1: classid 1:2 htb rate 32.5mbit ceil 32.5mbit
I can add particular IP to this class 1:2 using this in /etc/iptables/iptables.rules:

Code:
-A POSTROUTING -o internal -d 172.16.16.14 -j CLASSIFY --set-class 1:2
but if I try to limit traffic to/from 172.16.16.14 on port 12321 ONLY using this:

Code:
-A POSTROUTING -o internal -d 172.16.16.14 -p tcp -m tcp --dport 12321 -j CLASSIFY --set-class 1:2
-A POSTROUTING -o internal -d 172.16.16.14 -p udp -m udp --dport 12321 -j CLASSIFY --set-class 1:2
-A POSTROUTING -o internal -d 172.16.16.14 -p tcp -m tcp --sport 12321 -j CLASSIFY --set-class 1:2
-A POSTROUTING -o internal -d 172.16.16.14 -p udp -m udp --sport 12321 -j CLASSIFY --set-class 1:2
it doesn't work; traffic on these ports are not limited at all.

what gives?

Last edited by psycroptic; 09-06-2013 at 11:00 PM.
 
Old 09-11-2013, 01:35 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
What does this return?
Code:
iptables -t mangle -nvxL --line-numbers
 
Old 09-11-2013, 09:03 AM   #3
psycroptic
Member
 
Registered: Aug 2011
Location: USA
Distribution: ArchLinux - 3.0 kernel
Posts: 349

Original Poster
Rep: Reputation: Disabled
that wasn't it; actually, the problem seemed to be application-related.

i was trying to rate-limit torrent traffic, in this case it was a Mac running some bittorrent client called "Frostwire". For some reason, it wasn't responding to this rule; I had set it to use TCP and UDP ports 12321, but somehow it was getting around this - downloads weren't stopping at 32mbit. I had the guy download another torrent client (utorrent) which behaved as expected, and I tested a few others on my own machine using the same rule, and they all responded to this.

so i don't know what frostwire was doing, but in any case it seemed to be the only one with the problem.

thanks anyway
 
  


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
limit number of connections for a single ip on port 80 to CentOS 5.5 walidaly Linux - Security 4 09-08-2010 11:52 PM
limit bandwidth rate for scp using tc htb Linux abhelp Linux - Networking 9 08-20-2010 09:45 AM
HTB Problem - bandwidth limit Bart007 Linux - Networking 4 08-15-2006 07:17 AM
tcpdump wont show the correct amount of traffic in single port scan? positrox Linux - Networking 0 08-05-2006 09:04 AM
dat transfter rate on a single port.....? shahg_shahg Linux - Networking 1 05-05-2006 06:05 AM

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

All times are GMT -5. The time now is 09:12 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