LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   “tc” command, making simple traffic control for specific port, lo, and one more thing (https://www.linuxquestions.org/questions/linux-newbie-8/%93tc%94-command-making-simple-traffic-control-for-specific-port-lo-and-one-more-thing-4175433684/)

hudac 10-23-2012 10:00 AM

“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.

chrism01 10-23-2012 06:58 PM

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 :)

hudac 10-24-2012 01:50 AM

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


All times are GMT -5. The time now is 12:28 AM.