What is a network switch and how does it work?

what is a network switch, how does the network switch work, mapping network switch ports with MAC address

Network switch

WHAT IS A NETWORK SWITCH?

In this blog we will discuss what is a network switch and how does it works? Network switch interconnects different devices using copper and fiber links. It operates on physical and data link layers of the OSI model. It does not work on network or transport or application layers. The PDU for the data link layer is a frame and that means the switch operates with frames because it works on the physical layer. It works with bits. A switch may have many ports. For example, 8 ports, 12 ports, 24 ports, 48 ports, or even hundreds of different ports. The switch could combine different types of ports. Like ports for connections of copper cables or fiber cables. Also, there are so-called end-user-facing ports. Those ports are used for connections of end-user devices like desktops, computers, laptops, or some servers. Also, every switch has several uplink ports that are used for connections to other switches.

The cumulative bandwidth of all uplink ports is not equal to the cumulative bandwidth of all end-user-facing ports. The reason for that is not all ports are utilized and not loaded by traffic that's why there is no need to create equal size uplink ports. Uplink ports use fiber links and higher speed rates.


How does the network switch works?

Network switches don't care about IP addresses TCP sessions and they don't care which data is transmitted on the application layer of the OSI or TCP/API model. Their single responsibility is to transfer frames between different devices as fast as possible. That is a single goal of every network switch.

Network switch

Here on this diagram, you see several computers that are connected to the same switch. Every computer has its own unique Media Access Control (MAC) address. The MAC address is a set of hexadecimal characters and each MAC address has six sections split using either column or dash. In this example, those three computers are connected to the same switch but two different ports, and the ports are shown in the table. 

MAC address table

In this example, gigabit ports are used. Those ports are capable of transfer rates up to one gigabit per second and naming of those ports like Gi0/1, Gi0/2, and Gi0/3. Here zero is the number of the slot in the switch. Switches for home office use or small office use have a single slot and its id is zero like in this example and every slot has some set of ports and the numbers of ports start with one. In this example first port in this slot zero is one. If the switch has many slots then the names of those ports like 1/5 or 2/6 etc. In the MAC address table, MAC addresses are assigned to every specific port. What does it mean to assign a specific MAC address to a specific port?

Suppose you install a new switch to take them out of the box or move them from another data center and place them into your location and afterward several devices like laptops or desktop computers or servers are connected to different ports of this switch. The goal of the switch is to transfer frames between different devices. Suppose the MAC address table is kept in the memory of the switch is empty at the moment.

For example, computer A sends any frame with a destination MAC address equal to computer B MAC address. Computer A wants to communicate with computer B. In this case, the switch receives the frame and first, it adds the source MAC address to the MAC address table and to the port where this frame was received from. Then it looks for the destination MAC address in the same MAC address table. The moment MAC address is absent in the table correct in such case switches forwards such frame to all ports except that port where this frame was received from. That means that in this example this first frame will be sent both to computer B and computer C. Afterwards computer B and C will compare their MAC addresses with destination MAC address in this frame and if MAC addresses match in computer B. Then the computer will strip MAC address header and proceed to the upper layer of the TCP/ IP model to the network layer. 

Computer C will discard such a frame because the destination MAC address in such frame does not match with its own MAC address. So computer B has received the first frame and let's suppose that it wants to send some response to computer A. It also constructs some frames and adds a transport-layer header, network layer header. Only afterward it adds a data link header that contains the source and destination MAC addresses and sends the frame back to computer A. So destination MAC address is A source MAC address is B. Same as before the network switch takes a frame looks first at source MAC address B and it sees that B MAC address is absent in MAC address table. But this frame was received on port Gi0/2 and it's a good time to add the MAC address of computer B to the MAC address table. Now there are two records in the MAC address table.

Afterward, the switch looks at destination MAC address A and looks again in the MAC address table. It finds A MAC address in the MAC address table and it seems that the device with such MAC address is located behind port Gi0/1. Now switch forwards this frame only to Gi0/1. It does not send the frame to computer C or other computers located behind other ports because. Now it knows where the destination MAC address is located. So that's how the second frame was sent from computer B to A.

Let's say that computer C also wants to send some data either to computer A or B. It sends some frames to the B MAC address and again switches looks into the MAC address table. It seems that the source MAC address is absent behind the port Gi0/3 and it adds the C MAC address to the MAC address table. Also, it looks next at the destination MAC address in such a frame. It finds that such MAC address is located behind port Gi0/2 and forwards such frame directly from port to computer B. The MAC address table is complete for this example and the switch will forward frames only between pair of ports. So it receives some frame for example at port Gi0/2 looks at destination MAC address in the frame and forwards such frame to a specific port either to computer A or to computer B. That’s how the network switch operates.


Conclusion

Network switches work only with MAC addresses. And it does not change the frame header or network layer header or some other headers. It processes every frame and looks only at the header of the frame. Also, it verifies frame check sequence and if it is incorrect switch can discard frames.

COMMENTS

Name

Artificial Intelligence,16,AWS,2,Big Data,2,Blockchain Technology,3,Cloud computing,9,Computer networks,4,cybersecurity,3,Database,2,Digital Marketing,1,E-commerce,2,Internet of Things,12,Quantum Computing,1,RPA,3,Technology,5,Web Scraping,1,
ltr
item
PS TECHNO BLOG: What is a network switch and how does it work?
What is a network switch and how does it work?
what is a network switch, how does the network switch work, mapping network switch ports with MAC address
https://blogger.googleusercontent.com/img/a/AVvXsEi3Sia-CWkosdNg5gWuRX_PiS2KmTyuMCyZV-xF9IpPlSL9LYjbNt1t8kdAIYMEozRpH5PLhsXgrvgJe8kISv6EzbDYxpeV7FVllg0lFA-vy5Lgx_onqUDKYa1HDCDTDm4rm9S7FXXkvg59yuYZJpHnBDGjYiiUd4N0LNyKF_t3VL1tmKMwZyzich5g_w=s320
https://blogger.googleusercontent.com/img/a/AVvXsEi3Sia-CWkosdNg5gWuRX_PiS2KmTyuMCyZV-xF9IpPlSL9LYjbNt1t8kdAIYMEozRpH5PLhsXgrvgJe8kISv6EzbDYxpeV7FVllg0lFA-vy5Lgx_onqUDKYa1HDCDTDm4rm9S7FXXkvg59yuYZJpHnBDGjYiiUd4N0LNyKF_t3VL1tmKMwZyzich5g_w=s72-c
PS TECHNO BLOG
https://pstechnoblog.blogspot.com/2021/10/what-is-a-network-switch-and-how-does-it-work.html
https://pstechnoblog.blogspot.com/
https://pstechnoblog.blogspot.com/
https://pstechnoblog.blogspot.com/2021/10/what-is-a-network-switch-and-how-does-it-work.html
true
8274238297581439573
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy