Basic usage of iptables

iptables consists of four tables of rules, each with its own distinct purpose:

  • Filter table: For basic protection of our servers and clients, this is the only table that we would normally use
  • NAT table: Network Address Translation (NAT) is used to connect the public internet to private networks
  • Mangle table: This is used to alter network packets as they go through the firewall
  • Security table: The security table is only used for systems that have SELinux installed

Since we're currently only interested in basic host protection, we'll only look at the filter table. Each table consists of chains of rules, and the filter table consists of the INPUT, FORWARD, and OUTPUT chains. Since our CentOS 7 machine uses Red Hat's ...

Get Mastering Linux Security and Hardening now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.