What is the difference between LAN port and WAN port in the routers with integrated switches?

In the latest routers, where switching function is integrated into the box will have few LAN ports (say usually, 4 or 8) and 1 WAN port.

Usual configuration would be to connect computers or printers onto the LAN port and WAN port onto the modem to connect to the internet.

So is it like the LAN ports are nothing but the ports of the integrated switch? And WAN port is used to connect to a separate subnet, say to an another switch or to an another router? (Internally, it would be like integrated switch is connected to an another hidden WAN port*)


Solution 1:

You have the right idea.Internally these devices are VLAN switches with exposed ports a member of a single vlan + a single port computer to do routing between vlans and configured to look like a dumb switch and wan port

If you can run it, DD-WRT for example - exposes the internal workings somewhat - typically all 5 ports - the WAN port included - are VLAN switch ports- with another invisible VLAN trunk port on the motherboard.

It is thus (software permitting - and most software does not) possible to combine ports so they are all on the same VLAN and appear as a dumb switch, or you can break them out on to separate vlans and have multiple "WAN" ports, or multiple lan subnets.

It is certainly possible to connect the WAN port to a separate subnet, say to an another switch or to an another router - really, that, and having a route table is the core requirement of a router.

Solution 2:

It entirely depends on the router hardware.

I've seen router hardware where both the LAN ports and the WAN port are connected to the same switch, which is configured to add VLAN tags, and is connected to one ethernet port on the SoC of the router, where it's internally divided into two ethernet interfaces using the VLAN tag.

For those routers, when you reconfigure the switch, you can treat the WAN port as a fifth LAN port (if you don't need it), or you can use one of the LAN ports as the WAN port if the WAN port is broken (what happened on this particular router), etc.

I've also seen routers where the WAN port is connected to one ethernet port of the SoC, and the LAN ports are connected to a switch, and the switch is connected to a different ethernet port of the SoC. So you can't swap around anything on this hardware.

In general, no matter what the configuration, all of these are just ethernet ports. What makes them work as WAN or LAN is entirely the configuration on the embdedded Linux system that runs on the router.