Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save palpaga/df61e106b93e39ed9c5348a767b071e9 to your computer and use it in GitHub Desktop.
Save palpaga/df61e106b93e39ed9c5348a767b071e9 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