Skip to content

Instantly share code, notes, and snippets.

@unixzen
Forked from mcastelino/iptables-cheatsheet.md
Created June 26, 2023 09:06
Show Gist options
  • Select an option

  • Save unixzen/1a937df4a73fc111cac39c0b413c819b to your computer and use it in GitHub Desktop.

Select an option

Save unixzen/1a937df4a73fc111cac39c0b413c819b to your computer and use it in GitHub Desktop.
iptables-cheatsheet

https://www.digitalocean.com/community/tutorials/a-deep-dive-into-iptables-and-netfilter-architecture https://www.netfilter.org/documentation/HOWTO/netfilter-hacking-HOWTO-3.html

The netfilter hooks in the kernel and where they hook in the packet flow


      Netfilter Hooks                                        +----------->      local process    ---------+
                                                             |                                            |
                                                             |                                            |
                                                             |                                            |
                                                             |                                            v
                                                             |
                                               +-------------+--------+                         +----------------------+
                                               |                      |                         |                      |
                                               |        input         |                         |     output           |
                                               |                      |                         |                      |
                                               +------+---------------+                         +----------+-----------+
                                                      ^                                                    |
                                                      |                                                    |
     +------------------------+                       |                                                    |
     |                        |                       |                  +---------------------+           +------------->  +-------------------------+
+--> |     pre routing        |                                          |                     |                            |                         |
     |                        +------------------  route     ----------> |      forward        +--------------------------> |     post routing        |
     |                        |                    lookup                |                     |                            |                         |
     +------------------------+                                          +---------------------+                            +-------------------------+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment