Forrest logo
back to the iptables tool


Allow incoming traffic from specific IP addresses.
$ sudo iptables -A INPUT -s ${ip_address} -j ACCEPT
try on your machine

This command adds a new rule to the INPUT chain in the iptables firewall on a Linux machine, allowing incoming traffic from a specific IP address. The ${ip_address} is a placeholder for the actual IP address that you want to allow.

The -A flag indicates that the rule should be appended to the end of the INPUT chain, which is the chain that handles incoming traffic.

The -s flag specifies the source IP address of the traffic that should be allowed. In this case, it is set to the IP address specified by ${ip_address}.

The -j flag specifies the target of the rule, which in this case is ACCEPT. This means that any traffic from the specified IP address will be allowed through the firewall.

Finally, since sudo is used in the command, the rule is added with administrative privileges, which are required to modify the firewall rules.

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