Forrest logo
back to the iptables tool

firewall:iptables:protocol:block:name

Block incoming traffic from specific protocol.
$ sudo iptables -A INPUT -p ${protocol_name} -j DROP
try on your machine

This command is used to add a new rule to the INPUT chain of a network firewall using the iptables tool. It drops or blocks traffic based on the specified protocol name.

Here's a breakdown of the command:

  • sudo: This command is used at the beginning of the command to ensure that the user has administrative privileges to execute the command.

  • iptables: This is the command-line utility that is used to manage the netfilter firewall in Linux.

  • -A INPUT: This option adds a new rule to the INPUT chain. The INPUT chain is used to filter incoming traffic on the server.

  • -p ${protocol_name}: This specifies the protocol name that should be blocked or dropped. The ${protocol_name} should be replaced with the actual name of the protocol, such as TCP or UDP.

  • -j DROP: This is the action that should be taken when traffic matching the protocol specified in the rule is encountered. In this case, it is to DROP or discard the traffic.

Overall, this command is adding a new rule to the INPUT chain of the firewall, which will drop all incoming traffic of the specified protocol.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the iptables tool