A router connects different networks – typically your home network with the internet. It assigns IP addresses via DHCP, performs NAT (Network Address Translation) and routes data packets between networks.
A switch connects devices within the same network. It forwards data packets based on MAC addresses and creates a dedicated connection between sender and receiver – much faster than older hubs.
In a typical network setup, the router connects to the internet and acts as the gateway. The switch is connected to the router and provides multiple ports for devices like computers, printers and servers within the local network. Many home routers include a built-in switch with 4 LAN ports.
| Feature | Router | Switch |
|---|---|---|
| OSI Layer | Layer 3 | Layer 2 |
| Addresses | IP | MAC |
| Connects | Networks | Devices |
| Internet access | Yes | No |
| DHCP server | Yes | No |
| NAT | Yes | No |
| Typical ports | 1-4 LAN + 1 WAN | 8, 16, 24, 48 |
Routers and switches are both essential networking devices but serve different purposes. A router operates at Layer 3 (Network layer) and connects different networks – it is what gives you internet access. A switch operates at Layer 2 (Data Link layer) and connects devices within the same network using MAC addresses. In modern home networks, most routers include a built-in switch, so you rarely need a separate switch unless you need more LAN ports.