Ethernet Switching
DAT230 – Communication Technology I
         Naeem Khademi
    Associate Professor, IDE/UiS
         naeem.khademi@uis.no
                                      1
Ethernet
•     What is Ethernet? family of “wired” networking
      technologies specified in a bundle of PHY (802.3) &
      DL layer (802.2 & 802.3) protocols
•     LLC sublayer (802.2): places information in the
      frame to identify the used network layer protocol.
•     MAC sublayer (802.3, .11, .15): data encapsulation,
      media access control, and DL layer addressing
•     Data encapsulation (per IEEE 802.3):
       – Ethernet frame: internal structure of Ethernet frame
       – Ethernet addressing: source and destination MAC
         addrress used on the same LAN
       – Ethernet error detection: frame check sequence (FCS)
         trailer used for error detection -- Cyclic Redundancy
         Check (CRC-32) is used to compute the 4 octets FCS.
 Robert M. Metcalfe’s
drawing of Ethernet idea
       in 1976
                                                                 2
Ethernet MAC
•   Ethernet MAC sublayer: data encapsulation, media access control, and DL layer
    addressing
•   Media Access Control (per IEEE 802.3):
     – Spec for various types of media (e.g., fiber, copper,…)
     – Legacy Ethernet using bus topology or hubs; shared, half-duplex medium.
        Ethernet over a half-duplex medium CSMA/CD
     – Today’s Ethernet LANs: switches operating in full-duplex. Full-duplex
        communications with Ethernet switches do not require access control through
        CSMA/CD. Switches provide collision-free interconnection.
       Switched interconnect
            Ethernet hub
                                                                                      3
Ethernet Frames
•   Ethernet MAC sublayer: data encapsulation, media access control, and DL layer
    addressing
•   Ethernet frame fields: min | max Ethernet frame size 64 | 1518 bytes. The preamble
    field not included when describing the frame size.
      – length(frame) < 64B: “collision fragment” or “runt frame”; automatically discarded.
      – length(frame) >1500B data: “jumbo” (much bigger) or “baby giant frames”
          (slightly bigger)
•   If below 45B or above 1500B data, the receiving device drops the frame.
     – Dropped frames are likely to be the result of collisions or other unwanted signals
       and are invalid.
     – Tweak: Jumbo frames are usually supported by most Fast Ethernet and Gigabit
       Ethernet switches and NICs though.
     – Jumbo frames can carry up to 9kBs of payload!
                                                                                            4
