Skip to main content

Posts

Showing posts from June, 2020

IPTables Commands

To cause iptables to function as a basic packet filtering firewall, you need these commands: iptables -F iptables -N block iptables -A block -m state --state ESTABLISHED,RELATED -j ACCEPT Obviously, that is the most basic and essential iptables configuration. However, here are some others. To list the current iptables rules use: iptables –L To allow communication on a specific port, SSH port 22 and HTTP port 80 for example use: iptables –A INPUT –p tcp –dport ssh –j ACCEPT iptables –A INPUT –p tcp –dport 80 –j ACCEPT Also there are several flags that can be passed to the iptables command. Below are listed the most common flags and what they do. Several other flags exist but are not listed. A: Append this rule to a rule chain -L: List the current filter rules -p: The connection protocol used --dport: The destination port required for the rule. A single port can be given or a range. -i: Only match if the packet is coming in on the specified interface