LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-12-2007, 10:48 AM   #1
inv|s|ble
Member
 
Registered: Dec 2001
Distribution: freeBSD, slack 9/10/current
Posts: 60

Rep: Reputation: 15
tc traffic control tc traffic control Linux QoS control tool(noob help)


I run pure-ftpd, and noticed in their FAQ it list a simple script for limiting bandwidth for ftp, via tc. So I load up the script, and run it, and love it, then I try to transfer on my local lan, and find it way too slow for my taste for interal. I can not find a way to remove it all, can someone give me alittle more help than 'read the man pages'(because I have read them several times, and do not seem to grasp how to 'remove' the rules, just add them. When I try to 'del' them I get errors about 'We have an error talking to the kernel'. Here is the script.

Code:
  
#! /bin/sh
# Simple bandwidth limiter - <j@4u.net>

# Change this to your link bandwidth
# (for cable modem, DSL links, etc. put the maximal bandwidth you can
# get, not the speed of a local Ethernet link)
REAL_BW='10Mbit'

# Change this to the bandwidth you want to allocate to FTP.
# We're talking about megabits, not megabytes, so 80Kbit is
# 10 Kilobytes/s
FTP_BW='80Kbit'

# Change this to your physical network device (or 'ppp0')
NIC='eth0'

# Change this to the ports you assigned for passive FTP
FTP_PORT_LOW="10000"
FTP_PORT_HIGH="20000"

tc qdisc add dev "$NIC" root handle 1: cbq \
bandwidth "$REAL_BW" avpkt 1000

tc class add dev "$NIC" parent 1: classid 1:1 cbq bandwidth "$REAL_BW" \
rate "$REAL_BW" maxburst 5 avpkt 1000

tc class add dev "$NIC" parent 1:1 classid 1:10 cbq \
bandwidth "$REAL_BW" rate "$FTP_BW" maxburst 5 avpkt 1000 bounded

tc qdisc add dev "$NIC" parent 1:10 sfq quantum 1514b

tc filter add dev "$NIC" parent 1: protocol ip handle 1 fw flowid 1:10

iptables -t mangle -A OUTPUT -p tcp --sport 20:21 -j MARK --set-mark 1

iptables -t mangle -A OUTPUT -p tcp \
--sport "$FTP_PORT_LOW":"$FTP_PORT_HIGH" -j MARK --set-mark 1

Ok, I thought I fixed it, but evidentally not, because now nothing but http traffic works, and its sketchy at best, even after clearing the iptables rules the script added.

Last edited by inv|s|ble; 07-12-2007 at 11:17 AM.
 
Old 07-26-2007, 11:12 AM   #2
IceGrill
LQ Newbie
 
Registered: Jan 2002
Distribution: Mandrake
Posts: 25

Rep: Reputation: 15
Try using a command like this to reset all of your QoS settings:

tc qdisc del dev eth0 root

Where eth0 is your network interface.

See: http://www.rns-nis.co.yu/~mps/linux-tc.html
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
linux traffic control (tc) djsubari Linux - Networking 0 09-14-2006 07:09 AM
squid traffic control tarak4u Linux - Networking 0 03-17-2004 02:52 AM
Traffic control/managment in Linux RH Hacker Linux - Networking 1 04-16-2003 11:15 PM
traffic control sunreflex4 Linux - Networking 1 03-23-2003 11:52 AM
about traffic control in redhat 7.1 cmardhekar Linux - Networking 2 12-21-2001 01:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:47 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
Open Source Consulting | Domain Registration