Thursday, February 13, 2014

Differences between bridges & Switches / Method of Switching



Differences between bridges & Switches:

The basic functionality of the bridges & Switches is same, they forward the frames based on the MAC address, by which they solved the collision problems. The main difference between them is: switches have some enhanced capabilities as compared to bridges.

Bridges:

  1. The maximum number of ports is 16.
  2. Bridges operate in half duplex.
  3. They switch the frames by using software.
  4. The frame switching rate of bridges is 10,000 to 50,000 per second (frame processing speed).
  5. Each port of a bridge is a separate collision domain.
  6. Only one instance of STP (Spanning Tree Protocol (which removes the layer2 loops)) for all the VLANs.
  7. The method of switching is: Store & Forward.

Switches:

  1. Now a day’s switch can have hundreds of ports. A typical 2960 switch is having 48 ports.
  2. Switches can operate in full-duplex & half-duplex modes.
  3. Switches switch frames by using hardware such as specialized processors called ASICs (Application Specific Integrated Circuits).
  4. The frame switching rate of switches is in millions, a typical 2960 switch can process 2.7 million frames per second. And a high end switch such as a 6500 can process up to 400 million frames per second.
  5. Each port of a switch is a separate collision domain.
  6. One instance of STP for each VLAN. Per VLAN STP.
  7. The method of switching is: Store & Forward.

 Method of Switching:

            I’ll discuss about the only method switches are using now a days. Actually there are three methods of switching frames.
  1. Store and Forward
  2. Cut-Through
  3. Fragment free

Out of the above three switching methods, the most commonly used and reliable method is “Store and Forward”

Store and Forward:

            In this method when a switch receives a frame, it stores the frame in its buffer and performs the CRC (Cyclic Redundancy Check) to see whether the frame is corrupted or not.
            If the frame is corrupted then the switch won’t forward that frame to the destination device, the switch just discards the frame.
            If the frame is not corrupted then the switch will forward the frame to the destination device on basis of CAM table, if an entry for the destination mac is not found then it will flood the frame.


Representation of Hub, Bridge and Switch in network diagrams:

Hub:


Bridge:

           
Switch:


In the next post we will discuss briefly about Ethernet.

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.
            

Monday, February 10, 2014

What is a MAC address ? /How switch process Unicast, Multicast & Broadcast frames ?



Different type of frames a switch will receive:

            The three types of frames a switch can receive are Unicast frame, Broadcast frame & Multicast frame. The frame types are derived based on the destination MAC address in a frame.
            So in order to understand the different type of frames, we first need learn few things about the MAC addresses.

What is a MAC address ?
           
            We all know that every device, it may be a Workstation, Server, Switch, Router or any other network devices which are connected to other devices communicate with the help of a Network Interface Card which have an RJ-45 interface.
            The MAC (Media Access Control) address is a 48 bit (6 byte) unique address assigned by the manufacturer of the NIC card, this address will be unique globally (that means in the entire world there cannot be two NIC cards with the same MAC address even though they are manufactured by various manufacturers). The manufacturers of the NIC cards will follow the MAC numbering structure defined by the IEEE (Institute of Electrical & Electronics Engineers), which ensures that MAC address are unquie globally.
            The MAC address is burned into the ROM of the NIC card permanently, that is the reason people refere MAC address as BIA (Burned In Address), Physical/Hardware address.

Format of the MAC address:
           
            It is a 48 bit (6 byte) address with 12 hexadecimal digits. It can be represented in any of the below three formats:
            AB:CD:EF:A1:B2:C3
            AB-CD-EF-A1-B2-C3
            ABCD.EFA1.B2C3
Most of the network equipments use the last format. In the six groups of hexadecimal format (first two formats) each group is equal to one byte/octet, so total 6 bytes/octets. The first 6 digits/three octets are known as OUI (Organizationally Unique Identifier) because they identify the organization that manufactured the NIC card. The next three octets are used by the manufacturer to create unique mac addresses and  burn them into NIC cards.
            So the address space of the MAC address is : 248 addresses.
 Types of MAC address seen in the destination fields:

            The destination field can contain three types of MAC address.
  1. MAC address of a device
  2. MAC address to which a group of devices will listen
  3. MAC address to which all the devices will listen

MAC address of a device/host:
            A frame whose destination field have the MAC address of a single device/host is called as a Unicast frame.

MAC address of a group of device:
            A frame whose destination field have the multicast mac address is called as a Multicast frame.
            Multicast is nothing but a group of devices which will listen to a single MAC address. That is nothing but the devices in a multicast group will accept all the frames that are sent to that group’s mac address (a multicast address).
            For example, the mac address: 01-00-0C-CC-CC-CC is an address for the devices that run VLAN trunking protocol. So if a device wants to send a VTP message to all the VTP devices then it will just send it to that address then all the devices that are running VTP will accept the frame.

MAC address to which all the devices will listen:
            A frame whose destination field has this MAC address: FFFF.FFFF.FFFF is called as a broadcast frame. The broadcast frame will be received by all the devices connected to a switch.

Operational difference between the frames:

Unicast frames:
            Unicast means sending information to a single device. So if a device wants to send some information to 10 devices, then with unicast the source device has to send separate frame to each device, so it will create & send 10 frames with different destination MAC address.

Broadcast frames:
            Broadcast means sending information to all the devices. So if a device wants to send some information to 10 devices, then with broadcast the source device will send a single frame to the destination address: FFFF.FFFF.FFFF, then all the devices in the segment will receive that frame.

Multicast frames:
            Multicast means sending information to only a group of/selected devices. So if a device wants to send some information to 5 devices out of all the remaining devices, then with Multicast the source device will send a single frame to the group’s address (multicast address), then the devices only in that group will receive the frame.

How switch process the three types of frames?

Unicast frame: When a switch receives a unicast frame i.e. a frame that is destined to a single device. The switch will compare the destination MAC to its CAM table, if an entry is found it will forward it to the port to which the destination mac is associated/mapped to.
            If the destination MAC address is not found then the switch will flood the frame to all the active ports, then whichever the device’s mac matches the destination MAC it will reply back to the source machine, then the switch will associate the source MAC address from the reply frame to the port on which it received the reply frame.   

Broadcast frame: Whenever a switch sees FFFF.FFFF.FFFF address in the destination field of the frame, then it will send the frame to all of its active ports.

Multicast frame: Whenever a switch sees a multicast address (ex VTP multicast address: 01-00-0C-CC-CC-CC) in the destination field, it will flood the frame to all the active ports just as it does for the broadcast frame.
            But the difference here is the ports which are configured to accept these multicast messages will only process the frame and all other devices will ignore the frame.
               The multicast range of MAC addresses defined by IEEE are between 0100.5E00.0000 to 0100.5E7F.FFFF.

Why switch will flood the multicast messages to all the active ports?

            The reason is the multicast address will never been seen in a frames source mac filed and since switch learns the mac address only from the source mac field, they don’t have entries in their CAM table for multicast addresses, hence they’ll flood the frame just as broadcast.

            In the next post we will discuss about “How the switch was born?”