Frames in a switched network are forwarded using a combination of routing and MAC address table lookups. The switch learns MAC addresses and associates them with specific ports. This allows it to send frames only to the destination device, thus avoiding sending traffic to every port.
The Process of Frame Forwarding
Switches use two key tools when forwarding frames:
- MAC Address Table: A table where MAC addresses are associated with the specific switch ports on which those devices were last seen.
- Routing Table: A table that stores the best path for each network. This table is built using routing protocols.
Here's a breakdown of how frames are forwarded:
- Frame Arrival: When a frame arrives at a switch port, the switch examines the destination MAC address of the frame.
- MAC Address Lookup: The switch consults its MAC address table.
- If the destination MAC address is found: The switch forwards the frame only to the port associated with that MAC address. This is known as unicast forwarding.
- If the destination MAC address is not found: The switch may flood the frame out of all ports (except the incoming port). This is known as broadcast forwarding and is generally done for unknown destinations or for broadcast messages. The switch will then learn the MAC address of the source of the frame and update its MAC address table.
- Routing Table Usage (For Inter-Network Communication): When the switch needs to forward frames to different networks, it utilizes the routing table in combination with the MAC address table. The routing table, which is built using routing protocols like RIP, OSPF, or EIGRP, allows the switch to choose the correct path to the destination network.
- Path selection: The switch chooses the path to the destination and then forwards the frame based on the MAC address of the next hop router as determined by the routing table.
- Frame Forwarding: The frame is forwarded to the appropriate outgoing port.
Practical Insights
- Efficiency: This method of forwarding is far more efficient than the way hubs operate, which broadcast all traffic to all ports, wasting bandwidth.
- Learning: The switch dynamically learns MAC addresses, so there is typically no need to manually configure the MAC address table.
- Security: By only sending frames to the intended destination, switched networks provide a basic level of security.
Example
Let's say device A wants to send a frame to device B.
- Device A sends a frame with a destination MAC address of device B and a source MAC address of device A.
- The switch receives the frame on port 1 and examines the destination MAC address.
- If the switch has an entry in its MAC address table associating the MAC address of device B with port 4, it forwards the frame only to port 4.
- If the switch does not have an entry, it will send out the frame via all ports except port 1. It will also learn that device A’s MAC address can be reached via port 1 and will update the MAC address table.
Summary
In summary, switches use a combination of their MAC address table and routing tables to efficiently forward frames only to the intended recipient. This provides a more scalable and secure method of network communication. The switch uses the routing table and the MAC address table to forward the frames to the correct port and network.