<aside> đź’ˇ
In this chapter, we will explore the roles of netfilter and iptables, take a closer look at the iptables filter table, and conduct experiments to observe how Docker impacts iptables.
</aside>
When we have a Linux machine connected to a network and want to perform certain actions on its packets, how should we proceed?
First, we need to understand that in the Linux environment, network packets arriving from outside to the user application generally follow the flow shown in the diagram below.
Netfilter is a framework within the Linux kernel used for filtering, modifying, and forwarding network packets.Reference: https://www.netfilter.org/
iptables is a user-space tool used to configure and manage rules within the netfilter framework, primarily operating at Layer 3 (the IP layer).filter (for filtering), nat (for network address translation), and mangle (for packet modification).INPUT (incoming packets), OUTPUT (outgoing packets), and FORWARD (forwarded packets).