Layer 2 switching You Should Know

ANS

ANS

ISACA CISM

ISACA CISM

Huawei

Huawei

Palo Alto

Palo Alto

Aruba

Aruba

Juniper

Juniper

Comptia

Comptia

Fortinet

Fortinet

Microsoft

Microsoft

F5

F5

GCIH

GCIH

Oracle

Oracle

Itil-v4

Itil-v4

CWNA

CWNA

Opengroup

Opengroup

ic_r
ic_l
Layer 2 switching You Should Know
images

Layer 2 switching (or data link layer switching) is the process of dividing the network using the MAC address of the device on the LAN. Switches and bridges are used for layer 2 switching. They decompose a larger collision domain into several smaller collision domains.

In a typical LAN, all hosts are connected to a central device. In that past, the device is typically a hub. But the hub has a number of disadvantages, such as not knowing the traffic through them, creating a large collision domain, and the like. To overcome some of the problems of the hub, a bridge is created. They are better than hubs because they create multiple conflict domains, but the number of ports is limited. Eventually, the switch was created and is still widely used. The switch has more ports than the bridge to check incoming traffic and make corresponding forwarding decisions. Each port on the switch is a separate collision domain.

This is an example of a typical LAN network used today-switches are used as central devices to connect all devices together:

Differences between hubs and switches

To better understand the concept of packet switching based on device hardware addresses, you need to know the difference between the switch and the hub.

First, consider the example of a LAN, with all hosts connecting to a hub:

As mentioned earlier, the hub creates only one collision domain, so there is a high chance of conflict. The hub described above simply receives all port signals repeatedly, so packet filtering is not performed except the ports from which the signals are received. Imagine if 20 hosts were connected to the hub, then a packet would be sent to 19 hosts, not just one! This can also cause security problems because attackers can capture all traffic on the network.

Now consider how the switch works. We have the same topology as above, except that we use switches instead of hubs.

The switch increases the number of collision domains. Each port is a collision domain, which means there is little chance of a collision. The switch knows which device is connected to which port and forwards the frame based on the target MAC address contained in the frame. This reduces traffic on the LAN and enhances security.

How switches work

Each network card has a unique identifier called Media Access Control (MAC) address. This address is used in LAN for communication between devices on the same network segment. Devices that want to communicate the need to know each others’ MAC addresses before sending packets. They use a process called ARP (Address Resolution Protocol) to find the MAC address of another device. When the hardware address of the target host is known, the sending host has all the information needed to communicate with the remote host.

To better understand the concept of ARP, we look at the following examples:

Suppose host A wants to communicate with host B for the first time. Host A knows the IP address of host B, but because this is the first communication between the two hosts, the hardware (MAC) address is not known. Host A uses the ARP process to find the MAC address of host B. The switch forwards the ARP request to all ports except the port to which host A is connected. Host B receives the ARP request and responds with its MAC address. Host B also learns the MAC address of host A (because host A sends its MAC address in the ARP request). The switch will know which MAC addresses are associated with which port. For example, because host B responds with an ARP response that contains its MAC address, the switch knows the MAC address of host B and stores the address in its MAC address table. As with host A, the switch knows the MAC address of host A because of the ARP request.

Now, when host A sends a packet to host B, the switch looks up in its MAC address table and forwards the frame only to the Fa0/1 port (port connected to host B). Other hosts in the network will not participate in the communication:

You can use the show mac-address-table command to display the MAC address table for the switch:

Notice that SPOTO will update the latest CCNA certification exam knowledge, and you can follow SPOTO. We will provide various Cisco certification exam answers and questions.

More Recommended Articles

1. Backing up IOS Configuration

2. What is IP Routing?

3. Is It Worth to Quit A Job for the Preparation of CCIE Lab?

4. What Are the Best Online CCNA, CCNP Courses?

5. How Would you Prepare for the CCIE Wireless Lab Exam in A Short Amount of Time?