Download presentation
Presentation is loading. Please wait.
Published byBertha Rodgers Modified over 9 years ago
1
Lecture 11: Switches Reading: Section 3.2 ? CMSC 23300/33300 Computer Networks http://dsl.cs.uchicago.edu/Courses/CMSC33300
2
2 Goals of Today’s Lecture l Devices that shuttle packets at different layers u Repeaters and hubs u Bridges and switches u Routers l Switch protocols and mechanisms u Dedicated access and full-duplex transfers u Cut-through switching u Self learning of the switch table u Spanning trees u Virtual LANs (VLANs)
3
3 Shuttling Data at Different Layers l Different devices switch different things u Physical layer: electrical signals (repeaters and hubs) u Link layer: frames (bridges and switches) u Network layer: packets (routers) Application gateway Transport gateway Router Bridge, switch Repeater, hub Frame header Packet header TCP header User data
4
4 Physical Layer: Repeaters l Distance limitation in local-area networks u Electrical signal becomes weaker as it travels u Imposes a limit on the length of a LAN l Repeaters join LANs together u Analog electronic device u Continuously monitors electrical signals on each LAN u Transmits an amplified copy
5
5 Physical Layer: Hubs l Joins multiple input lines electrically u Designed to hold multiple line cards u Do not necessarily amplify the signal l Very similar to repeaters u Also operate at the physical layer hub
6
6 Limitations of Repeaters and Hubs l One large collision domain u Every bit is sent everywhere u So, aggregate throughput is limited u E.g., three departments each get 10 Mbps independently u … and then connect via a hub and must share 10 Mbps l Cannot support multiple LAN technologies u Does not buffer or interpret frames u So, can’t interconnect between different rates or formats u E.g., 10 Mbps Ethernet and 100 Mbps Ethernet l Limitations on maximum nodes and distances u Does not circumvent the limitations of shared media u E.g., still cannot go beyond 2500 meters on Ethernet
7
7 Link Layer: Bridges l Connects two or more LANs at the link layer u Extracts destination address from the frame u Looks up the destination in a table u Forwards the frame to the appropriate LAN segment l Each segment is its own collision domain host Bridge
8
8 Link Layer: Switches l Typically connects individual computers u A switch is essentially the same as a bridge u … though typically used to connect hosts, not LANs l Like bridges, support concurrent communication u Host A can talk to C, while B talks to D switch A B C D
9
9 Dedicated Access and Full Duplex l Dedicated access u Host has direct connection to the switch u … rather than a shared LAN connection l Full duplex u Each connection can send in both directions u Host sending to switch, and host receiving from switch u E.g., in 10BaseT and 100Base T l Completely avoids collisions u Each connection is a bidirectional point-to-point link u No need for carrier sense, collision detection, and so on
10
10 Bridges/Switches: Traffic Isolation l Switch breaks subnet into LAN segments l Switch filters packets u Frame only forwarded to the necessary segments u Segments become separate collision domains hub switch/bridge collision domain
11
11 Advantages Over Hubs/Repeaters l Only forwards frames as needed u Filters frames to avoid unnecessary load on segments u Sends frames only to segments that need to see them l Extends the geographic span of the network u Separate collision domains allow longer distances l Improves privacy by limiting scope of frames u Hosts can “snoop” the traffic traversing their segment u … but not all the rest of the traffic l Applies carrier sense and collision detection u Does not transmit when the link is busy u Applies exponential back-off after a collision l Joins segments using different technologies
12
12 Disadvantages Over Hubs/Repeaters l Delay in forwarding frames u Bridge/switch must receive and parse the frame u … and perform a look-up to decide where to forward u Storing and forwarding the packet introduces delay u Solution: cut-through switching l Need to learn where to forward frames u Bridge/switch needs to construct a forwarding table u Ideally, without intervention from network administrators u Solution: self-learning l Higher cost u More complicated devices that cost more money
13
13 Motivation For Cut-Through Switching l Buffering a frame takes time u Suppose L is the length of the frame u And R is the transmission rate of the links u Then, receiving the frame takes L/R time units l Buffering delay can be a high fraction of total delay u Propagation delay is small over short distances u Making buffering delay a large fraction of total u Analogy: large group walking through NYC A B switches
14
14 Cut-Through Switching l Start transmitting as soon as possible u Inspect the frame header and do the look-up u If outgoing link is idle, start forwarding the frame l Overlapping transmissions u Transmit the head of the packet via the outgoing link u … while still receiving the tail via the incoming link u Analogy: different folks crossing different intersections A B switches
15
15 Motivation For Self Learning l Switches forward frames selectively u Forward frames only on segments that need them l Switch table u Maps destination MAC address to outgoing interface u Goal: construct the switch table automatically switch A B C D
16
16 Self Learning: Building the Table l When a frame arrives u Inspect the source MAC address u Associate the address with the incoming interface u Store the mapping in the switch table u Use a time-to-live field to eventually forget the mapping A B C D Switch learns how to reach A.
17
17 Self Learning: Handling Misses l When frame arrives with unfamiliar destination u Forward the frame out all of the interfaces u … except for the one where the frame arrived u Hopefully, this case won’t happen very often A B C D When in doubt, shout!
18
18 Switch Filtering/Forwarding When switch receives a frame: index switch table using MAC dest address if entry found for destination then{ if dest on segment from which frame arrived then drop the frame else forward the frame on interface indicated } else flood forward on all but the interface on which the frame arrived
19
19 Flooding Can Lead to Loops l Switches sometimes need to broadcast frames u Upon receiving a frame with an unfamiliar destination u Upon receiving a frame sent to the broadcast address l Broadcasting is implemented by flooding u Transmitting frame out every interface u … except the one where the frame arrived l Flooding can lead to forwarding loops u E.g., if the network contains a cycle of switches u Either accidentally, or by design for higher reliability
20
20 Solution: Spanning Trees l Ensure the topology has no loops u Avoid using some of the links when flooding u … to avoid forming a loop l Spanning tree u Sub-graph that covers all vertices but contains no cycles u Links not in the spanning tree do not forward frames
21
21 Constructing a Spanning Tree l Need a distributed algorithm u Switches cooperate to build the spanning tree u … and adapt automatically when failures occur l Key ingredients of the algorithm u Switches need to elect a “root” l The switch with the smallest identifier u Each switch determines if its interface is on the shortest path from the root l And excludes it from the tree if not u Messages (Y, d, X) l From node X l Claiming Y is the root l And the distance is d root One hop Three hops
22
22 Steps in Spanning Tree Algorithm l Initially, each switch thinks it is the root u Switch sends a message out every interface u … identifying itself as the root with distance 0 u Example: switch X announces (X, 0, X) l Switches update their view of the root u Upon receiving a message, check the root id u If the new id is smaller, start viewing that switch as root l Switches compute their distance from the root u Add 1 to the distance received from a neighbor u Identify interfaces not on a shortest path to the root u … and exclude them from the spanning tree
23
23 Example From Switch #4’s Viewpoint l Switch #4 thinks it is the root u Sends (4, 0, 4) message to 2 and 7 l Then, switch #4 hears from #2 u Receives (2, 0, 2) message from 2 u … and thinks that #2 is the root u And realizes it is just one hop away l Then, switch #4 hears from #7 u Receives (2, 1, 7) from 7 u And realizes this is a longer path u So, prefers its own one-hop path u And removes 4-7 link from the tree 1 2 3 4 5 6 7
24
24 Example From Switch #4’s Viewpoint l Switch #2 hears about switch #1 u Switch 2 hears (1, 1, 3) from 3 u Switch 2 starts treating 1 as root u And sends (1, 2, 2) to neighbors l Switch #4 hears from switch #2 u Switch 4 starts treating 1 as root u And sends (1, 3, 4) to neighbors l Switch #4 hears from switch #7 u Switch 4 receives (1, 3, 7) from 7 u And realizes this is a longer path u So, prefers its own three-hop path u And removes 4-7 Iink from the tree 1 2 3 4 5 6 7
25
25 Robust Spanning Tree Algorithm l Algorithm must react to failures u Failure of the root node l Need to elect a new root, with the next lowest identifier u Failure of other switches and links l Need to recompute the spanning tree l Root switch continues sending messages u Periodically re-announcing itself as the root (1, 0, 1) u Other switches continue forwarding messages l Detecting failures through timeout (soft state!) u Switch waits to hear from others u Eventually times out and claims to be the root See Section 3.2.2 in the textbook for details and another example
26
26 Evolution Toward Virtual LANs l In the olden days… u Thick cables snaked through cable ducts in buildings u Every computer they passed was plugged in u All people in adjacent offices were put on the same LAN u Independent of whether they belonged together or not l More recently… u Hubs and switches changed all that u Every office connected to central wiring closets u Often multiple LANs (k hubs) connected by switches u Flexibility in mapping offices to different LANs Group users based on organizational structure, rather than the physical layout of the building.
27
27 Why Group by Organizational Structure? l Security u Ethernet is a shared media u Any interface card can be put into “promiscuous” mode u … and get a copy of all of the traffic (e.g., midterm exam) u So, isolating traffic on separate LANs improves security l Load u Some LAN segments are more heavily used than others u E.g., researchers running experiments get out of hand u … can saturate their own segment and not the others u Plus, there may be natural locality of communication u E.g., traffic between people in the same research group
28
28 People Move, and Roles Change l Organizational changes are frequent u E.g., faculty office becomes a grad-student office u E.g., graduate student becomes a faculty member l Physical rewiring is a major pain u Requires unplugging the cable from one port u … and plugging it into another u … and hoping the cable is long enough to reach u … and hoping you don’t make a mistake l Would like to “rewire” the building in software u The resulting concept is a Virtual LAN (VLAN)
29
29 Example: Two Virtual LANs Red VLAN and Orange VLAN Bridges forward traffic as needed R RORORORO O RORO
30
30 Example: Two Virtual LANs Red VLAN and Orange VLAN Switches forward traffic as needed R O RORO R R R OOO RORRR O O O
31
31 Making VLANs Work l Bridges/switches need configuration tables u Saying which VLANs are accessible via which interfaces l Approaches to mapping to VLANs u Each interface has a VLAN color l Only works if all hosts on same segment belong to same VLAN u Each MAC address has a VLAN color l Useful when hosts on same segment belong to different VLANs l Useful when hosts move from one physical location to another l Changing the Ethernet header u Adding a field for a VLAN tag u Implemented on the bridges/switches u … but can still interoperate with old Ethernet cards
32
32 Moving From Switches to Routers l Advantages of switches over routers u Plug-and-play u Fast filtering and forwarding of frames u No pronunciation ambiguity (e.g., “rooter” vs. “rowter”) l Disadvantages of switches over routers u Topology is restricted to a spanning tree u Large networks require large ARP tables u Broadcast storms can cause the network to collapse
33
33 Comparing Hubs, Switches, & Routers
34
34 Conclusion l Shuttling data from one link to another u Bits, frames, packets, … u Repeaters/hubs, bridges/switches, routers, … l Key ideas in switches u Cut-through switching u Self learning of the switch table u Spanning trees u Virtual LANs (VLANs) l Next u Internet topology and routing
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.