Ethernet MAC Address (#1)
•   Ethernet MAC sublayer: data encapsulation, media access control, and DL layer
    addressing
•   Ethernet MAC address: 48-bits (binary) = 6 Bytes = 12 HEX
•   One-byte as a common binary grouping can be 00 to FF; leading zeros represented
    e.g., 0000 1010 = 0AHEX = 0x0A = 0A16 = 0AH
•   MAC address identifies a unique LAN device (NIC, i.e., L2 entity)
•   To ensure uniqueness, all vendors register with IEEE to get a 6 HEX (3 bytes, 24 bits)
    code called Organizationally Unique Identified (OUI)
•   Ethernet MAC address = OUI + vendor assigned valye
                                                                                             5
    Ethernet MAC Address (#2)
•    Frame processing: sending/forwarding
     device include src/dst MAC address
•    Receiving NIC checks if dst MAC addr
     matches its own MAC addr stored in its
     RAM
•    If yes, it will send the frame up the OSI layers
     stack else frame will be discarded
•    Successful frame will be decapsulated by
     upper layer
•    Frames with broadcast or multicast (if the
     host belongs to the multicast group) dst
     MAC addr will also be accepted
•    Different MAC addresses used for L2
     unicast, multicast and broadcast
                                                        6
    Ethernet MAC Address (#3)
•    Unicast MAC address: unique address used for
     one-to-one (src to dst)
      – Src MAC addr should ALWAYS be unicast!
•    Address Resolution Protocol (ARP): process of
     finding a destination MAC address associated with
     an IPv4 address
•    Network Discovery (ND): same as ARP for IPv6
•    Broadcast MAC address: received and processed
     by every device on Ethernet LAN.
      – Dst MAC addr: FF-FF-FF-FF-FF-FF
      – Flooded out of all switch ports except ingress(i.e.,
        incoming) port
      – Not forwarded by routers!
      – If encapsulating IPv4 broadcast, the host portion of
        IPv4 dst address should be all 1s (e.g.,
        192.168.1.255) – i.e., all hosts on local network
        (broadcast domain) will accept the packet.
                                                               7
    Ethernet MAC Address (#4)
•    Multicast MAC address: Ethernet multicast
     frame received by a group of devices that
     belong to the same multicast group!
•    Dst MAC addr for IP multicast packet: 01-00-
     5E (IPv4) and 33-33 (IPv6)
•    Other values used for non-IP encapsulated
     data (e.g., STP)
•    Flooded out all Ethernet switch ports except the incoming port, unless the switch is
     configured for multicast snooping. Not forwarded by a router, unless the router is
     configured to route multicast packets.
•    Represent a group of addresses (host group) and can only be used as dst MAC addr.
     Source MAC addr will always be a unicast.
•    As with the unicast and broadcast, the multicast IP address requires a corresponding
     multicast MAC address.
                                                                                            8
    MAC Address Table
•    L2 Ethernet Switch: solely uses L2 MAC addresses to
     make forwarding decisions – oblivious to higher layer data
     (e.g., IPv4|6, ARP, ND, etc.)
•    Ethernet switch maintains a MAC address table (a.k.a
     content addressable memory (CAM) table) to decide with
     port to forward the incoming frame to (except the
     incoming).
•    MAC address table is empty on switch start-up
                                                                  Microscope photograph of a gate-array ASIC
                                                                  showing the predefined logic cells and custom
                                                                  interconnections.
•    Learning: examine the src MAC addr and                       Source: Wikipedia
     check the arriving port number;
       – If src MAC addr doesn’t exist in the table,
          add it.
       – If it does exist, update the refresh timer
          for that entry (5 min by default for most
          Ethernet switches)
       – If it does exist, but on a different port,
          make a new entry with new port!                                                                 9
    MAC Address Table & Forwarding Methods (#1)
•    Forwarding: if dst MAC addr is unicast, L2
     switch will look for a match (i.e., an entry) in
     MAC address table;
      – if there is a match, it will forward the frame to
        the specified port in the table.
      – If no match, forward the frame on all other ports
        except incoming (“unknown unicast” situation)
•    If multicast or broadcast, also flood on all
     ports except incoming
•    Forwarding methods:
      – Store-and-forward switching: receives the entire frame and computes CRC. If the CRC is valid,
        looks up the destination address, and determines the outgoing interface. Forwarded the frame to
        the correct port.
           – Advantage: can determine error before propagation saving bandwidth (and resources)
           – Necessary for QoS analysis when frame classification for traffic prioritization is necessary!
              e.g., for VoIP prioritization over web
      – Cut-through switching: forwards the frame before it is entirely received. At minimum, the
        destination address must be read. No error checking!
                                                                                                     10
    MAC Address Table & Forwarding Methods (#2)
•    Cut-through Switching: has two variants
      – Fast-forward switching: typical cut-through method; offers the lowest level of latency
        by immediately forwarding a packet after reading the destination address. Because it
        starts forwarding before entire packet is received, there may be packets relayed with
        errors. The destination NIC discards the erroneous packet upon receipt.
      – Fragment-free switching: compromise between the high latency and high integrity of
        store-and-forward and the low latency and reduced integrity of fast-forward; switch
        stores and performs error check on the first 64 bytes of the frame before
        forwarding. Because most network errors and collisions occur during the first 64
        bytes, this ensures that a collision has not occurred before forwarding the frame.
        Credits: NetworkAcademy                     Credits: NetworkAcademy
                                                                                         11
 Switch Buffer Memory Types & Link Settings
Buffering Method    Description
                    –   Frames stored in queues linked to specific incoming/outgoing ports.
                    –   A frame is sent to the outgoing port only when all frames ahead in the queue have been successfully transmitted.
Port-based memory
                    –   Possible for a single frame to delay the transmission of all frames in memory because of a busy destination port.
                    –   This delay occurs even if the other frames could be transmitted to open destination ports.
                    – Deposits all frames into a common memory buffer shared by all switch ports and the amount of buffer memory
                      required by a port is dynamically allocated.
                    – The frames in the buffer are dynamically linked to the destination port enabling a packet to be received on one port
Shared memory         and then transmitted on another port, without moving it to a different queue.
                    – Results in larger frames that can be transmitted with fewer dropped frames. This is important with asymmetric
                      switching which allows for different data rates on different ports. Therefore, more bandwidth can be dedicated to
                      certain ports (e.g., server port).
Duplex and Speed setting: two basic settings on a
switch; bandwidth (“speed”) and duplex for each
port; must match between port and connected
devices.
–   Duplex settings: full-duplex vs half-duplex
–   Autonegotiation: an optional function found on most Ethernet switches and NICs; enables two devices to
    automatically negotiate the best speed and duplex capabilities (note Gigabit Ethernet is full-duplex only)
–   Duplex mismatch: a common causes of performance issues on 10/100 Mbps Ethernet links.
      – when one or both ports on a link are reset, and the autonegotiation process does not result in both
         link partners having the same configuration.
      – when users reconfigures one side of a link and forgets to reconfigure the other. Both sides should
         have autonegotiation on, or both sides should have it off. Best practice is both ports as full-duplex.
      – Auto-MDIX: router-to-host (crossover cable) but most devices now have automatic medium-
         dependent interface crossover (auto-MDIX) feature                                                12