Presentation on theme: "Interconnection: Switching and Bridging CS 4251: Computer Networking II Nick Feamster Fall 2008."— Presentation transcript:
Interconnection: Switching and Bridging CS 4251: Computer Networking II Nick Feamster Fall 2008
2 In This Lecture How hosts find each other on a subnet –Address Resolution Protocol (ARP) –Broadcast Interconnecting subnets –Switches: Forwarding and filtering –Self-learning bridges –Spanning tree protocols Switches vs. Hubs Swtiches vs. Routers Can Ethernet scale to a million nodes? –VLANs –Other alternatives
3 Bootstrapping: Networks of Interfaces LAN/Physical/MAC address –Flat structure –Unique to physical interface (no two alike)…how? sender frame receiver datagram frame adapter link layer protocol What are the advantages to separating network layer from MAC layer? Frames can be sent to a specific MAC address or to the broadcast MAC address
4 ARP: IP Addresses to MAC addresses Query is IP address, response is MAC address Query is sent to LANs broadcast MAC address Each host or router has an ARP table –Checks IP address of query against its IP address –Replies with ARP address if there is a match Potential problems with this approach? Caching on hosts is really important –Try arp –a to see an ARP table
5 Life of a Packet: On a Subnet Packet destined for outgoing IP address arrives at network interface –Packet must be encapsulated into a frame with the destination MAC address Frame is sent on LAN segment to all hosts Hosts check destination MAC address against MAC address that was destination IP address of the packet
7 Interconnecting LANs with Hubs All packets seen everywhere –Lots of flooding, chances for collision Cant interconnect LANs with heterogeneous media (e.g., Ethernets of different speeds) hub
8 Problems with Hubs: No Isolation Scalability Latency –Avoiding collisions requires backoff –Possible for a single host to hog the medium Failures –One misconfigured device can cause problems for every other device on the LAN
9 Improving on Hubs: Switches Link-layer –Stores and forwards Ethernet frames –Examines frame header and selectively forwards frame based on MAC dest address –When frame is to be forwarded on segment, uses CSMA/CD to access segment Transparent –Hosts are unaware of presence of switches Plug-and-play, self-learning –Switches do not need to be configured
10 Switch: Traffic Isolation Switch breaks subnet into LAN segments Switch filters packets –Same-LAN-segment frames not usually forwarded onto other LAN segments –Segments become separate collision domains hub switch collision domain
11 Filtering and Forwarding Occurs through switch table Suppose a packet arrives destined for node with MAC address x from interface A –If MAC address not in table, flood (act like a hub) –If MAC address maps to A, do nothing (packet destined for same LAN segment) –If MAC address maps to another interface, forward How does this table get configured? LAN A LAN B LAN C A B C
12 Advantages vs. Hubs Better scaling –Separate collision domains allow longer distances Better privacy –Hosts can snoop the traffic traversing their segment –… but not all the rest of the traffic Heterogeneity –Joins segments using different technologies
13 Disadvantages vs. Hubs Delay in forwarding frames –Bridge/switch must receive and parse the frame –… and perform a look-up to decide where to forward –Storing and forwarding the packet introduces delay –Solution: cut-through switching Need to learn where to forward frames –Bridge/switch needs to construct a forwarding table –Ideally, without intervention from network administrators –Solution: self-learning
14 Motivation For Self-Learning Switches forward frames selectively –Forward frames only on segments that need them Switch table –Maps destination MAC address to outgoing interface –Goal: construct the switch table automatically switch A B C D
15 (Self)-Learning Bridges Switch is initially empty For each incoming frame, store –The incoming interface from which the frame arrived –The time at which that frame arrived –Delete the entry if no frames with a particular source address arrive within a certain time A B C D Switch learns how to reach A.
16 Cut-Through Switching Buffering a frame takes time –Suppose L is the length of the frame –And R is the transmission rate of the links –Then, receiving the frame takes L/R time units Buffering delay can be a high fraction of total delay, especially over short distances A B switches
17 Cut-Through Switching Start transmitting as soon as possible –Inspect the frame header and do the look-up –If outgoing link is idle, start forwarding the frame Overlapping transmissions –Transmit the head of the packet via the outgoing link –… while still receiving the tail via the incoming link –Analogy: different folks crossing different intersections A B switches
18 Limitations on Topology Switches sometimes need to broadcast frames –Unfamiliar destination: Act like a hub –Sending to broadcast Flooding can lead to forwarding loops and broadcast storms –E.g., if the network contains a cycle of switches –Either accidentally, or by design for higher reliability Worse yet, packets can be duplicated and proliferated!
19 Solution: Spanning Trees Ensure the topology has no loops –Avoid using some of the links when flooding –… to avoid forming a loop Spanning tree –Sub-graph that covers all vertices but contains no cycles –Links not in the spanning tree do not forward frames
20 Constructing a Spanning Tree Elect a root –The switch with the smallest identifier Each switch identifies if its interface is on the shortest path from the root –And it exclude from the tree if not –Also exclude from tree if same distance, but higher identifier Message Format: (Y, d, X) –From node X –Claiming Y as root –Distance is d root One hop Three hops
21 Steps in Spanning Tree Algorithm Initially, every switch announces itself as the root –Example: switch X announces (X, 0, X) Switches update their view of the root –Upon receiving a message, check the root id –If the new id is smaller, start viewing that switch as root Switches compute their distance from the root –Add 1 to the distance received from a neighbor –Identify interfaces not on a shortest path to the root and exclude those ports from the spanning tree
22 Example From Switch #4s Viewpoint Switch #4 thinks it is the root –Sends (4, 0, 4) message to 2 and 7 Switch #4 hears from #2 –Receives (2, 0, 2) message from 2 –… and thinks that #2 is the root –And realizes it is just one hop away Switch #4 hears from #7 –Receives (2, 1, 7) from 7 –And realizes this is a longer path –So, prefers its own one-hop path –And removes 4-7 link from the tree 1 2 3 4 5 6 7
23 Switches vs. Routers Switches are automatically configuring Forwarding tends to be quite fast, since packets only need to be processed through layer 2 Router-level topologies are not restricted to a spanning tree –Can even have multipath routing Switches Routers
24 Scaling Ethernet Main limitation: Broadcast –Spanning tree protocol messages –ARP queries High-level proposal: Distributed directory service –Each switch implements a directory service –Hosts register at each bridge –Directory is replicated –Queries answered locally …are there other ways to do this?