I have quite limited networking experience, so probably i'm asking about very simple things. I'm reading about linux bridge interfaces, and documentation states that there is no NAT by default and bridge interface just passes over packets as-is from one network to another. That confuses me: i'm imagining a LAN-behind-WiFi setup where my machine (let's name it access-point
) can be connected to WiFi access point and share internet connection by bridging wireless0
to eth0
. The LAN itself would have some own address range (say, 192.168.0.0/24) and, if i understand it correctly, connection would be processed in following way:
- lan-device-1: send this frame with MAC 00::01 and with encapsulated dns query and source address 192.168.0.1 / target address 8.8.8.8 to eth0
- access-point: just pushes frame from eth0 to wireless0
- 8.8.8.8: extracts DNS query, prepares answer, but sees source address 192.168.0.1
- some wild magic appears and forces response to go out to access-point IP address rather than to lan-device-1 address
- access-point: receives answer from 8.8.8.8, wild magic reappears and tells access-point that this response belongs to lan-device-1 rather than access-point, so response is flushed down to eth0 with correct MAC address
Of course we live in world with no magic, so those assumptions are wrong. But how then packets are routed to correct destinations? It would be simple if NAT would be in place, but it isn't and i can't understand how A) remote machine knows where to send response and B) how intermediatry (access-point in example) differentiates it's own traffic from bridged traffic.