Switch
Reference: [Book] Network Introduction for IT Engineers
Before Getting Started
What is a Switch?
The Switch, the most critical device in a network, operates based on the Layer 2 address,
MAC addressThe Switch sits in the middle of the network and serves as a mediator that receives
packetsand sends them only where neededThe Switch can perform its basic operation of forwarding packets based on
MAC addresseswithout any configuration when connected to the network
Beyond the basic operation of recognizing
MAC addressesand forwarding packets, the Switch also hasVLAN functionalitythat can logically separate networks on a single device,Functions like
STP (Spanning Tree Protocol)that prevent Network Loops built in by default
Switch Device Operation
The Switch is a device that mediates communication in a network
In old
Ethernet Networkswithout switches, devices would compete when sending packets, causing significant network performance degradationThe device that helps multiple devices communicate simultaneously without interference is the
SwitchUsing a Switch eliminates the need to wait to communicate or wait due to collisions, and the overall network communication efficiency improves
The Switch's core role is to identify who is at which location and, when actual communication begins, accurately transmit packets to the location it knows
This is possible because the Switch understands Layer 2 addresses
And has a MAC Address Table that maps the terminal's
MAC addressto theInterface informationwhere the terminal is located
The Switch checks the Layer 2 destination address in the header of the packet it wants to forward, finds which port that address is on in the MAC Address Table, and sends the packet only to that port
To perform this role, the Switch needs a MAC Address Table with
MAC addressesandportsmappedIf a packet enters the switch with a destination address not in the Table,
The Switch sends the packet to all ports
If the packet's destination address is in the Table,
It sends the packet only to the mapped port and does not send it to other ports
The Switch's operation can be summarized in these 3 actions:
Flooding
Address Learning
Forwarding/Filtering
1. Flooding
When a Switch boots, it has no network-related information
At this time, the switch cannot fulfill its role of mediating network communication and operates like a hub
A
Hubforwards packets to all ports except the incoming portThe Switch's operation of flooding packets to all ports like a hub is called
Flooding
When a packet enters the Switch, it checks the destination MAC address and looks for that MAC address in its MAC Address Table
If there is no matching destination MAC address information in the MAC Address Table, it sends the same packet to all ports
Since the Switch operates in a
LAN, it performs this action under the assumption that a device may exist somewhere even without its own information
Flooding is a normal Switch operation, but if it happens too often, the Switch cannot perform its proper role
When a packet enters the switch, it reads the MAC address from the packet information and learns it to build the MAC Address Table, then uses it to forward packets
Abnormal Flooding
A Switch flooding packets means the switch is not functioning properly
In
Ethernet - TCP/IPnetworks, ARP Broadcast is exchanged beforehand, so when actually sending and receiving data, the switch does not flood packets
Using a Switch allows forwarding packets only where needed, making it difficult to maliciously intercept surrounding communications, which is more secure than a
hubthat floods all packetsAttack techniques exist to neutralize this Switch function and monitor surrounding communications
ex)
Making the Switch learn wrong MAC addresses, or
Filling the Switch's MAC Address Table to capacity to force flooding behavior
If the switch is flooding packets for no reason,
The Switch may not be operating normally, or
An attack may be being carried out nearby
Additionally,
ARP poisoningtechniques may be used to make the attacker's MAC address appear as the MAC address of the IP to be monitored, receiving the desired communications, so caution is needed
2. Address Learning
For the Switch to properly perform its operation of checking the destination MAC address and forwarding to the desired port, it must build and maintain a MAC Address Table
The
MAC Address Tableis a temporary table that stores information about which device (MAC address) is connected to which location (port)The process of building and maintaining this MAC Address Table is called
Address Learning
Address Learninguses the packet's source MAC address informationWhen a packet enters a specific port, the switch records the source MAC address and port number in the MAC Address Table
If a packet entering port 1 has source MAC address AAAA, it can be inferred that a device with MAC address AAAA is connected to port 1, and this is how information is acquired
Address Learninguses MAC address information, so it cannot learn broadcast or multicast MAC addressesBoth are only used in the destination MAC address field!
Pre-defined MAC Address Table
In addition to learning surrounding devices' MAC addresses through
MAC address learning, the Switch also has pre-defined MAC address informationThese pre-defined addresses are not for processing packets but are mostly addresses used for inter-switch communication
These types of addresses can also be found in the
MAC Address Table, but since addresses processed internally by the switch are not sent to specific ports but processed within the switch,Adjacent port information may be absent, or
Expressed with terms indicating CPU or management module
3. Forwarding/Filtering
Switch operation is very simple: when a packet enters the switch,
It checks the destination MAC address
Compares it with its MAC Address Table, and if matching information exists, forwards the packet to the matching port
At this time, the packet is not sent to other ports, and this operation is called
filtering
The Switch ensures packets are delivered only to the destination through
forwardingandfilteringIn a Switch,
forwardingandfilteringcan be performed simultaneously on multiple portsSince communication does not affect other ports, other ports can operate independently from existing communication
The Switch performs
forwardingandfilteringonly for regular UnicastBUM Traffic -- Broadcast, Unknown Unicast, Multicast -- operates slightly differently
Since neither broadcast nor multicast are used as source MAC addresses, these types of traffic are all flooded without forwarding or filtering
Unknown Unicast also has an address not in the MAC Table, so it is flooded just like broadcast
ARP in LAN - Switch Operation
In
Ethernet - TCP/IPnetworks, switches rarely flood unicastBefore creating a packet,
ARP Broadcastmust be performed first to discover the MAC address of the terminal to communicate with, so ARP Broadcast reaches the network before UnicastDuring this ARP-based MAC address acquisition process, the switch can already learn the MAC addresses of both communicating source and destination, and when actual unicast communication begins, it
forwardsandfilterspackets using the already created MAC Address Table
ARP and MAC Tables are not deleted for a certain period, and this time is called aging time
Generally, the MAC Table's aging time is longer than the terminal's ARP aging time, allowing Ethernet networks to operate efficiently without flooding
Last updated