PureftpdIt is a fast, high-quality, and fully functional ftp server. The most important thing is that it supports setting the Default Client encoding. Pureftpd is very powerful and useful. For more information about global bandwidth limits of PureFTPd, see the following section.
How do I limit the total bandwidth used by FTP?
Pure-FTPd can limit the bandwidth occupied by each session. however, limiting the total bandwidth is a function that is intentionally not added, because most operating systems already have effective algorithms to handle bandwidth restrictions.
The following is an example of Linux.
1) view the/proc/sys/net/ipv4/ip_local_port_range file. we can see two numbers: This is the range of the local port used by the Linux kernel to process external connections. the FTP port you want to retain for the passive mode FTP must not be within this range. therefore, if:
"Cat/proc/sys/net/ipv4/ip_local_port_range" return "32768-61000", you can leave port 10000 to 20000 to the FTP server instead of 30000-40000. (You can also choose to adapt the local port range ).
2) Change the previous rows and save the following script.
#! /Bin/sh
# Simple bandwidth limit-English author j@4u.net
# Change the following data to your connection bandwidth
# (For users, write down the maximum bandwidth you may get, rather than the local Ethernet connection speed .)
REAL_BW = '10mbit'
# Change the following data to the bandwidth you want to allocate to FTP
# The bandwidth units we use are megabits, not megabytes, so 80 kbit is 10 Kilobytes/s.
FTP_BW = '80kbit'
# Change the following data to your physical device (or 'ppp0 ')
NIC = 'eth0'
# Change the following data to the port range you allocated to the 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
3) Make sure that you have installed the 'tc 'command. if your release does not provide the 'IP' and 'tc 'commands, the script cannot run. to use these two commands, you must install a software package named 'iproute2.
4) Add the passive port range you have specified to start Pure-FTPd.
/Usr/local/sbin/pure-ftpd-p :20000-HBA
5) run the script created in step 2. If the script cannot be run, check whether QOS support has been compiled into your Linux kernel.
6) Enjoy :)
You can also refer:
Http://www.docum.org
Http://www.shorewall.net/traffic_shaping.htm and
Http://talk.trekweb.com /~ Jasonb/articles/linux_tc_minihowto.shtml
Through the introduction and examples above, we can clearly know how to implement global bandwidth limit for PureFTPd. I hope this article will help you!
- Windows Command Line FTP client and ls
- How to start Pure-FTPd in the background
- Two chroot methods in pure-ftpd
- Basic installation of PureFTPd
- PureFTPd issue-OS _v4 denied and incorrect Group Ownership
- Pureftpd issue set password and pure-pw script
- Use pureftpd to set up an ftp server with web Management in slackware 10.1