Skip to content

Instantly share code, notes, and snippets.

@curtkim
Last active May 30, 2021 14:12
Show Gist options
  • Save curtkim/d7f3569f2f900eb04cc6 to your computer and use it in GitHub Desktop.
Save curtkim/d7f3569f2f900eb04cc6 to your computer and use it in GitHub Desktop.
TCP

TCP Demultiplexing

TCP Demultiplexing

IP header

IP header

'protocol field'

  • 1 : ICMP
  • 2 : IGMP
  • 6 : TCP
  • 17 : UDP

UDP header

UDP header

TCP header

TCP header

NetFilter Hook

  • PREROUTING : before Routing Decision. PortAddressTranslation(NAPT), DestinationNetworkTranslation(DNAT)
  • LOCAL INPUT
  • FORWARD
  • LOCAL OUTPU
  • POSTROUTING : after Routing Decision. SourceNetworkAddressTranslation(SNAT)

NetFilter Flow

  • PREROUTING > FORWARD > POSTROUTING
  • PREROUTING > INPUT
  • OUTPUT > POSTROUTING
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment