Thursday, October 17, 2013

How switches and bridges learn addresses

How switches and bridges learn addresses 
4.3.3 This page will explain how bridges and switches learn addresses and forward frames.
Bridges and switches only forward frames that need to travel from one LAN segment to another. To accomplish this task, they must learn which devices are connected to which LAN segment. 
A bridge is considered an intelligent device because it can make decisions based on MAC addresses. To do this, a bridge refers to an address table. When a bridge is turned on, broadcast messages are transmitted asking all the stations on the local segment of the network to respond. As the stations return the broadcast message, the bridge builds a table of local addresses. This process is called learning.
Bridges and switches learn in the following ways:
  • Reading the source MAC address of each received frame or datagram
  • Recording the port on which the MAC address was received
In this way, the bridge or switch learns which addresses belong to the devices connected to each port.
The learned addresses and associated port or interface are stored in the addressing table. The bridge examines the destination address of all received frames. The bridge then scans the address table searching for the destination address.
The switching table is stored using Content Addressable Memory (CAM). CAM is used in switch applications to perform the following functions:
  • To take out and process the address information from incoming data packets
  • To compare the destination address with a table of addresses stored within it
The CAM stores host MAC addresses and associated port numbers. The CAM compares the received destination MAC address against the CAM table contents. If the comparison yields a match, the port is provided, and the switch forwards the packet to the correct port and address. 
An Ethernet switch can learn the address of each device on the network by reading the source address of each frame transmitted and noting the port where the frame entered the switch. The switch then adds this information to its forwarding database. Addresses are learned dynamically. This means that as new addresses are read, they are learned and stored in CAM. When a source address is not found in CAM, it is learned and stored for future use.
Each time an address is stored, it is time stamped. This allows for addresses to be stored for a set period of time. Each time an address is referenced or found in CAM, it receives a new time stamp. Addresses that are not referenced during a set period of time are removed from the list. By removing aged or old addresses, CAM maintains an accurate and functional forwarding database.
The processes followed by the CAM are as follows:
  1. If the address is not found, the bridge forwards the frame out all ports except the port on which it was received. This process is called flooding. The address may also have been deleted by the bridge because the bridge software was recently restarted, ran short of address entries in the address table, or deleted the address because it was too old. Since the bridge does not know which port to use to forward the frame, it will send it to out all ports, except the one from which it was received. It is clearly unnecessary to send it back to the same cable segment from which it was received, since any other computer or bridges on this cable must already have received the packet.
  2. If the address is found in an address table and the address is associated with the port on which it was received, the frame is discarded. It must already have been received by the destination.
  3. If the address is found in an address table and the address is not associated with the port on which it was received, the bridge forwards the frame to the port associated with the address.
If the address is found in an address table and the address is not associated with the port on which it was received, the bridge forwards the frame to the port associated with the address.
The next page will describe the process that is used to filter frames. 

No comments:

Post a Comment