Wednesday, February 12, 2014

How Switch was born? / Bridge & Hub operations



How Switch was born?

            The ancestor of the Switch is Bridge. So if we understand how the bridge was born and its functions, then we can easily understand about switch. Let’s take a look at bridge:
            Bridge has been invented to solve the below two problems:
  1. To forward the frames intelligently, unlike a hub.
  2. To solve the collision problems in Ethernet.

Background:

            In early days of Ethernet, devices were interconnected using a shared media such as co-axial cables with BNC T-connectors, nothing but single wire is used to interconnect the devices, as shown below:


 So if one device sends a frame, then that frame will be received by all the devices connected to that cable.
            There were two problems with this is type of setup:
  1. Single point failure
  2. Signal weakness

Single point failure:
            If the cable breaks down somewhere in the middle of the network, then the entire network used to go down i.e. none of the devices was able to communicate.

Signal Weakness:
            As the number of devices were increasing then the length of the cable used to increase. So a signal had to travel longer distances due to which signals were losing strength and the frames were getting corrupted due to the noise in the line.

            To overcome the signal weakness problem, a repeater has been invented. The function of the repeater is to amplify the signal so that it can reach longer distances. Later on to minimize the single point failure, multiple port repeaters had been found which is called hub. All the devices were used to connect to the hub as shown below.


           
            Now the network goes down only if the hub fails. If a cable breaks up then only the device connecting to hub with that broken cable will be disconnected from the network.
            Since hub is a multiport repeater, a signal received on one port is been sent to all the remaining ports, which made its functioning just like the network built with shared co-axial cable. So a frame sent by one device is still being received by the other devices connected the hub.

CSMA/CD:

            In Ethernet only one device can send a frame at any given time, all the other devices should be listening to it. So in order to ensure that only one device is transmitting the frame, Ethernet uses CSMA (Carrier Sense Multiple Access)/CD (Collision Detection) method.

How CSMA/CD works?

            Any device before sending a frame it has to sense the carrier/wire to check if there is a frame already being transmitted by other device, if there is a frame on the carrier then the device will have to wait until the frame transmission completes. If there is no frame on the carrier/wire, then the device can send its frames.
            So in this mechanism there is a probability that two devices sense the carrier at the same time and see no frames, then they both will transmit their frames at a time, then there occurs a collision between the frames of both the devices.     
            So whenever there is a collision on the carrier, the Collision Detection mechanism sends out a special signal called ‘JAM’ signal, then both the devices stop transmitting frames and wait for a random period of time before transmitting again.

Collisions:

            If the number of devices is more, quite a few devices might need to send the data simultaneously. So there might be a situation where few devices sense the carrier at the same time and send traffic, then collisions used to occur.
            And again due to CSMA/CD those devices will wait a random time and then retransmit their data. Again there is a probability that all the devices wait the same equal random time and retransmit the data, which will again lead to a collision.

Collision Domain:

            The devices sharing a common physical media are said to be in one collision domain. For example, the devices connected using a co-axial cable, devices connected using hub are said to be in one collision domain.
            So collision will be observed by and will impact all the devices in the same collision domain.


So bridge has been invented to solve the below two problems:

  1. To forward the frames intelligently, unlike a hub.
  2. To solve the collision problems in Ethernet.

Bridge:
            Bridge doesn’t repeat the frame received on one port to the other ports. Bridges were built with a special type of memory called CAM memory to store the MAC addresses of the devices connected to it on its ports.
            Whenever it receives a frame on a port, it first learns the source MAC of the frame and then it associates that MAC address to the port on which it received it. Likewise by learning the MAC address from all the incoming frames it builds the CAM (Content Addressable Memory) table.
            And while forwarding to the destination device it looks for the destination mac entry in the CAM table, if an entry is found then it forward the frame to only that device. If an entry is not found then it floods the frames to all the active ports except the inbound port.
            Each port of a bridge is a separate collision domain, due to which they breakup the collision domains.
            Slowly enhancement of bridges took place as the need of the network & technology grew. And the operation of the bridges has changed a lot, speed & duplex settings too doubled, the way of switching the frames has also migrated from software to hardware, the frame processing speed has also increased a lot and the bridges were started to be referred as switches. This is how the term switch was born.

In the next post we will discuss about the differences between bridges and switches.
            

No comments:

Post a Comment