Switches use MAC addresses to direct network communications through their switch fabric to the appropriate port toward the destination node. The switch fabric is the integrated circuits and the accompanying machine programming that allows the data paths through the switch to be controlled. For a switch to know which port to use to transmit a unicast frame, it must first learn which nodes exist on each of its ports.
A switch determines how to handle incoming data frames by using its MAC address table. A switch builds its MAC address table by recording the MAC addresses of the nodes connected to each of its ports. Once a MAC address for a specific node on a specific port is recorded in the address table, the switch then knows to send traffic destined for that specific node out the port mapped to that node for subsequent transmissions.
When an incoming data frame is received by a switch and the destination MAC address is not in the table, the switch forwards the frame out all ports, except for the port on which it was received. When the destination node responds, the switch records the node's MAC address in the address table from the frame's source address field. In networks with multiple interconnected switches, the MAC address tables record multiple MAC addresses for the ports connecting the switches which reflect the node's beyond. Typically, switch ports used to interconnect two switches have multiple MAC addresses recorded in the MAC address table.
To see how this works, view each of the steps in Figures 1-6.
The following describes this process:
Step 1. The switch receives a broadcast frame from PC1 on Port 1.
Step 2. The switch enters the source MAC address and the switch port that received the frame into the address table.
Step 3. Because the destination address is a broadcast, the switch floods the frame to all ports, except the port on which it received the frame.
Step 4. The destination device replies to the broadcast with a unicast frame addressed to PC1.
Step 5. The switch enters the source MAC address of PC2 and the port number of the switch port that received the frame into the address table. The destination address of the frame and its associated port is found in the MAC address table.
Step 6. The switch can now forward frames between source and destination devices without flooding, because it has entries in the address table that identify the associated ports.
Note: The MAC address table is sometimes referred to as a content addressable memory (CAM) table. While the term CAM table is fairly common, for the purposes of this course, we will refer to it as a MAC address table.
Accessing MAC address views and searches
Syntax
show mac-address
[vlan <vlan-id> ]
[<PORT-LIST> ]
[ mac-addr ]
Listing all learned MAC addresses on the switch, with the port number on which each MAC address was learned
HP Switch# show mac-addressListing all learned MAC addresses on one or more ports, with their corresponding port numbers
For example, to list the learned MAC address on ports A1 through A4 and port A6:
HP Switch# show mac-address a1-a4,a6Listing all learned MAC addresses on a VLAN, with their port numbers
This command lists the MAC addresses associated with the ports for a given VLAN. For example:
HP Switch# show mac-address vlan 100
NOTE: The switches operate with a multiple forwarding database architecture. | |
Finding the port on which the switch learned a specific MAC address
For example, to find the port on which the switch learns a MAC address of 080009-21ae84:
Accessing MAC address views and searches (Menu)
Viewing and searching per-VLAN MAC-addresses
This feature lets you determine which switch port on a selected VLAN is being used to communicate with a specific device on the network.
From the Main Menu, select:
The switch then prompts you to select a VLAN.
Use the Space bar to select the VLAN you want, and then press [Enter].
The switch then displays the MAC address table for that VLAN (Example of the address table.)
Example of the address table
To page through the listing, use Next page and Prev page.
Finding the port connection for a specific device on a VLAN
This feature uses a device's MAC address that you enter to identify the port used by that device.
Proceeding from Example of the address table, press [S] (for Search), to display the following prompt:
Enter MAC address: _Enter the MAC address you want to locate and press [Enter].
The address and port number are highlighted if found (Example of menu indicating located MAC address.) If the switch does not find the MAC address on the currently selected VLAN, it leaves the MAC address listing empty.
Example of menu indicating located MAC address
Press [P] (for Prev page) to return to the full address table listing.
Viewing and searching port-level MAC addresses
This feature displays and searches for MAC addresses on the specified port instead of for all ports on the switch.
From the Main Menu, select:
Listing MAC addresses for a specific port
Use the Space bar to select the port you want to list or search for MAC addresses, then press [Enter] to list the MAC addresses detected on that port.
Determining whether a specific device is connected to the selected port
Proceeding from step 2, above:
Press [S] (for Search), to display the following prompt:
Enter MAC address: _Enter the MAC address you want to locate and press [Enter].
The address is highlighted if found. If the switch does not find the address, it leaves the MAC address listing empty.
Press [P] (for Prev page) to return to the previous per-port listing.