Routers and Switches: What’s the Difference?

0

What is a router?

We are all connected one way or the other via various devices or computers to the Internet which helps us to stay in touch with friends and conduct our daily activities on the Internet such as ordering stuff from a store online, checking bank account balances, chatting with a friend and controlling room temperature whilst away from home. But none of these would have been possible without a piece of the Internet that you’ve probably never seen. In fact, most people have never stood “face to machine” with the technology most responsible for allowing the Internet to exist at all: the router.

When you send an email to a friend on the other side of the country, how does the message know to end up on your friend’s computer, rather than on one of the millions of other computers in the world? Much of the work to get a message from one computer to another is done by routers, because they are the crucial devices that let messages flow between networks, rather than within networks. The message is broken down into small pieces of information called packets before being sent to its destination that is about 1,500 bytes long.

Each device on the network is uniquely identified by an address called Internet Protocol address (IP address). This is analogous to a person’s home address that the Post-Office uses to route email to someone. The router has a record of how to route packets to its destination. This record is called the routing table. The routing table is populated with the help of routing protocols and consists of IP addresses assigned to the router’s interfaces, IP addresses learned by the router with the help of routing protocols running on the router, priorities associated with path to each destination, optimal path toward a destination when given the choice between multiple paths, etc.

IP addresses are usually in blocks of addresses called subnets. And, each IP address has a subnet mask that helps the router know which subnet the IP address belongs to. Subnet masks are similar to Post Codes that a Postman uses to locate a person’s home address.

Each device (computer, smartphone, switch, etc.) connected to the network including every router interface has a globally unique address called Media Access Control (MAC) address. This address is mapped to the IP address assigned to a device interface connected to the network using the Address Resolution Protocol (ARP).

When a packet arrives at a router’s interface, the router opens the packet and looks for its destination IP address. It checks within its routing table for the outgoing interface and then forwards the packet through that interface to its destination. There are times when the network administrator may want to enforce some level of security on the network and doesn’t want the router to forward every type of packet hence he may implement an Access Control Lists (ACLs). The router uses these to decided whether a packet should be forwarded, dropped without keeping a log of the packet or dropped and log information about the packet.

What are switches?

Switches evolve from network hubs. Hubs were used in the early days of computer networks to connect two or more devices on the network so that they can communicate with each other. Hubs are “dumb” devices in that they receive a frame from the wire on one interface and then forwards (broadcasts) it out of every interface on the hub.

Switches are a lot more intelligent these days and only forward frames out of all switchports except the port from which the frame is received only if the destination of the frame is not known. Each switch also has interfaces to which network devices connect. These interfaces have MAC addresses that uniquely identify these interfaces. Switches have a record their own interfaces, their MAC addresses, MAC address of devices connected to each interface, interfaces where device MAC addresses are learnt, etc. Switches use their MAC address tables in forwarding frames intelligently on a network. Traditionally, switches operate at OSI Model Layer 2. Nowadays they can operate at both Layer 2 and Layer 3. A switch that can operate at these two layers are called Multi-Layer Switches (MLS).

Some similarities between Routers and Switches are highlighted below.

Routers Switches
Has decision-making record called Routing Table Has decision-making table called MAC Address Table
Can run Routing Protocols Can run routing protocols if it is a Multi-Layered Switch

 

There are a couple of differences between Routers and Switches. These include

Routers Switches
Could have several types of interfaces Usually limited type of interfaces
Routers connect networks meaning that routers connect different types of network or enable networks running different protcols inter-network Switches create a network meaning that they are mostly used in setting up LANs or local networks

 

Operates at OSI Model Layer 3 Usually operate at OSI Layer 2 unless it is a Multi-Layered Switch that operates at both Layer 2 and 3
Information sent via Routers are called packets Information sent via Switches are called frames
Store IP address in Routing table Switches use MAC address table also known as content accessible memory (CAM) table

 

Reference: Adekunle Ajiboye 2018

Leave A Reply