How to list all iptables rules with line numbers on Linux

The iptables rules can be used for blocking all outgoing TCP connections on a specific port, say 111 in this case. $ sudo iptables -A OUTPUT -p tcp --dport 111 -j DROP. You can replace the chain name to INPUT for blocking TCP connections on the same port, but for incoming requests. $ sudo iptables -A INPUT -p tcp --dport xxx -j DROP 24. How to save/backup existing iptables rules to a file Iptables or iptables rules plays an important role in server administration part. You can secure your servers by using iptables rules. Here is an example which gives you an idea about ‘ how to backup existing iptables rules ‘ in to a text file and how to restore it to iptables. Managing the Iptables Firewall

# iptables -F OUTPUT. Making changes persistent. All changes to iptables rules using the CLI commands will be lost upon system reboot. However, iptables comes with two useful utilities: iptables-save and iptables-restore. iptables-save prints a dump of current rule set to stdout. This may be redirected to a file:

Linux iptables Firewall Simplified Examples - Like Geeks

25 Most Frequently Used Linux IPTables Rules Examples

Aug 10, 2015 Sysadmin tools: How to use iptables | Enable Sysadmin Jan 27, 2020 View iptables rules • Linux Hub