Switching Overview
Switching Overview
Switching Overview
KHAWAR BUTT
CCIE # 12353 [R/S, SECURITY, SP, DC, VOICE, STORAGE & CCDE]
Overview
Switch functionality
MAC Address
MAC Address Table c
6 Hex 6 Hex
Digits c
Digits
The address that is assigned to the NIC is called the MAC Address.
It is made up of 2 parts, the OUI and a Unique Vendor assigned address.
The Organizationally Unique Identifier (OUI) is assigned to the vendor by IEEE. The vendor
assigns each NIC/Interface that it manufactures a unique identifier. It is written in Hex
format.
Example of a MAC Address is : 0001.AA00.0001 or 00:01:AA:00:00:01 or 00-01-AA-00-00-
01, where the 0001.AA represents the OUI and 00.0001 represents the unique vendor
assigned identifier for the device.
Network Diagram:
PC1 SW1 PC2
E 0/0 E 0/2
E 0/1
MAC: 0001.1111.AAAA MAC: 0001.1111.BBBB
IP : 192.168.1.51 IP : 192.168.1.52
PC3
MAC: 0001.1111.CCCC
IP : 192.168.1.53
MAC Address Table
The switch builds and maintains a table known as the MAC Address Table using a automatic
process called MAC Learning.
The MAC Address table associates the Switchport with a specific MAC Address connected to
c
that port.
The switch learns the MAC address to port assignment by analyzing the Source MAC address of
a Frame. If a frame comes in with a MAC address it is not aware of from a port, it will learn it
and store it in the MAC Address Table. The switch learns the topology of the network using this
methodology.
The switch will forward the frame by analyzing the destination MAC address.
It will only forward the frame to the associated port with that MAC address.
If the MAC Address is not known, it will flood it to all ports of the switch.
All broadcast and multicast frames are always flooded.
Switching Frames Mechanism
Let’s assume the switch does not have any MAC Addresses in the MAC Address table.
PC1 wants to communicate to PC2.
The switch receives a frame from PC1 on port E 0/0.
c
The switch analyzes the Source MAC address of the frame. It will store the MAC Address and the
associated port in the MAC Address Table.
The switch will now check the destination MAC Address against the MAC Address table.
As the MAC address is not in the MAC address table, the switch will flood the frame to all ports.
PC2 will receive the frame and respond respond back using its MAC Address as the source and PC1’s
MAC address as the destination.
The switch will learn the new MAC Address and store it in the MAC address table.
The switch will only forward the frame on Port E 0/0 as it has already learnt the MAC address in the
initial communication.
Switching Frames Mechanism
The switch will learn all the MAC addresses on the network by using the same mechanism.
The Switch will use the MAC Address Table to forward frames to the specific destination ports.
PC1 SW1 PC2
c
E 0/2
E 0/0
E 0/1
MAC: 0001.1111.AAAA MAC: 0001.1111.BBBB
IP : 192.168.1.51 IP : 192.168.1.52
PC1 wants to communicate to PC2. The Users needs to know the IP Address
of the destination PC, PC2 in our case. Let’s take a look at the process of
communication within the same network.
IP Communications –
Switched Network
1. PC1 creates an IP Packet at Layer 3 with a source address of 192.168.1.51 and a destination
address of 192.168.1.52.
Source MAC : 0001.1111.AAAA Dest. MAC : FFFF.FFFF.FFFF What is the MAC for 192.168.1.52?
IP Communications –
Switched Network
3. The ARP Broadcast is sent to all the devices on the switched network. PC2 receives the
broadcast and responds back to the ARP Request with its MAC Address.
Source MAC : 0001.1111.BBBB Dest. MAC : 0001.1111.AAAA MAC for 192.168.1.52 is 0001.1111.BBBB
c
4. PC1 receives the ARP Reply and stores the MAC address for 192.168.1.52 in the local ARP
Cache. The next time it needs to communicate to the same IP, it does not need to send an ARP
request. Instead, it will find the MAC address in the ARP Cache. Similarly, it will also learn the
MAC address of PC3. The other devices will do the same to build the ARP Cache using the ARP
Broadcast.
ARP Cache
IP Address MAC Address
192.168.1.52 0001.1111.BBBB
192.168.1.53 0001.1111.CCCC
IP Communications –
Switched Network
5. PC1 now completes the original packet by address the Layer 2 information.
192.168.12.0/24 192.168.23.0/24
R1 R2 R3
IP Communications –
Routed Network
In order to communicate between different networks, the PC will need to identify
the destination device by specifying the destination MAC address & destination
IP address as well.
c
As the Source and Destination devices are on different networks, a router will be
used to connect the networks.
Let’s take the network in the previous slide as an example and take a look at the
IP communications.
2. The Local switch will forward the packet to the Default Gateway (R1). Once R1 receives the
packet, it will strips of the Layer 2 Header.
IP Communications –
Routed Network
3. The Router will check its routing table to figure out the next hop to reach 192.168.3.0/24
network. The next hop would be R2. R1 will use R2’s MAC address to forward the packet. It will
find the MAC Address of R2 in the ARP cache or use the ARP request to discover R2’s MAC
address. It will recreate the Layer 2 Header with it’s own MAC Address as a source and R2’s MAC
c
address as the destination and forward the packet. The L3 header will remain unchanged.
Source MAC : Dest. MAC : Source IP : Destination IP : Data
R1-MAC R2 - MAC 192.168.1.50 192.168.3.50
4. R2 will receive the packet. It will also strip off the L2 Header. It will also check it’s routing table
to find the next-hop address for 192.168.3.0/24. The Next hop would be R3. R2 will re-write the
L2 header using it’s MAC address as the source and R3’s MAC address as the destination and
forward the packet towards R3. The L3 header will remain unchanged.
Source MAC : Dest. MAC : Source IP : Destination IP : Data
R2-MAC R3 – MAC 192.168.1.50 192.168.3.50
IP Communications –
Routed Network
5. R3 will receive the packet. It will also strip off the L2 Header. It will also check it’s routing table
to find that the 192.168.3.0/24 network is directly connected on E 0/1. It will use the ARP Cache
or ARP request to find the MAC Address for 192.168.3.50. R3 will re-write the L2 header using
it’s MAC Address as the source and PC3’s MAC address as the destination. It will forward the
c
packet to the local switch. The Local switch will use the MAC address to forward the packet to
PC3.
6. PC3 receives the packet. It will respond back using the same methodology.
Whiteboard