MAC Learning and Aging
Learning mac addresses is one of the responsibilities of a switch. The switch transparently observes incoming frames. All the source mac addresses are recorded in the mac-address-table of the switch. It also associates the specific port with a source MAC address. For each connected device, the mac addresses are different. Frame forwarding(switching) decisions are made by a switch on the basis of this information.
A host system could be turned off or move at any point. A switch must also age mac addresses and remove them from the table after they have not seen for some time. This frees an unused address from the mac address table.
The aging of mac addresses on a cisco switch can be manipulated. The default on most Cisco switches is 300 secs (Cisco ME 2600X). The range is from 0 to 1000000 seconds. The MAC address aging can be disabled by entering the value 0.
A switch is also responsible for forwarding frames intelligently port to port. As we know, the hub takes in frames and always forward that frames out to all other ports. But in switch if it’s mac address is fully populated for all ports, it filters the frame being forwarded out ports unnecessarily. It forwards the frames to the correct path based on destination mac addresses.
If the destination address of any frame is not in the mac table, the frame is flooded/forwarded to all the ports other than the port on which frame was received. It is known as unknown unicast flooding. It happens when the destination mac address is a broadcast address. (ffff.ffff.ffff).
MAC Address Table
In switch, the mac-address-table is an important component. It contains the mac address to port mappings that allows the switch to take decision while forwarding frames.
Here switch receives a frame from port 1 and enters this information to the mac address table. Now, switch checks the table for destination mac address but doesn’t seem to find any. Then switch forward the frame to all other ports other than port 1 from where the frame was received.
Now, again PC y wants to send the frame to PC x. Switch received the frame from port 2 and again enters this information to the mac table. now, it looks for destination addresses in the mac table. It seems that the destination mac address is associated with port 1 so it forwards the frame to port 1 only.
Now, PC x and PC y can forward frames between them without flooding because it has entries in the mac table.
Types of Switching Methods:
- Store and forward switching method
- Cut through switching method
- Fragment free switching method
To know in details about the types of switching methods go through :
Interpret Ethernet Frame Format
The fields before data and pad -> Header
The fields after data and pad -> Trailer
The preamble is 7 bytes in length. It is simply a pattern of alternating 1 and 0 bits that allows devices on the network to easily synchronize their receiver clocks.
The Start Frame Delimiter (SFD) field is 1 byte in length. It marks the end of the Preamble field and indicates the beginning of the Destination MAC field.
The Destination MAC field is 6 bytes in length and is used to store the frame’s destination MAC address.
The Source MAC address field is also 6 bytes in length. It stores the appropriate source MAC address.
The Length/Type field is 2 bytes in length and identifies the protocol carried in the frame.
The Data and Pad field ranges from 46 to 1500 bytes. The padding might exist so that the field can meet the minimum length requirement of 46 bytes. The data portion represents the actual data being sent from a higher layer of the OSI model.
The Frame Check Sequence (FCS) field is 4 bytes in length and holds the result of the cyclic redundancy check calculation on the frame’s fields (except with the Preamble, SFD, and FCS fields). The purpose of this field is to determine whether the frame experienced transmission errors in its journey through the network.
Note: A switch dynamically learns MAC address entries by default. You can also program a switch with static MAC address entries.