260 likes | 377 Vues
This lecture explores critical concepts in computer networking, focusing on how hosts communicate within a subnet, including Address Resolution Protocol (ARP), broadcasting methods, and interconnecting subnets with switches and bridges. Key topics include the differences between switches, hubs, and routers, as well as concepts like VLANs, self-learning bridges, and the Spanning Tree Protocol. The lecture also delves into the importance of filtering and forwarding in switches, the advantages of separate collision domains, and challenges such as latency and network configuration.
E N D
Interconnection: Switching and Bridging CS 4251: Computer Networking IINick FeamsterSpring 2008
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
frame frame Bootstrapping: Networks of Interfaces • LAN/Physical/MAC address • Flat structure • Unique to physical interface (no two alike)…how? datagram receiver link layer protocol sender adapter adapter • Frames can be sent to a specific MAC address or to the broadcast MAC address What are the advantages to separating network layer from MAC layer?
ARP: IP Addresses to MAC addresses • Query is IP address, response is MAC address • Query is sent to LAN’s 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
Life of a Packet: On a Subnet • Packet destined for outgoing IP address arrivesat 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
Interconnecting LANs • Receive & broadcast (“hub”) • Learning switches • Spanning tree (RSTP, MSTP, etc.) protocols
Interconnecting LANs with Hubs • All packets seen everywhere • Lots of flooding, chances for collision • Can’t interconnect LANs with heterogeneous media (e.g., Ethernets of different speeds) hub hub hub hub
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
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
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 switch collision domain hub hub hub collision domain collision domain
LAN B B A C LAN C LAN A Filtering and Forwarding • Occurs through switch table • Suppose a packet arrives destined for node with MAC address x from interface A • If MAC addressnot in table, flood (act like a hub) • If MAC addressmaps to A, do nothing (i.e. drop the packet - packet destined for same LAN segment) • If MAC address maps to another interface, forward • How does this table get configured?
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
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 (faster, but more errors are possible). • Need to learn where to forward frames • Bridge/switch needs to construct a forwarding table • Ideally, without intervention from network administrators (which creates overhead) • Solution:self-learning
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 B A C switch D
(Self)-Learning Bridges • Switch is initially empty • For eachincoming 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 B Switch learns how to reach A. A C D
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
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
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!
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 treedo not forward frames
Constructing a Spanning Tree • Elect a root • The switch with the smallest identifier • Each switch identifies if its interfaceis 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) i.e., • (Root-Distance-Node) • From node X • Claiming Y as root • Distance is d root One hop Three hops
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 distancefrom the root • Add 1 to the distance received from a neighbor • Identify interfaces not on a shortest path to the root and excludethose ports from the spanning tree
Example From Switch # 4’s Viewpoint 1 • 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 (lower id) • And realizes it is just one hop away • Switch #4 hears from #7 • Receives (2, 1, 7) from 7 • (i.e., 2 is the root, it’s 1 hop from “me”, I’m node 7.) • And realizes this is a longer path • because it adds 1 to the path from 7 – 2, wh/is already 1 hop, so 4-7-2 = 2 hops • So, prefers its own one-hop path (4-2 =1hop) • And removes 4-7 link from the tree 3 5 2 4 6 7
Robust Spanning Tree Algorithm • Algorithm must react to failures • Failure of the root node • Need to elect a new root, with the next lowest identifier • Failure of other switches and links • Need to recompute the spanning tree • Root switch continues sending messages • Periodically reannouncing itself as the root (1, 0, 1) • Other switches continue forwarding messages • Detecting failures through timeout • Switch waits to hear from others • Eventually times out and claims to be the root
Extension: Virtual LANs • Partition a single switched LAN into several virtual ones • Switched LANs do not scale well to large networks • Spanning tree algorithm has linear scaling behavior • Some frames are broadcast • Group users/hosts based on organizational structure, rather than physical location • Improve privacy and isolation • Exploit locality • Avoid physical rewiring • More in Lec. 12 (Plus, Network Layers as Link Layers)
Switches vs. Routers Switches • Switches are automatically configuring • Forwarding tends to be quite fast, since packets only need to be processed through layer 2 Routers • Router-level topologies are not restricted to a spanning tree • Can even have multipath routing
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?