I have question for the IPv4 Gateway on the LAN.
The documentation doesn't mention to set it to any particular value and OpenWrt seems to set a default of 192.168.2.1 as seen in the photo below. This is the address of the modem/router on OpenWrt's WAN.
Is this correct? Shouldn't the IPv4 gateway for the LAN be 192.168.1.1 i.e. the address of the OpenWrt router on the LAN. Or is this because the modem/router has a DMZ for the OpenWrt router.
Thanks for your answer. I would be grateful if you could clarify one small bit for me as well please.
I read somewhere that a router is a device that sits on 2 networks in this case OpenWrt sits on 192.168.2.0 the WAN and 192.168.1.0 the LAN and has 2 IP addresses 192.168.2.2 and 192.168.1.1.
According to Wikipedia:
A default gateway is the node in a computer network using the internet protocol suite that serves as the forwarding host (router) to other networks when no other route specification matches the destination IP address of a packet.
If we think of the OpenWrt router from the LAN perspective then isn't the WAN IP (192.168.2.2) the forwarding host to other networks? Or because it is the same host it doesn't "count"?
On the other hand if we think about it from the WAN perspective then it makes sense that 192.168.2.1 (modem/router's LAN IP address) is the default gateway.
Also should I then fill in the greyed out bit explicitly?
Think about it like this. The default gateway is the gateway of last resort. If you don't know where else to send the packet, you send it there.
Your router knows that for 192.168.1.X addresses it will send them to the lan.
Also for 192.168.2.X addresses it will send them to the wan.
For any other address which is not in the routing table, it will send it to 192.168.2.1 and that one will forward it accordingly, and so on until the packet reaches its destination.