Skip to content

iptables

iptables

Usage

Allow from range from an interface to an specific port

iptables -A INPUT -p tcp -i [interface] -s [range] --dport [port] -j ACCEPT

serverfault

Install

iptables-persistent

When installed, it will save the current rules. If you want to save more afterwards, you have to manually save them:

iptables-save >/etc/iptables/rules.v4

stackexchange-unix

Tips

Clear all rules and allow all traffic

iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT

adminsehow