LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-23-2012, 11:00 AM   #1
hudac
LQ Newbie
 
Registered: Oct 2012
Posts: 12

Rep: Reputation: Disabled
“tc” command, making simple traffic control for specific port, lo, and one more thing


Hey,

1.
I'm new at linux and my goal is to create a simple traffic control for interface "eth0" or "lo" using the tc command (or other commands like ifconfig or iptables, but i don't think i need them).

My kernel is 2.6.18-238.el5 GNU/Linux, and i'm using redhat.

my script is:

"tc qdisc del dev $DEV root"
"tc qdisc add dev $DEV root handle 1: htb default 10"
"tc class add dev $DEV parent 1: classid 1:10 htb rate $DNLD"
"tc filter add dev $DEV parent 1: protocol ip u32 match ip dport $input_port 0xffff flowid 1:10"

while $DNLD is the bandwidth limit, $DEV is eth0 or lo, and $input_port is the port i want to limit.

I have read a lot of pages on the internet and understood that this is how it should be written, but this lines don't limit the specific port, but all of the ports.

I tried to use also "sport" but it doesn't work also. so i don't understand what the problem is.

2.
Another strange thing is that the bandwidth limiting seems to be working, and the reset line seems to be working aswell, (which is the first line: tc qdisc del dev $DEV root )

but still, the output line after i'm writing it is: "RTNETLINK answers: No such file or directory" and I don't know why and if it causes any damage.

3.
When i'm running the script on "lo", it doesn't work. it doesn't really limiting anything.
why does it happen?

4.
When i'm running the script on "eth0", while the server is the same linux computer, and the client is another linux computer (connected by lan) the limiting doesn't work also.
why does it happen?

------

just for clarification:
my server is the linux server, i have access to it with ssh.
the loopback doesn't work on this computer.

one client is a windows computer connected through lan (on this computer the limiting works just fine)

the second client is the other linux computer (connected on lan)

when i say "the limiting doesn't work" , i mean that i'm measuring the download speed with "iftop"

Please let me know if you need any other information. I'll be glad if someone will be able to help me. thanks ahead.
 
Old 10-23-2012, 07:58 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,417

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
Well, I've never messed with tc, but I do have this page bookmarked just in case http://www.knowplace.org/pages/howto.../resources.php.
Hope its of some help to to you.

PS: Welcome to LQ
 
Old 10-24-2012, 02:50 AM   #3
hudac
LQ Newbie
 
Registered: Oct 2012
Posts: 12

Original Poster
Rep: Reputation: Disabled
Thanks,
I already saw this site while i was looking for answer, I don't remember if it was any more useful than other sites...

I think i solved my problem, Thanks to this sites:


http://forums.gentoo.org/viewtopic.php?t=225863
http://lartc.org/howto/lartc.qdisc.filters.html
http://lartc.org/howto/lartc.qdisc.classful.html
http://www.iplocation.net/tools/traffic-control.php
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
monitoring traffic on specific port lildee Programming 2 10-03-2009 07:03 AM
tc traffic control tc traffic control Linux QoS control tool(noob help) inv|s|ble Linux - General 1 07-26-2007 12:12 PM
Blocking outgoing traffic from a specific port billy3 Linux - Security 10 09-24-2004 09:10 PM
Blocking Traffic on a specific port (kazaa) GratePayne Linux - Security 4 05-09-2004 10:10 AM
specific port traffic graph using mrtg newpenguin Linux - Networking 7 12-16-2003 07:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:39 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration