I'm trying to learn how packet routing works on a linux-based router (OpenWRT in my case) a bit better for setting up a few projects/just-learning. Referencing the below chart, I'll break this into two questions
- I'm wondering what (like a process, some other type of routing table, or something I can edit maybe?) is specifically responsible, outside of iptables, for making/directing the "Routing Decisions" in the nodes below. Note, I'm talking about the actual nodes labeled "Routing Decision" in the below picture, not the iptables. IE after a packet makes it through the nat PREROUTING, something has to tell the packet weather to next go to the input filter chain towards a local process, or go to the forward chains, right? For both parts of this question I'd say we can just stick to the top most "Routing Decision" node since I would guess the lower nodes encompass many more possibilities and processes.
- Also/or, how is the decision made? Is it as simple as, if the incoming packet is destined for the interface ip it came in on (192.168.1.1 from the LAN connection for example), then it should go into this machine itself and send it through the input tables, otherwise it should get forwarded to another interface for going to the external network (just the internet in this case), so forward it to any other interface accepting forwarding. Or, are there other possible ways a packet could be directed into the router, to be handled by some process like a DNS server or something, instead of being directly forwarded to an internet-connected interface.