How are packets routed inside a single linux machine? Imagine the following setup:
+--------------------+
| apache on |
| 192.168.1.30:80 |
| | |
+---+ | +---+
|en0|--/ |en1| <------ packet to 192.168.1.30:80
+---+ +---+
192.168.1.30/24 10.0.0.30/24
| |
+--------------------+
Apache is bound to 192.168.1.30
When sending a packet to (Thanks A.B. for the correction.)192.168.1.30
, it is usually dropped. However, when one activates /proc/sys/net/ipv4/ip_forward
, the packet is routed to the far IP.
Sending a packet to 192.168.1.30
is accepted on the host even though it is sent to an interface with a different IP. This is called the weak host model.
Since this can be a security issue, I was wondering how Linux treats the routing with respect to the firewall.
How does such a packet traverse the firewall? Will it first go through the FORWARD
and then the INPUT
table?
FORWARD
, thenINPUT
.) – Georg Schölly Feb 20 '20 at 08:38