Switching
Content Addressable Memory: MAC address table in the switch is sometimes referred to as a content addressable memory (CAM) table.
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 and only 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.
- The switch will only add a new MAC address to the MAC table based on the source MAC address. If the source MAC address is already in the table, nothing is added or learned. If the source MAC address is not in the table, the address will be added.
- A frame is flooded to all ports (except the origin) only if the switch does not have the destination MAC within the MAC table.
- A switch will drop a frame if the destination and source devices are both connected to the same port and the switch has the destination MAC address in the MAC table.
Half Duplex
Half-duplex communication relies on unidirectional data flow where sending and receiving data are not performed at the same time.
Full Duplex
In full-duplex communication, data flow is bidirectional, so data can be sent and received at the same time. The bidirectional support enhances performance by reducing the wait time between transmissions. In full-duplex mode, the collision detect circuit is disabled.
A Cisco Catalyst switch supports three duplex settings:
- The full option sets full-duplex mode.
- The half option sets half-duplex mode.
- The auto option sets autonegotiation of duplex mode. With autonegotiation enabled, the two ports communicate to decide the best mode of operation.
For Fast Ethernet and 10/100/1000 ports, the default is auto. For 100BASE-FX ports, the default is full. The 10/100/1000 ports operate in either half- or full-duplex mode when they are set to 10 or 100 Mb/s, but when set to 1,000 Mb/s, they operate only in full-duplex mode.
Auto-MDIX
Cable (crossover or straight-through) can be automatically detected, most switch devices now support the mdix auto interface configuration command in the CLI to enable the automatic medium-dependent interface crossover (auto-MDIX) feature.
The auto-MDIX feature is enabled by default on switches running Cisco IOS Release 12.2(18)SE or later. For releases between Cisco IOS Release 12.1(14)EA1 and 12.2(18)SE, the auto-MDIX feature is disabled by default.
Frame forwarding method
- Store-and-forward switching
In store-and-forward switching, when the switch receives the frame, it stores the data in buffers until the complete frame has been received. During the storage process, the switch analyzes the frame for information about its destination. In this process, the switch also performs an error check using the Cyclic Redundancy Check (CRC) trailer portion of the Ethernet frame.
If the full frame was not received, the switch discards it.
Can conserve bandwidth because only complete and intact frame will be forwarded.
- Cut-through switching
The switch buffers just enough of the frame to read the destination MAC address so that it can determine to which port to forward the data. The destination MAC address is located in the first 6 bytes of the frame following the preamble. The switch looks up the destination MAC address in its switching table, determines the outgoing interface port, and forwards the frame onto its destination through the designated switch port.
- The switch does not perform any error checking on the frame. Because the switch does not have to wait for the entire frame to be completely buffered.
- Because the switch does not perform any error checking, cut-through switching is faster than store-and-forward switching.
- May waste bandwidth, because the error frame will eventually discarded by NIC.
Memory Buffering
A switch analyzes some or all of a packet before it forwards it to the destination host. An Ethernet switch may use a buffering technique to store frames before forwarding them. Buffering may also be used when the destination port is busy due to congestion and the switch stores the frame until it can be transmitted. There are two methods of memory buffering:
- Port-based Memory BufferingIn port-based memory buffering, frames are stored in queues that are linked to specific incoming and outgoing ports. A frame is transmitted to the outgoing port only when all the frames ahead of it in the queue have been successfully transmitted. It is possible for a single frame to delay the transmission of all the frames in memory because of a busy destination port. This delay occurs even if the other frames could be transmitted to open destination ports.
In the image above, frame1 from in-port 1 arrive the switch first and targeting out-port1, then frame 2 from in-port2 to out-port3, and last frame 3; the frames will jump in the queue and wait for the the switch to switch one by one, if frame 1 has not been forwarded, frame 2 will never been forwarded even out-pot3 is free.
- Shared Memory Buffering Shared memory buffering deposits all frames into a common memory buffer that all the ports on the switch share. The amount of buffer memory required by a port is dynamically allocated. The frames in the buffer are linked dynamically to the destination port. This allows the packet to be received on one port and then transmitted on another port, without moving it to a different queue.
The switch keeps a map of frame to port links showing where a packet needs to be transmitted. The map link is cleared after the frame has been successfully transmitted. The number of frames stored in the buffer is restricted by the size of the entire memory buffer. This permits larger frames to be transmitted with fewer dropped frames. This is especially important to asymmetric switching.
Asymmetric switching allows for different data rates on different ports. This allows more bandwidth to be dedicated to certain ports, such as a port connected to a server.
Module options for Cisco Switch slots
The Catalyst 3560 switches have Small Form-Factor Pluggable (SFP) ports that support a number of SFP transceiver modules. Here is a list of the SFP modules supported on one or more types of 3560 switches:
10BASE5 (also known as thick ethernet or thicknet) was the original commercially available variant of Ethernet.
Fast Ethernet SFP Modules –
- 100BASE-FX (multimode fiber-optic (MMF)) for 2 kilometers (km)
- 100BASE-LX10 (single-mode fiber-optic (SMF)) for 2km
- 100BASE-BX10 (SMF) for 10 km
- 100BASE-EX (SMF) for 40 km
- 100BASE-ZX (SMF) for 80 km
Gigabit Ethernet SFP Modules –
- 1000BASE-SX 50/62.5 μm (MMF) up to 550/220 m
- 1000BASE-LX/LH (SMF/MMF) up to 10/0.550 k
- 1000BASE-ZX (SMF) up to 70 km
- 1000BASE-BX10-D&1000BASE-BX10-U (SMF) up to 10 km
- 1000BASE-T (copper wire transceiver)
10 Gigabit Ethernet SFP Modules –
- 10G-SR (MMF) up 400 m
- 10G-SR-X (MMF) up to 400 m (supporting extended temperature range)
- 10G-LRM (MMF) up to 220 m
- FET-10G (MMF) up to 100 m (for Nexus fabric uplinks)
- 10G-LR (SMF) up to 10 km
- 10G-LR-X (SMF) up to 10 km (supporting extended temperature range)
- 10G-ER (SMF) up to 40 km
- 10G-ZR (SMF) up to 80 km
- Twinax (copper wire transceiver) up to 10 m
- Active Optical up to 10 m (for intra/inter-rack connections)
40 Gigabit Ethernet and 100 Gigabit Ethernet modules are supported on high-end Cisco devices, such as the Catalyst 6500, the CRS router, the ASR 9000 series router, and the Nexus 7000 series switch.
Layer 3 Switching
Layer 3 switch can also use IP address information,instead of only learning which MAC addresses are associated with each of its ports, a Layer 3 switch can also learn which IP addresses are associated with its interfaces. This allows the Layer 3 switch to direct traffic throughout the network based on IP address information as well.
Layer 3 switches are also capable of performing Layer 3 routing functions, reducing the need for dedicated routers on a LAN. Because Layer 3 switches have specialized switching hardware, they can typically route data as quickly as they can switch.
Cisco Express Forwarding
Basically, CEF decouples the usual strict interdependence between Layer 2 and Layer 3 decision making. What makes forwarding IP packets slow is the constant referencing back-and-forth between Layer 2 and Layer 3 constructs within a networking device. So, to the extent that Layer 2 and Layer 3 data structures can be decoupled, forwarding is accelerated.
The two main components of CEF operation are the:
- Forwarding Information Base (FIB): The FIB is conceptually similar to a routing table. A router uses the routing table to determine best path to a destination network based on the network portion of the destination IP address.
With CEF, information previously stored in the route cache is, instead, stored in several data structures for CEF switching. The data structures provide optimized lookup for efficient packet forwarding. A networking device uses the FIB lookup table to make destination-based switching decisions without having to access the route cache.
- Adjacency tables: Adjacency tables maintain Layer 2 next-hop addresses for all FIB entries.
The separation of the reachability information (in the FIB table) and the forwarding information (in the adjacency table), provides a number of benefits:
- The adjacency table can be built separately from the FIB table, allowing both to be built without any packets being process switched.
- The MAC header rewrite used to forward a packet is not stored in cache entries, so changes in a MAC header rewrite string do not require invalidation of cache entries.
Layer3 interfaces
A Layer 3 interface is one that supports forwarding IP packets toward a final destination based on the IP address.
The major types of Layer 3 interfaces are:
- Switch Virtual Interface (SVI) – Logical interface on a switch associated with a virtual local area network (VLAN).SVI for the default VLAN (VLAN1) must be enabled to provide IP host connectivity to the switch and permit remote switch administration.
Only one SVI can be associated with a VLAN, but you need to configure an SVI for a VLAN only when you
- wish to route between VLANs,
- or to provide IP host connectivity to the switch.
1. By default, an SVI is created for the default VLAN (VLAN 1) to permit remote switch administration.
Additional SVIs must be explicitly configured.
2. Additional SVIs are created the first time that you enter the vlan interface configuration command (eg. S1(config)# interface vlan 2) for a VLAN interface.
- Routed Port – Physical port on a Layer 3 switch configured to act as a router port.A switch port can be configured to be a Layer 3 routed port and behave like a regular router interface. Specifically, a routed port:
- Is not associated with a particular VLAN.
- Can be configured with a Layer 3 routing protocol.
- Is a Layer 3 interface only and does not support Layer 2 protocol.
Configure routed ports by putting the interface into Layer 3 mode with the no switchport.
- Layer 3 EtherChannel – Logical interface on a Cisco device associated with a bundle of routed ports.