Router or Switch?
I answer a lot of questions on Yahoo Answers, and I often see confusion regarding the differences between a network router and a network switch. Anyone who’s set up a home network knows that you need a router attached to the modem, and then a switch attached to the router. Manufacturers often put the two devices in the same box, so most people don’t really need to know the difference. Yet, there are situations when the difference becomes important.
For the record, there is a world of a difference between the two network components, and in the short span of this blog posting, I’ll attempt to highlight these differences. This knowledge may not seem important to the average user, but it does come into play when you try to do certain things on your network, such as adding an Internet phone or playing online games with an Xbox.
In short, the difference between a router and a switch can be summarized as follows:
• A switch handles traffic between computers on the same network
• A router handles traffic between networks
Your home network can be considered a Local Area Network, or LAN for short. When computers on the same network want to talk to each other, they use a local hardware address, often called a MAC address. (MAC = Media Access Controller) MAC addresses are notated with pairs of “hex” digits separated by colons. For example, the MAC address on my PC is 00:11:11:29:15:10. (You may also see the digits separated by hyphens like this: 00-11-11-29-15-10.) When my PC wants to communicate with my router – which has a port on the LAN – it sends a message to the router’s MAC address, which is 00:1f:90:2f:78:eb. It thus puts together a “datagram” of information which consists of its own MAC address as well as the router’s MAC address. The rest of the datagram can be filled with data. The reason the PC puts its own MAC address into the datagram is so that the router knows where to send the reply datagram.
Everything is fine, as long as all PCs on my LAN know the MAC addresses of other PCs that they want to communicate with. The process by which they learn each other’s MAC address is beyond the scope of this blog posting, but suffice it to say that there are certain protocols used that allows PCs to discover each other.
Assuming I want to send a datagram from my PC to the router, how can I prevent the datagram from landing on another PC? Well, there are two things that prevent this from happening:
1. The other PC will ignore incoming datagrams that do not belong to it
2. The switch will try to prevent the datagram from being sent to the PC in the first place
How does the switch do this? Every PC is wired directly to the port of the switch, and the switch’s main job is just to listen to the datagrams coming out of the attached PCs and keeping track of what MAC address belongs to what PC. For example, when my PC sends a datagram to the router, the PC will identify itself with the address 00:11:11:29:15:10. The switch listens to this address and has a minor epiphany as it learns what MAC address is associated with the PC on that specific port. From that point forward, it will not allow any datagrams onto that port that do not have the PC’s MAC address. It therefore isolates the PC and protects it from receiving traffic that doesn’t belong to it.
The situation is different when my PC wants to talk to a PC that is not on my LAN. For example, my PC may want to send a message to CNN.com and ask for the latest news headlines. Since CNN.com is not on my LAN, my PC must send a datagram to the router and ask the router to forward the datagram to a different network. Even though the PC sends a datagram to the router using its MAC address, it will use another field embedded inside the datagram that tells the router where to send the datagram. This other field is called the “IP Address.” The router recognizes that the IP address belongs to somewhere out in cyberspace, so it forwards the datagram to your local Internet Service Provider (ISP). The ISP will, in turn, read the IP address and figure out what to do with it. In any case, the datagram is sent out of your LAN into the Wide Area Network (WAN). The router essentially bridged the gap between the two networks (LAN and WAN). Presumably, the datagram finds its way to CNN.com, and after a period of time, CNN.com will send a response datagram back to your PC using its IP address.
In short, the router is a special device. Its main purpose is to send traffic between networks, while the switch sends traffic between devices on the same network.
When you wire your modem to your router, you are bridging the gap between your ISP’s network and your home network. Your ISP network, which arrives on your modem, is sent into the WAN port of the router, and the LAN port is used for your local PCs.
Network manufacturers often put a switch on the LAN side of the connection, so you may see more than one physical port for your LAN side. In fact, you can extend this switch simply by wiring the LAN port to another switch, thus creating more LAN ports.
Can you put another router on the LAN side of your router? Yes, but that’s a subject for a different posting. Generally, you won’t want to do that unless you want to create two home networks. Most of the time, this is a bad idea, but there are some legitimate reasons, particularly for security concerns. But again, that topic is beyond the context of this posting.
Questions and comments are welcome!
Dan
Trackback(0)
Comments (1)

Write comment



I find your post very interesting but I couldn't find the detailed explanation to what I need for thorough understanding.
Here goes:
0. Talking about LAN (local area network), no routers.
1. You connect PC-s(Ethernet card or NIC-Network Interface Card) and switch with a Straight-through UTP cable.
2. NIC (e.g.PC1) sends some random packets and switch listens and records the PC1-s MAC address on port it is connected - correct?
3. IF correct - When PC1, PC2, PC3 are connected to switch, switch remembers their MAC addresses on individual port each PC is connected.
4.Does PC1 learn all those MAC addresses of other PC-s and writes them to ARP cache once switch learns those MAC addresses OR
- PC1 must first send some data (e.g file.txt) to PC2 - detailed:
PC1 encapsulates IP address and MAC address ((source PC1 and destination PC2 (IP and MAC:FF:FF:FF:FF:FF:FF) - broadcast address), then switch sends that package to all PC-s on switch and the one that recognizes it self (with destination IP address)receives the package and returns it's MAC address with
it's IP address while all other PC-s drop the package.
That way PC1 learns MAC address of PC2 and writes it in ARP cache.
When sending data to PC2, PC1 includes received MAC address as destination MAC address so it directly communicates to PC2 - correct?