How to Use Iptables
hugodutka.comFor a full, visual explanation, I'd recommend checking https://stuffphilwrites.com/2014/09/iptables-processing-flow... to see the flowchart for multiple scenarios.
Oh my god. This brings back a ton of memories. I was writing a port knocking implementation back in 2016 or so as a side project and I was using this exact flowchart to use iptables for opening/closing ports and routing packets.