System Requirements

CentOS 6+ / Debian 6+ / Ubuntu 14.04 +


Recommend Debian 8 x64, this is the system I have been using, my script has the lowest error rate on this system.


Script version

Ver: 1.0.10


installation steps

Execute the code below to download and run the script.


wget -N --no-check-certificate && chmod +x && bash

After running the script, the script operation menu will appear, select and enter the corresponding number to operate.


Instructions for use

Go to the directory where the script is downloaded and run the script:



Then select the option you want to execute.


 iptables firewall block management script [vX.X.X]

- Toyo | -


0. View current banned list


1. Ban BT, PT

2. Block SPAM (Spam)

3. Ban BT, PT+SPAM

4. Block custom ports

5. Block custom keywords


6. Unblock BT, PT

7. Unblock SPAM (spam)

8. Unblock BT, PT+SPAM

9. Unblock custom port

10. Unblock custom keywords

11. Unblock all keywords


12. Upgrade script


Please enter the number [0-11]:

Other operations:

For convenience, I also made a few quick commands, without having to enter the menu to select the corresponding option, you can directly block/unblock it.


./ banbt

# Block BT, PT


./ banspam

# Block SPAM (spam)


./ banall

# Block BT, PT+SPAM


./ unbanbt

# Unblock BT, PT


./ unbanspam

# Unblock SPAM (spam)


./ unbanall

# Unblock BT, PT+SPAM

other instructions

Prompt wget: unknown host "" and other errors

This is because my domain name cannot be resolved. It is mostly a DNS problem. Please change the DNS to Google DNS (copy the following two lines and execute them together).


echo -e "nameserver

nameserver"> /etc/resolv.conf

Prompt wget: command not found error

This is your system is streamlined and too clean, wget is not installed, so you need to install wget.


# CentOS system:

yum install -y wget


# Debian/Ubuntu system:

apt-get install -y wget

To reprint, please indicate the hyperlink: "Original" iptables block BT/PT/SPAM (spam) and custom port/keywords One-click script

Hasznosnak találta ezt a választ? 5841 A felhasználók hasznosnak találták ezt (4140 Szavazat)