3

I am trying to understand why I would choose an ER-X (Internal switch, yes, all ports) vs an ER-4 (Internal switch, no)

My understanding is both routers and switches can be used to connect multiple computers to a network (while routers can also connect that network to the Internet).

I am struggling to understand why switches are so prevalent.

sunknudsen
  • 902
  • 11
  • 23

3 Answers3

3

My understanding is both routers and switches can be used to connect multiple computers to a network (while routers can also connect that network to the Internet).

Routers with internal switches, yes. Otherwise no – a router only sits at the boundary between networks, but all of its ports are completely independent from each other.

The question sounds like you're mostly familiar with home routers, which almost always have an integrated switch for the LAN ports – that's why they can connect multiple computers to a network. They just don't explicitly advertise having a switch, whereas multi-purpose routers do.

Though, if a router doesn't have an internal hardware switch, it can still bridge multiple ports "in software" i.e. forwarding packets through the CPU, just like what you'd get when creating a 'bridge' on Linux. However, this will not provide nearly as good performance as you'd get from hardware switching. (It might be just fine for bridging 2 ports, less so for 8 or 16 or even 48 ports.)


In general, routers are not limited to connecting "a network to the Internet". They just forward packets according to specified rules, so they can connect any number of networks. Indeed the Internet itself consists of networks interconnected using routers, many of which might have 10–20 independent ports and be connecting as many networks in one place. (It is not quite like "having multiple WAN" ports – routers don't actually care about whether any of those networks is a "WAN" or a "LAN", and in many cases none of those labels apply.)

So the EdgeRouter devices and their firmwares are built for flexibility. Note how the ER-4 does not have any markings like "└──LAN──┘" – its three Ethernet ports are meant to belong to three separate networks. For example, they could be regular "WAN + LAN#1 + LAN#2" if you want to have two independent LANs (family/guest or secure/IoT or your/roommate's or whatever), but they could also be three different LANs (with Internet access provided by another router further away... or with no Internet access at all).

so by default, a router with a WAN port and two LAN ports would be used to connect two separate networks to the internet

If you are talking about the ER-4, it doesn't specifically have "a WAN port and two LAN ports" – it has three equal ports, which you configure in whichever way you need. But yes, you can use it to connect two LANs to the Internet, and that's probably what most people use it for.

What makes an Ethernet port "WAN" is not hardware but the configuration: 1) a "default route" pointing via this port; 2) firewall rules to block incoming connections from the Internet; and 3) NAT applied to packets going out of this port.

(both networks potentially using the same subnet)?

No – different networks are meant to use different IP subnet numbers. If you try to configure two separate interfaces to simultaneously be e.g. in the 192.168.1.0/24 network, only one will work correctly.

can computers on both networks "see" each other?

In general, any network can communicate with any other network (as long as routes are configured correctly). The only exception is that routers won't forward broadcast packets.

The exact answer depends on what you exactly mean by "see", as I've seen people ask this question having two very different things in mind:

  • Can they send packets directly to each other? Yes, definitely.

    For example, when you run ping 192.168.7.5 or visit http://192.168.43.99/, the directed packets will be forwarded to the correct network. That's what a router does, literally.

  • Can they discover each other using broadcast packets? Probably not.

    For example, when you open the "Network" section in Windows Explorer, it sends out a broadcast packet asking all other computers to respond. This packet will not be forwarded by routers, so only computers within the same LAN will show up in the list.

u1686_grawity
  • 426,297
  • 64
  • 894
  • 966
  • Thanks for the answer... so by default, a router with a WAN port and two LAN ports would be used to connect two separate networks to the internet (both networks potentially using the same subnet)? In that scenario, can computers on both networks "see" each other? – sunknudsen Oct 15 '20 at 19:03
  • 1
    Two separate networks cannot use the same subnet; that's literally part of what makes them two separate networks. But they can certainly communicate with each other (just as the networks comprising the Internet communicate with each other); the only limitation is that routers won't forward broadcast packets, which some apps or games use for discovering each other. (I.e. it depends on what you really meant by "see".) – u1686_grawity Oct 15 '20 at 19:09
  • 1
    (In your WAN+LAN1+LAN2 example, what makes having two networks more useful than having one is that you can apply different rules to each, and to the communications between them. For example, using firewall rules you can decide to allow connections from LAN1 to LAN2 but not the other way around.) – u1686_grawity Oct 15 '20 at 19:16
  • Very informative, thanks! When configuring the integrated switch on an ER-X to vlan ports 2-4, my understanding is that two networks will be created (one on port 1 with its own subnet and one using the hardware switch on ports 2-4 with its own subnet). Is that assumption correct? Would the two networks be able to communicate by default? My understanding thanks to your help is yes, but not using broadcast packets. I could then setup a firewall if I wish to isolate these networks... correct? – sunknudsen Oct 15 '20 at 19:18
  • Btw, you seem very knowledgeable and a great teacher. I am a privacy content creator on YouTube and PeerTube (see https://www.youtube.com/sunknudsen). I could use a hand with some peer review in the context of networking content. If ever you are interested, would love to connect. – sunknudsen Oct 15 '20 at 19:21
1

Its a matter of convenience.

If you already have a switch in place, where all your devices are connected, then all you need as the router. You would then connect that router to the switch, thereby giving all those devices connectivity.

However, if you do not have a switch, a router with one integrated, saves you the need to buy a separate one, since everything would be connected to the switch portion of the router/switch combo.

Keltari
  • 71,875
  • 26
  • 179
  • 229
  • I am asking specifically in the context of Ubiquiti hardware as I have never encountered a router that doesn't have an integrated switch. What is the use case for a router (with multiple ports) with no integrated switch? – sunknudsen Oct 15 '20 at 18:43
  • 1
    @sunknudsen: To route between multiple networks. – u1686_grawity Oct 15 '20 at 18:47
  • Can a router with 3 ports (without an integrated switch) assign IPs using DHCP and route traffic between two switches (that belong to the same network) connected to port 1 and 2 (port 0 being used for WAN)? – sunknudsen Oct 15 '20 at 19:01
  • 1
    @sunknudsen: A router only routes traffic between networks, not within a network. (With some rare exceptions.) What you describe _would_ be completely possible, though, by bridging these two ports at layer-2... but it won't necessarily be as fast as hardware switching. – u1686_grawity Oct 15 '20 at 19:05
0

I have seen Modems (normally ISP property) without Router and now commonly with Routers.

But any router I have seen / used in the last couple of decades includes a switch as part of being a Router. You put a router in to connect to a Modem (homeowner, small environment) to usually connect more than one device. Hence the need for an embedded switch.

Sometimes you need more LAN ports than the router offers so you may need to add an additional switch. A business may need to add a switch with a dozen or more ports.

To your question: If a router were available without a switch, the router component is "standard" and would be the same as if this router had a switch.

If you have no need for the combined switch, order it without.

John
  • 46,167
  • 4
  • 33
  • 54
  • Thanks for your help... I don't really understand the use case of a router with multiple ports that doesn't have a built-in switch. – sunknudsen Oct 15 '20 at 18:45
  • 1
    A router with multiple ports and no switch would like be router with multiple WAN ports. – John Oct 15 '20 at 18:47