To properly learn something, we have to start at the beginning. We will be learning one concept at a time, process it, and move to the next.

The goal is consistent learning and absorbing information while feeling engaged and not overwhelmed.

I have divided the data link layer articles in five parts.

  1. Introduction to Data link layer
  2. Error Detection and Correction in Data link layer
  3. Flow and Error Control in Data link layer
  4. Protocols used in Data link layer
  5. Switches in Data link layer

Goal of this article

I will be explaining the role of switches in the data link layer of the TCP/IP Five-layer network model.

The role of the switch is to receive incoming link-layer frames and forward them onto outgoing links. The switches forward packets based on MAC addresses.

A host/router addresses a frame to another host/router (rather than addressing the frame to the switch) and happily sends the frame into the LAN, unaware that a switch will be receiving the frame and forwarding it.

The rate at which frames arrive at any one of the switch’s output interfaces may temporarily exceed the link capacity of that interface. To accommodate this problem, switch output interfaces have buffers, in much the same way that router output interfaces have buffers for datagrams.

Switches are plug-and-play devices because they require no intervention from a network administrator or user. A network administrator wanting to install a switch needs to do nothing more than connect the LAN segments to the switch interfaces. The administrator need not configure the switch tables at the time of installation or when a host is removed from one of the LAN segments. Switches are also full-duplex, meaning any switch interface can send and receive at the same time.

Let’s now take a closer look at how switches operate.

Forwarding and Filtering

  • Filtering is the switch function that determines whether a frame should be forwarded to some interface or should just be dropped.

  • Forwarding is the switch function that determines the interfaces to which a frame should be directed and then moves the frame to those interfaces.

  • Switch Table

    • Switch filtering and forwarding are done with a switch table.

    • The switch table contains entries for some, but not necessarily all, of the hosts and routers on a LAN.

    • An entry in the switch table contains

      • A MAC address
      • The switch interface that leads toward that MAC address
      • The time at which the entry was placed in the table.

To understand switch filtering and forwarding working, suppose a frame with destination address DD-DD-DD-DD-DD-DD arrives at the switch on interface x. The switch indexes its table with the MAC address DD-DD-DD-DD-DD-DD.

There are three possible cases:

  • There is no entry in the table for DD-DD-DD-DD-DD-DD.

    • The switch forwards copies of the frame to the output buffers preceding all interfaces except for interface x.

    • If there is no entry for the destination address, the switch broadcasts the frame.

  • There is an entry in the table, associating DD-DD-DD-DD-DD-DD with interface x.

    • The frame is coming from a LAN segment that contains adapter DD-DD-DD-DD-DD-DD.

    • There is no need to forward the frame to any of the other interfaces, the switch performs the filtering function by discarding the frame.

  • There is an entry in the table, associating DD-DD-DD-DD-DD-DD with interface y≠x.

    • The frame needs to be forwarded to the LAN segment attached to interface y.

    • The switch performs its forwarding function by putting the frame in an output buffer that precedes interface y.

Self Learning

A switch is “smarter” than a hub. A switch has the wonderful property (particularly for the already-overworked network administrator) that its table is built automatically, dynamically, and autonomously—without any intervention from a network administrator or from a configuration protocol that means switches are self-learning. This capability is accomplished as follows:

  • The switch table is initially empty.

  • For each incoming frame received on an interface.

    • The switch stores in its table
      • The MAC address in the frame’s source address field.
      • The interface from which the frame arrived.
      • The current time.
    • In this manner, the switch records in its table the LAN segment on which the sender resides. If every host in the LAN eventually sends a frame, then every host will eventually get recorded in the table.
  • The switch deletes an address in the table if no frames are received with that address as the source address after some time (the aging time). In this manner, if a PC is replaced by another PC (with a different adapter), the MAC address of the original PC will eventually be purged from the switch table.

