Psychz - Sharad
Votes: 0Posted On: Apr 07, 2017 09:41:19
A network can be as compact as connection between a computer and a printer and as humongous as the internet connecting, practically, the entire globe. A wide range of devices are used for various types of networks at different levels. Sometimes, devices are needed to connect systems within a single network, while sometimes, to connect multiple networks itself.
The connecting devices must be chosen wisely depending on the type of network.
Hubs, Routers and Switches are some of the devices used for connectivity purposes in a network. Hubs are the most primitive networking device that can be used to connect multiple devices within a single network.
Switches and routers are more advanced types of connecting devices in a way that they transmit the data more efficiently and intelligently.
Router and Switch
Broadly speaking, the comparison between a router and switch is done on the basis of their ability to work intelligently. A router is usually referred to as an intelligent device as it functions as a gateway between multiple networks. A switch on the other hand is used to circulate data within an internal network.
To understand the roles they play, let us discuss it further
OSI Model
The Open System Interconnection model is the most basic framework on which the functioning of networks is depicted. It consists of seven layers of protocols starting from physical, data link, network, transport, sessions, presentation and application layer.
The switches usually function at the physical and data link layers as they connect devices within the network.
Routers on the other hand communicate with other networks; hence it needs more complex form of addressing. The router functions at the network layer of the OSI model.
Addressing
Ever wondered how does the switch or a router know where to send the packets? The networking protocols provide us with a class of addressing at different layers of the OSI model.
At the physical and data link layer (the layer at which the switch works), each physical network device is provided with a physical address or MAC (Media Access Control) address which helps the switch in identifying the source and destination.
The routers, on the other hand, function at the network layer which uses the IP (Internet Protocol). It is a global addressing scheme and helps the routers to route data to remote destinations.
Transmission
When the data is send from one network segment (or device) to another it is not transmitted all at once. Sometimes, there is a transfer of huge chunks of data which cannot be transmitted as a whole through the transmission medium. The data is divided into small segments and then transmitted. Each data segment consists of a piece of data among other information.
In case of switches, the data is transmitted in the form of frames. This frame, other than the data, consists of the source and destination MAC addresses by which the switch is able to send the data to its destination.
Whereas, in case of routers the data is encapsulated in a data packet. These data packets contain the source and destination IP address by which the router identifies the destination of the packet.
Functioning
A switch connects different network segments to make them function as a network. Imagine a network of four devices A, B, C and D connected by a switch. Let us say device A wants to send some data to device C. The data will be fragmented into frames and will be send to the switch which will broadcast a frame to all the four devices. The device C will accept the frame and will send an acknowledgement message back to the switch. The switch then registers the MAC address of the device and sends the remaining frames to it.
Whereas, in case of a router the data meant for devices located on other networks are sent to the router in the form of packets. These packets contain the source and destination IP and MAC addresses. The router contains a routing table with the help of which the router is able to route the packet to the destination.