Routers and Switches are physical devices used in computer networks. They are manufactured by companies like Cisco, HP, etc.

What is a Switch

A switch is a device that forwards packets between segments of a local area network (LAN). It operates in data link layer (layer 2) of the Open System Interconnection (OSI) model. A switch keeps a record of all devices connected to it and knows which device is at which port. When a packet is received, a switch is able to know to which port it has to be transmitted and transmits the packet to the port that is connected to the destination device.

For network switches, Ethernet implementations are more common and they can support 10/100Mbps or 10/100/1000 Mbps standards. Most switches can connect dozens of devices. Switches can be connected to each other using a daisy chain method and this leads to a large number of devices can be added to the LAN.

The entire bandwidth of the switch is always available to every device connected to it. The bandwidth offered does not get affected by the number of devices or computers transmitting data packets.

There are two types of switches:

  • Unmanaged Switches: They have a fixed configuration that cannot be changed. An unmanaged switch just allows Ethernet devices to communicate with one another. It is a ‘plug and play’ device.
  • Managed Switches: These switches have the ability to be configured with advanced options and prioritize LAN traffic so that important information gets through. With a managed switch, you can control how your data travels over the network and who has access to it. These switches contain a software that needs to be updated from time to time. Needless to say, with added features comes a higher price tag! These are the features that makes a managed switch more expensive than an unmanaged switch:
    • Quality of Service: This is the feature that allows managed switches to give higher priority to critical data, for example real time voice. It ensures consistent network performance.
    • Virtual LAN (VLAN): VLANs logically group devices and isolate traffic between these logical groups even though the traffic is flowing through the same physical switch. This gives better performance and an additional level of security in the system
    • Redundancy: Redundancy is the ability to safeguard a network in case of a connection failure by providing an alternate data path for traffic. For this, managed switches incorporate the Spanning Tree Protocol (STP) standard. STP provides redundant paths to keep integrated systems available. It also prevents loops that are created by multiple active paths between switches and makes sure that there is only one active path at a time between two network devices.
    • Port Mirroring: This feature is useful to diagnose problems. It copies the switch network traffic and forwards it to a single port on the same switch which is analyzed by a network analyzer. Analyzer can be used on monitor port to examine and troubleshoot network problems. Using port mirroring, you can troubleshoot problems without taking the network out of service.

What is a Router

A router is a physical device that joins multiple networks together and forwards data packets along networks. The place where two or more networks connect is called a gateway and that is where a router is located. A router operates in the network layer (layer 3) of the OSI reference model. The function of a router is to find the best path for forwarding the packets. Routers do this by making use of source and destination information in the headers of data packets and routing tables. They have the ability to filter traffic based on the IP addresses of the sending and receiving device. Routers communicate with each other to find the best route between any two hosts by using protocols such as Internet Control Message Protocol (ICMP). Routers allow sharing of a single IP address among multiple network clients.

Networks use broadcast communication at the lower layers of the OSI model. With an increase in number of hosts, the broadcast traffic also increases and results in collision of data packets. Routers overcome this situation by dividing the network into smaller networks. Broadcast messages are then restricted within these smaller networks with routers acting as the default gateways for these networks.

Some routers have USB ports and wireless access points built into them, while some routers incorporate a serial port that can be connected to an external dial-up modem which is useful as a backup broadband connection.

Home networks mostly use IP Routers where IP or internet protocol is the most common communication protocol used in the network layer of the OSI reference model. An IP router joins the home network’s LAN to internet’s WAN.

Routing moves data on a hop-by-hop basis.  Sometimes packets get tossed around a loop and never reach their destination. Routers can learn and advertise loop-free routes dynamically or it can be configured manually which is called static routing.

Today, routers which combine features and functionalities of switch/hub into a single unit are available. A wide variety of services are integrated into most broadband routers. A router may include a Network Address Translator (NAT), Dynamic Host Configuration Protocol (DHCP) server, Domain Name Service (DNS) proxy server and a hardware firewall to protect the LAN from malicious intrusion from the Internet and configure TCP/UDP ports for games, chat services, etc.

Differences between a router and a switch

 

Router

Switch

Function

Not only does it deliver data packets but does so by finding the best path to reach destination

Filters and forwards data packets to the destination device

Advantages

Single IP address for multiple clients

Determines best path for data to reach destination

Limits collision by limiting broadcast messages

Increased available bandwidth

Disadvantages

Costlier than a switch

Increase latencies due to greater degree of packet filtering

Broadcast traffic may cause problems

Difficult to trace network problems

OSI Layer

Network Layer (Layer 3)

Data Link Layer (Layer 2)