We can identify several advantages of using switches, rather than broadcast links.

  • Elimination of collisions
    • In a LAN built from switches (and without hubs), there is no wasted bandwidth due to collisions.
    • The switches buffer frames and never transmit more than one frame on

a segment at any one time. - The maximum aggregate throughput of a switch is the sum of all the switch interface rates. Thus, switches provide a significant performance improvement over LANs with broadcast links.

  • Heterogeneous links

    • A switch isolates one link from another so the different links in the LAN can operate at different speeds and can run over different media.
  • Management

    • Switches enhance security and helps to avoid switch poisoning.
    • Switches also eases network management.
    • Switches also gather statistics on bandwidth usage, collision rates, and traffic types, and make this information available to the network manager.

Pros and Cons of Switches

  • Pros of Switches

    • Switches are plug-and-play, a property that is cherished by all the overworked network administrators of the world.
    • Switches can also have relatively high filtering and forwarding rates.
    • Switches have to process frames only up through the data link layer.
  • Cons of Switches

    • To prevent the cycling of broadcast frames, the active topology of a switched network is restricted to a spanning tree.
    • A large switched network would require large ARP tables in the hosts and routers and would generate substantial ARP traffic and processing.
    • Switches are susceptible to broadcast storms.
      • If one host goes haywire and transmits an endless stream of Ethernet broadcast frames, the switches will forward all of these frames, causing the entire network to collapse.

Switching Techniques

There are three switching techniques.

Circuit Switching

  • Network resources (bandwidth) are divided into pieces and bit delay is constant during a connection.

  • The dedicated path/circuit established between sender and receiver provides a guaranteed data rate. Data can be transmitted without any delays once the circuit is established.

  • Advantages of Circuit Switching

    • A committed transmission channel is established between the computers which give a guaranteed data rate.
    • There is no delay in data flow because of the dedicated transmission path.
  • Disadvantages of Circuit Switching

    • It takes a long time to establish a connection.
    • More bandwidth is required in setting up dedicated channels.
    • It cannot be used to transmit any other data even if the channel is free as the connection is dedicated in circuit switching.

Message Switching

  • End users communicate by sending and receiving messages that included the entire data to be shared. Messages are the smallest individual unit.

  • The sender and receiver are not directly connected. There are several intermediate nodes transfer data and ensure that the message reaches its destination. Message switched data networks are hence called hop-by-hop systems.

  • Advantages of Message Switching

    • As message switching can store the message for which communication channel is not available, it helps in reducing the traffic congestion in the network.
    • The data channels are shared by the network devices.
    • It makes traffic management efficient by assigning priorities to the messages.
  • Disadvantages of Message Switching

    • Message switching cannot be used for real-time applications as storing of messages causes delay.
    • Message has to be stored for which every intermediate device in the network requires a large storing capacity.

Packet Switching

  • It is a method of transferring the data to a network in form of packets.

  • To transfer the file fast and efficient manner over the network and minimize the transmission latency, the data is broken into small pieces of variable length, called Packet.

  • At the destination, all small-parts (packets) have to be reassembled, belonging to the same file.

  • A packet composes of payload and various control information. No pre-setup or reservation of resources is needed.

  • It uses the store and forward technique while switching the packets.

  • Advantage of Packet Switching

    • More efficient in terms of bandwidth.
    • Minimal transmission latency.
    • More reliable as a destination can detect the missing packet.
    • More fault tolerant because packets may follow a different path in case any link is down,
    • Cost is effective and comparatively cheaper to implement.
  • Disadvantage of Packet Switching over Circuit Switching

    • It doesn’t give packets in order and we need to provide sequence numbers to each packet.
    • Complexity is more at each node because of the facility to follow multiple paths.
    • Transmission delay is more because of rerouting.
    • Packet Switching is beneficial only for small messages

Did you find this post useful?

I would be grateful if you let me know by sharing it on Twitter!

Follow me @ParthS0007 for more tech and blogging content :)