Network switches

Coding Quill - Sep 20 - - Dev Community

What’s a network switch ?

A switch is a device used in computer networks to connect multiple devices together within a single local area network (LAN). Its main role is to facilitate communication between different connected devices, such as computers, printers, servers, IP phones, etc.

It is a mini-computer which is made up of RAM, ROM, flash RAM, NVRAM, a microprocessor, connectivity ports and even an operating system.

Image 1

  • RAM

RAM (Random Access Memory) contains the current configuration of the switch and temporarily stores the MAC address table, which is then processed by the microprocessor.

  • Microprocessor
    The microprocessor is the heart of the switch, responsible for data processing, including switching and creating links between multiple devices.

  • External memories
    External memories, such as flash RAM, ROM, and NVRAM (Non-Volatile RAM), store configuration files , different versions of the IOS , etc …

  • Ports
    The switch ports are the communication interfaces of the switch. There are several of them, generally 24 for a Cisco switch. Each port is associated with an LED which indicates its status and activity.

Image 2

How does it work ?

Now how does a switch work to transfer information from one machine to another?

Suppose we have 4 machines: A, B, C and D connected to our switch in ports 1, 2, 3 and 4 as follows:

Image 3
The switch only works with MAC addresses , so basically we have an empty MAC address table stored in RAM as soon as the switch starts up which looks like this :

Image 4
Transmitting data from machine A to machine B happens in the following steps:

  1. Machine A sends a frame to machine B
  2. Once this frame arrives at port 1 (which is the one linked to A), the switch reads the source MAC address and stores it in the MAC address table
  3. The switch reads the destination MAC address and looks for it in the table, if it is not in the table, it broadcasts to all the active machines connected to the switch except the source one.
  4. If the port linked to the machine we want is active, it sends a response frame from which the switch reads the MAC address we were looking for (@B)
  5. Once done, it records the MAC address of B in the table.

Image 5
This process repeats until the switch reaches what is called “MAC address table stability”, that is to say it knows all the MAC addresses of the connected machines and has no more need to broadcast.

Image 6

. .
Terabox Video Player