IPtables Commands
iptables commands
List current rules
iptables -L
Basic whitelist command
iptables -A INPUT -s IPADDRESS -j ACCEPT
Whitelist for a specific port
iptables -I INPUT -p tcp -s IPADDRESS --dport 22 -j ACCEPT
Save config command
iptables-save
Ubuntu Command for saving direct to the file
/sbin/iptables-save > /etc/iptables/rules.v4
Ubuntu/Debian iptables config locations
/etc/iptables/rules.v4
/etc/iptables/rules.v6
CentOS/Fedora/Redhat/Rocky/Alma
/etc/sysconfig/iptables
/etc/sysconfig/ip6tables