Global bandwidth limit of PureFTPd

Source: Internet
Author: User

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

 
 
  1. FTP_PORT_LOW="10000" 
  2.  
  3. FTP_PORT_HIGH="20000" 
  4.  
  5. tc qdisc add dev "$NIC" root handle 1: cbq \  
  6.  
  7. bandwidth "$REAL_BW" avpkt 1000  
  8.  
  9. tc class add dev "$NIC" parent 1: classid 1:1 cbq bandwidth "$REAL_BW" \  
  10.  
  11. rate "$REAL_BW" maxburst 5 avpkt 1000  
  12.  
  13. tc class add dev "$NIC" parent 1:1 classid 1:10 cbq \  
  14.  
  15. bandwidth "$REAL_BW" rate "$FTP_BW" maxburst 5 avpkt 1000 bounded  
  16.  
  17. tc qdisc add dev "$NIC" parent 1:10 sfq quantum 1514b  
  18.  
  19. tc filter add dev "$NIC" parent 1: protocol ip handle 1 fw flowid 1:10  
  20.  
  21. iptables -t mangle -A OUTPUT -p tcp --sport 20:21 -j MARK --set-mark 1  
  22.  
  23. iptables -t mangle -A OUTPUT -p tcp \  
  24.  
  25. --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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.