Network switches can connect to a modem using Ethernet just like a router does, and they have many more ports for connecting individual devices, so do you really need a router, or can a switch be used instead?
A networking switch can be used in place of a router but is not recommended. Internet service providers generally only provide a public IP address, making only one device able to access the Internet when using a switch instead of a router, as well as presenting significant security concerns. Let's take a look at the roles that a router, network switch, and modem play in a home network setup to better understand why you should use a network switch in addition to a router instead of having to replace it.
What is the difference between a network switch and a router?
At first glance, a network switch and a router may look similar and can be used interchangeably, but they actually perform very different functions within a network as a whole. A router has multiple LAN (Local Area Network) ports and a single WAN (Wide Area Network) port, while a switch only has LAN ports to allow devices to connect to it via Ethernet. The WAN port on the router is used only to connect to the modem. The switches do not have a WAN port, but that does not mean that one of the available LAN ports cannot be used to connect to the modem. This setup is certainly possible, but you would need a crossover cable for everything to work.
So if you can connect a network switch to a modem, do you really need a router?
Yes, and the main reason is that you normally only receive the public IP address from your ISP (Internet Service Provider). Even when you have multiple devices connected to the switch and the switch is connected to the modem, only one of the devices will be able to access the Internet at a time. In order for all devices to be able to access the Internet at the same time, a router will be needed, as it is assigned the only public IP address, but then you can assign private IP addresses to each individual device on the network.
What does a router do?
In a home network setup, a router is needed to connect all your devices to the LAN using a wired or wireless connection. The main job of the router is to route traffic from all of your devices to the modem, which in turn allows them to access the Internet. You can consider the router to be the center of all the devices on your network; they all connect to the router, which then connects to the modem. The other main purpose of having a router comes from a security standpoint; protects all devices on your network from being exposed to the Internet. Looking at everything from an Internet point of view, you don't see all of your individual devices; just your router.
You can't see which specific device is accessing the internet thanks to the router being in place and controlling all the traffic that flows between the internet and your devices.
What does a network switch do?
Network switches are commonly found in larger networks, like a corporate office, but they are also used in much smaller networks like you and I have at home. They provide a way to connect multiple devices together within a single LAN without having to rely on Wi-Fi, which I'm sure you already know isn't always the most reliable. Although we would probably have one, or perhaps two, network switches, larger networks might have dozens to connect different sets of devices. Each floor of an office could have its own dedicated switch to connect all the devices on that particular floor, but then each switch is also connected to each other. The end result is that a device on one floor could communicate with another device on a different one. All the switches would end up connecting back to the router to finally allow all connected devices to access the internet through the modem.
What Does a Modem Do?
The modem can be considered as the device that bridges the gap between your home network and the Internet. Even with a router in place, all of the devices that connect to it, be it directly, via a network switch, or wirelessly, won't be able to access the Internet without having a modem to connect to. The modem’s job is to connect your network to your ISP, which then connects to the Internet. It takes the signals from your ISP and translates them into a different signal that all of your devices can understand and use, and vice-versa.
Where the modem is positioned will be determined by the type of Internet connection that you have. These are:
Cable: Cable-based modems make use of coaxial cable, with one end connecting to the back of the modem and the other connecting into the wall or back of the cable box.
DSL: DSL (Digital Subscriber Line) is the most commonly found type of Internet connection (at least here in the UK) and works by using the same wires that the regular telephone line uses.
Dial-Up: Dial-up is the oldest form of Internet connection and used very little these days given that it is considerably slower than cable and DSL. Another disadvantage is not being able to access the Internet when the phone is being used.
Sometimes the router and modem are completely separate pieces of hardware, but it is now much more common for them both to be contained within a single unit. This “hybrid” of the two can often be referred to as a gateway and is offered by many ISPs as a way of simplifying the setup process for their customers.
Is It Better to Use a Switch or a Router?
You can’t really compare a network switch with a router to determine which is best as they perform different functions on a home network. As you now know, everyone should have a router connected to the modem and you don't want to have a switch in its place. A better question to ask is whether you need a switch in addition to a router, rather than having one or the other.
Having a network switch is recommended if you have multiple devices that you wish to connect to your network using Ethernet rather than relying on Wi-Fi. Although it is very rare these days, some devices don't come with Wi-Fi built-in and so you have no choice but to use Ethernet. If you have several devices that work this way, you'll likely find that the few Ethernet ports found on the back of your router simply isn't enough. Not to mention smart home hubs that also rely on an Ethernet connection. I tried plugging these into my network switch instead to save using the ports on my router but found they didn’t work; they absolutely had to have a direct connection to the router.
Chuck a couple of these into the mix and you could find yourself running out of available ports pretty fast before you even come to connect your individual devices, like a gaming PC. If you have lots of devices at home, or just want to make use of the better performance that Ethernet typically provides over Wi-Fi, it is worth considering adding a network switch to your home network.
But again, in addition to your router and not to replace it. Here are some of my recommended network switches if you are looking to add one to your own home network.
In summary, although it is technically possible to connect a network switch to a modem instead of a router, it is not recommended.
The main reason is that your ISP only shows a small number of IP addresses. Most of the time this is just a single IP address, however, you can have two or three if you are lucky.
This is known as your public IP address.
Once all available public IP addresses have been exhausted, the other devices you connect will not receive one, will not be able to communicate on the network, and will not be able to access the Internet. Assuming you only have the public IP address that was provided to you, only one device will be able to access the internet even when you have multiple connections to the switch. Having a router connected to the modem means that it is assigned the public IP address and then allows it to have multiple devices connected at the same time by assigning each their own private IP address.
They also offer much better network security thanks to the built-in firewall and can also mask the IP address of each of your devices from anything that is not securely connected to your network. Of course, use a network switch, as they can be incredibly useful, but make sure they are used in addition to your router rather than replace it.