56
Handout # 6: Interconnecting LANs; Internet Protocol (IP) Professor Yashar Ganjali Department of Computer Science University of Toronto [email protected] http://www.cs.toronto.edu/~ygan jali CSC 458/2209 – Computer Networks

Handout # 6: Interconnecting LANs; Internet Protocol (IP)

  • Upload
    suki

  • View
    22

  • Download
    0

Embed Size (px)

DESCRIPTION

Handout # 6: Interconnecting LANs; Internet Protocol (IP). CSC 458/2209 – Computer Networks. Professor Yashar Ganjali Department of Computer Science University of Toronto [email protected] http://www.cs.toronto.edu/~yganjali. Announcements. - PowerPoint PPT Presentation

Citation preview

Slide 1

Handout # 6: Interconnecting LANs; Internet Protocol (IP)Professor Yashar GanjaliDepartment of Computer ScienceUniversity of Toronto

[email protected]://www.cs.toronto.edu/~yganjaliCSC 458/2209 Computer Networks1CSC 458/CSC 2209 Computer Networks2University of Toronto Fall 2015AnnouncementsProblem Set 1 is posted on class web page.Problems from the textbookDue Friday Oct. 9th at 5pm. Remember the late submission policy.Submit electronically on MarkUS.https://markus.cdf.toronto.edu/csc458-2015-09/NOTE. File names must be: ps1.pdfYou can scan and save as a pdf file.Not preferred, but acceptable.

This weeks tutorial: sample problems

2Announcements ContdProgramming assignment 1Have you tested MiniNet?Have you been able to run your VM on CDF servers?Slides for the tutorial available on class web pageDue in about 3 weeksStart early! Start early! Start early!

Reading for next week: Chapter 3 of the textbook

TA office hours posted on class web siteCSC 458/CSC 2209 Computer Networks3University of Toronto Fall 20153CSC 458/CSC 2209 Computer Networks4University of Toronto Fall 2015The Story So far Layers, and protocolsLink layerMedia type, encodingFraming, link modelError detection, correction

This timeInterconnecting LANsHubs, switches, and bridgesThe Internet Protocol

PhysicalData LinkNetworkTransportSessionPresentationApplication4EthernetDominant wired LAN technology First widely used LAN technologySimpler, cheaper than token LANs and ATMKept up with speed race: 10 Mbps 10 Gbps CSC 458/CSC 2209 Computer Networks5University of Toronto Fall 2015

Metcalfes Ethernetsketch5Ethernet Uses CSMA/CDCarrier sense: wait for link to be idleChannel idle: start transmittingChannel busy: wait until idleCollision detection: listen while transmittingNo collision: transmission is completeCollision: abort transmission, and send jam signalRandom access: exponential back-offAfter collision, wait a random time before trying againAfter mth collision, choose K randomly from {0, , 2m-1} and wait for K*512 bit times before trying againCSC 458/CSC 2209 Computer Networks6University of Toronto Fall 20156Limitations on Ethernet LengthLatency depends on physical length of linkTime to propagate a packet from one end to the other Suppose A sends a packet at time tAnd B sees an idle line at a time just before t+d so B happily starts transmitting a packetB detects a collision, and sends jamming signalBut A doesnt see collision till t+2dCSC 458/CSC 2209 Computer Networks7University of Toronto Fall 2015

latency dAB7Limitations on Ethernet LengthA needs to wait for time 2d to detect collisionSo, A should keep transmitting during this period and keep an eye out for a possible collisionImposes restrictions on EthernetMaximum length of the wire: 2500 metersMinimum length of the packet: 512 bits (64 bytes)CSC 458/CSC 2209 Computer Networks8University of Toronto Fall 2015

latency dAB8Ethernet Frame StructureAddresses: source and destination MAC addresses Adaptor passes frame to network-level protocolIf destination address matches the adaptorOr the destination address is the broadcast addressOtherwise, adapter discards frameType: indicates the higher layer protocol Usually IPBut also Novell IPX, AppleTalk, CRC: cyclic redundancy checkChecked at receiverIf error is detected, the frame is simply dropped

CSC 458/CSC 2209 Computer Networks9University of Toronto Fall 2015

9Unreliable, Connectionless ServiceConnectionlessNo handshaking between sending and receiving adapter. UnreliableReceiving adapter doesnt send ACKs or NACKsPackets passed to network layer can have gapsGaps will be filled if application is using TCPOtherwise, the application will see the gapsCSC 458/CSC 2209 Computer Networks10University of Toronto Fall 201510Shuttling Data at Different LayersDifferent devices switch different thingsPhysical layer: electrical signals (repeaters and hubs)Link layer: frames (bridges and switches)Network layer: packets (routers)CSC 458/CSC 2209 Computer Networks11University of Toronto Fall 2015Application gatewayTransport gatewayRouter Bridge, switchRepeater, hubFrameheaderPacketheaderTCPheaderUserdata11Physical Layer: RepeatersDistance limitation in local-area networksElectrical signal becomes weaker as it travelsImposes a limit on the length of a LANRepeaters join LANs togetherAnalog electronic deviceContinuously monitors electrical signals on each LANTransmits an amplified copy

CSC 458/CSC 2209 Computer Networks12University of Toronto Fall 2015

12Physical Layer: HubsJoins multiple input lines electricallyDesigned to hold multiple line cardsDo not necessarily amplify the signalVery similar to repeatersAlso operates at the physical layerCSC 458/CSC 2209 Computer Networks13University of Toronto Fall 2015

hubhubhubhub13Limitations of Repeaters and HubsOne large collision domainEvery bit is sent everywhereSo, aggregate throughput is limitedE.g., three departments each get 10 Mbps independently and then connect via a hub and must share 10 MbpsCannot support multiple LAN technologiesDoes not buffer or interpret framesSo, cant interconnect between different rates or formatsE.g., 10 Mbps Ethernet and 100 Mbps EthernetLimitations on maximum nodes and distancesDoes not circumvent the limitations of shared mediaE.g., still cannot go beyond 2500 meters on EthernetCSC 458/CSC 2209 Computer Networks14University of Toronto Fall 201514Link Layer: BridgesConnects two or more LANs at the link layerExtracts destination address from the frameLooks up the destination in a tableForwards the frame to the appropriate LAN segmentEach segment is its own collision domain

CSC 458/CSC 2209 Computer Networks15University of Toronto Fall 2015hosthosthosthosthosthosthosthosthosthosthosthostBridge15Link Layer: SwitchesTypically connects individual computersA switch is essentially the same as a bridge though typically used to connect hosts, not LANsLike bridges, support concurrent communicationHost A can talk to C, while B talks to DCSC 458/CSC 2209 Computer Networks16University of Toronto Fall 2015

switchABCD16Dedicated Access and Full DuplexDedicated accessHost has direct connection to the switch rather than a shared LAN connectionFull duplexEach connection can send in both directionsHost sending to switch, and host receiving from switchE.g., in 10BaseT and 100Base TCompletely avoids collisionsEach connection is a bidirectional point-to-point linkNo need for carrier sense, collision detection, and so onCSC 458/CSC 2209 Computer Networks17University of Toronto Fall 201517Bridges/Switches: Traffic IsolationSwitch breaks subnet into LAN segmentsSwitch filters packetsFrame only forwarded to the necessary segments Segments become separate collision domainsCSC 458/CSC 2209 Computer Networks18University of Toronto Fall 2015

hubhubhubswitch/bridgecollision domaincollision domaincollision domain18CSC 458/CSC 2209 Computer Networks19University of Toronto Fall 2015Advantages Over Hubs/RepeatersOnly forwards frames as neededFilters frames to avoid unnecessary load on segmentsSends frames only to segments that need to see them Extends the geographic span of the networkSeparate collision domains allow longer distancesImproves privacy by limiting scope of framesHosts can snoop the traffic traversing their segment but not all the rest of the trafficApplies carrier sense and collision detectionDoes not transmit when the link is busyApplies exponential back-off after a collisionJoins segments using different technologies19CSC 458/CSC 2209 Computer Networks20University of Toronto Fall 2015Disadvantages Over Hubs/RepeatersDelay in forwarding framesBridge/switch must receive and parse the frame and perform a look-up to decide where to forwardStoring and forwarding the packet introduces delaySolution: cut-through switchingNeed to learn where to forward framesBridge/switch needs to construct a forwarding tableIdeally, without intervention from network administratorsSolution: self-learning Higher costMore complicated devices that cost more money20Motivation For Cut-Through SwitchingBuffering a frame takes timeSuppose L is the length of the frameAnd R is the transmission rate of the linksThen, receiving the frame takes L/R time unitsBuffering delay can be a high fraction of total delayPropagation delay is small over short distancesMaking buffering delay a large fraction of totalAnalogy: large group walking through NYC

CSC 458/CSC 2209 Computer Networks21University of Toronto Fall 2015

ABswitches21Cut-Through SwitchingStart transmitting as soon as possibleInspect the frame header and do the look-upIf outgoing link is idle, start forwarding the frameOverlapping transmissionsTransmit the head of the packet via the outgoing link while still receiving the tail via the incoming linkAnalogy: different folks crossing different intersections

CSC 458/CSC 2209 Computer Networks22University of Toronto Fall 2015

ABswitches22Motivation For Self LearningSwitches forward frames selectivelyForward frames only on segments that need themSwitch tableMaps destination MAC address to outgoing interfaceGoal: construct the switch table automaticallyCSC 458/CSC 2209 Computer Networks23University of Toronto Fall 2015

switchABCD23Self Learning: Building the TableWhen a frame arrivesInspect the source MAC addressAssociate the address with the incoming interfaceStore the mapping in the switch tableUse a time-to-live field to eventually forget the mapping

CSC 458/CSC 2209 Computer Networks24University of Toronto Fall 2015

ABCDSwitch learns how to reach A.24Self Learning: Handling MissesWhen frame arrives with unfamiliar destinationForward the frame out all of the interfaces except for the one where the frame arrivedHopefully, this case wont happen very oftenCSC 458/CSC 2209 Computer Networks25University of Toronto Fall 2015

ABCDWhen in doubt, shout!25Switch Filtering/ForwardingWhen switch receives a frame:

index switch table using MAC dest addressif entry found for destinationthen { if dest on segment from which frame arrived then drop the frame else forward the frame on interface indicated } else flood CSC 458/CSC 2209 Computer Networks26University of Toronto Fall 2015forward on all but the interface on which the frame arrived26Flooding Can Lead to LoopsSwitches sometimes need to broadcast framesUpon receiving a frame with an unfamiliar destinationUpon receiving a frame sent to the broadcast addressBroadcasting is implemented by floodingTransmitting frame out every interface except the one where the frame arrivedFlooding can lead to forwarding loopsE.g., if the network contains a cycle of switchesEither accidentally, or by design for higher reliabilityCSC 458/CSC 2209 Computer Networks27University of Toronto Fall 201527Solution: Spanning TreesEnsure the topology has no loopsAvoid using some of the links when flooding to avoid forming a loopSpanning treeSub-graph that covers all vertices but contains no cyclesLinks not in the spanning tree do not forward framesCSC 458/CSC 2209 Computer Networks28University of Toronto Fall 201528Constructing a Spanning TreeNeed a distributed algorithmSwitches cooperate to build the spanning tree and adapt automatically when failures occurKey ingredients of the algorithmSwitches need to elect a rootThe switch with the smallest identifierEach switch identifies if its interface is on the shortest path from the rootAnd exclude it from the tree if notMessages (Y, d, X)From node XClaiming Y is the rootAnd the distance is dCSC 458/CSC 2209 Computer Networks29University of Toronto Fall 2015rootOne hopThree hops29Steps in Spanning Tree AlgorithmInitially, each switch thinks it is the rootSwitch sends a message out every interface identifying itself as the root with distance 0Example: switch X announces (X, 0, X)Switches update their view of the rootUpon receiving a message, check the root idIf the new id is smaller, start viewing that switch as rootSwitches compute their distance from the rootAdd 1 to the distance received from a neighborIdentify interfaces not on a shortest path to the root and exclude them from the spanning treeCSC 458/CSC 2209 Computer Networks30University of Toronto Fall 201530Example From Switch #4s ViewpointSwitch #4 thinks it is the rootSends (4, 0, 4) message to 2 and 7Then, switch #4 hears from #2Receives (2, 0, 2) message from 2 and thinks that #2 is the rootAnd realizes it is just one hop awayThen, switch #4 hears from #7Receives (2, 1, 7) from 7And realizes this is a longer pathSo, prefers its own one-hop pathAnd removes 4-7 link from the treeCSC 458/CSC 2209 Computer Networks31University of Toronto Fall 2015123456731Example From Switch #4s ViewpointSwitch #2 hears about switch #1Switch 2 hears (1, 1, 3) from 3Switch 2 starts treating 1 as rootAnd sends (1, 2, 2) to neighborsSwitch #4 hears from switch #2Switch 4 starts treating 1 as rootAnd sends (1, 3, 4) to neighborsSwitch #4 hears from switch #7Switch 4 receives (1, 3, 7) from 7And realizes this is a longer pathSo, prefers its own three-hop pathAnd removes 4-7 Iink from the treeCSC 458/CSC 2209 Computer Networks32University of Toronto Fall 2015123456732Robust Spanning Tree AlgorithmAlgorithm must react to failuresFailure of the root nodeNeed to elect a new root, with the next lowest identifierFailure of other switches and linksNeed to recompute the spanning treeRoot switch continues sending messagesPeriodically reannouncing itself as the root (1, 0, 1)Other switches continue forwarding messagesDetecting failures through timeout (soft state!)Switch waits to hear from othersEventually times out and claims to be the root

CSC 458/CSC 2209 Computer Networks33University of Toronto Fall 2015See the textbook for details and another example33Switches vs. RoutersAdvantages of switches over routersPlug-and-playFast filtering and forwarding of framesNo pronunciation ambiguity (e.g., rooter vs. rowter)Disadvantages of switches over routersTopology is restricted to a spanning treeLarge networks require large ARP tablesBroadcast storms can cause the network to collapseCSC 458/CSC 2209 Computer Networks34University of Toronto Fall 201534Comparing Hubs, Switches, & RoutersCSC 458/CSC 2209 Computer Networks35University of Toronto Fall 2015 hubs routers switches traffic isolation no yes yes plug & play yes no yes optimal routing no yes no cut through yes no yes 35CSC 458/CSC 2209 Computer Networks36University of Toronto Fall 2015Part II The Internet Protocol (IP)IP: The Internet ProtocolService characteristicsThe IP Datagram formatIP addressesClassless Inter-Domain Routing (CIDR)An aside: Turning names into addresses (DNS)

36The Internet Protocol (IP)CSC 458/CSC 2209 Computer Networks37University of Toronto Fall 2015AppTransportNetworkLinkTCP / UDPIPDataHdrDataHdrTCP SegmentIP DatagramProtocol Stack37The Internet Protocol (IP)CSC 458/CSC 2209 Computer Networks38University of Toronto Fall 2015Characteristics of IP CONNECTIONLESS: mis-sequencing UNRELIABLE: may drop packets BEST EFFORT: but only if necessary DATAGRAM:individually routedAR1R2R4R3BSourceDestinationDHDHTransparent Architecture Links Topology38CSC 458/CSC 2209 Computer Networks39University of Toronto Fall 2015The IP DatagramFlagsversTTLTOSchecksumHLenTotal LengthIDFRAG OffsetProtocolSRC IP AddressDST IP Address(OPTIONS)(PAD)=1500bytes today. Try: traceroute F www.uwaterloo.ca 1500 andtraceroute F www.uwaterloo.ca 1501(DF=1 set in IP header; routers send ICMP error message, which is shown as !F).Bonus: Can you find a destination for which the path MTU < 1500 bytes?CSC 458/CSC 2209 Computer Networks41University of Toronto Fall 201541IP AddressesIP (Version 4) addresses are 32 bits longEvery interface has a unique IP address:A computer might have two or more IP addressesA router has many IP addressesIP addresses are hierarchicalThey contain a network ID and a host IDE.g. Apple computers addresses start with: 17.IP addresses are assigned statically or dynamically (e.g. DHCP)IP (Version 6) addresses are 128 bits longCSC 458/CSC 2209 Computer Networks42University of Toronto Fall 201542IP AddressesCSC 458/CSC 2209 Computer Networks43University of Toronto Fall 2015Originally there were 5 classes:CLASS A 170Net IDHost-IDCLASS B 10Net IDHost-ID2421416CLASS C 110Net IDHost-ID3218CLASS D 1110Multicast Group ID428CLASS E 11110Reserved527ABCD0232-143CSC 458/CSC 2209 Computer Networks44University of Toronto Fall 2015IP Addresses ExamplesClass A address:www.mit.edu18.7.22.83 (18 Class A)

Class B address:www.toronto.edu142.150.210.13 (128 ifconfig eth0 Link encap:Ethernet HWaddr 00:15:17:1C:85:30 inet addr:128.100.3.40 Bcast:128.100.3.255 Mask:ffffff00 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

Netmask ffffff00: the first 24 bits are the subnet ID, and the last 8 bits are the host ID.Can also be represented by a prefix + length, e.g. 128.100.3.0/24, or just 128.100.3/24.48Classless Inter-Domain Routing (CIDR) Addressing The IP address space is broken into line segments.Each line segment is described by a prefix.A prefix is of the form x/y where x indicates the prefix of all addresses in the line segment, and y indicates the length of the segment.E.g. The prefix 128.9/16 represents the line segment containing addresses in the range: 128.9.0.0 128.9.255.255.

CSC 458/CSC 2209 Computer Networks49University of Toronto Fall 20150232-1128.9/16128.9.0.0216142.12/1965/8128.9.16.1449CSC 458/CSC 2209 Computer Networks50University of Toronto Fall 2015Classless Inter-Domain Routing (CIDR) Addressing 0232-1128.9/16128.9.16.14128.9.16/20128.9.176/20128.9.19/24128.9.25/24Most specific route = longest matching prefix50CSC 458/CSC 2209 Computer Networks51University of Toronto Fall 2015Classless Inter-Domain Routing (CIDR) Addressing Prefix aggregation:If a service provider serves two organizations with prefixes, it can (sometimes) aggregate them to form a shorter prefix. Other routers can refer to this shorter prefix, and so reduce the size of their address table.E.g. ISP serves 128.9.14.0/24 and 128.9.15.0/24, it can tell other routers to send it all packets belonging to the prefix 128.9.14.0/23.ISP Choice:In principle, an organization can keep its prefix if it changes service providers. 51Detour: Map Computer Names to IP addressesThe Domain Naming System (DNS)Names are hierarchical and belong to a domain:e.g. apps0.cs.utoronto.caCommon domain names: .com, .edu, .gov, .org, .net, .ca (or other country-specific domain).Top-level names are assigned by the Internet Corporation for Assigned Names and Numbers (ICANN).A unique name is assigned to each organization.DNS Client-Server ModelDNS maintains a hierarchical, distributed database of names.Servers are arranged in a hierarchy.Each domain has a root server.An application needing an IP address is a DNS client.CSC 458/CSC 2209 Computer Networks52University of Toronto Fall 201552Mapping Computer Names to IP addressesThe Domain Naming System (DNS)A DNS QueryClient asks local server.If local server does not have address, it asks the root server of the requested domain.Addresses are cached in case they are requested again.

CSC 458/CSC 2209 Computer Networks53University of Toronto Fall 2015.stanford.edu.berkeley.edu.eecs.berkeley.edu.eduWhat is the IP address of www.eecs.berkeley.edu?

e.g. gethostbyname()ClientapplicationExample: On CDF machines, try host www.eecs.berkeley.edu53An Aside Error Reporting (ICMP) and tracerouteOn CDF machines try: traceroute www.google.comtraceroute to www.google.com (74.125.159.147), 30 hops max, 40 byte packets 1 butler.syslab.sandbox (192.168.70.100) 0.103 ms 0.092 ms 0.082 ms 2 foundry0.cs.toronto.edu (128.100.5.210) 2.146 ms 4.061 ms 5.977 ms 3 sf-cs1.gw.utoronto.ca (128.100.1.253) 2.184 ms 2.175 ms 2.168 ms 4 murus-gpb.gw.utoronto.ca (128.100.96.2) 2.146 ms 2.483 ms 3.037 ms 5 skye2murus-blue.gw.utoronto.ca (128.100.200.210) 7.088 ms 7.207 ms 7.198 ms 6 murus2skye-yellow.gw.utoronto.ca (128.100.200.217) 3.310 ms 11.325 ms 12.061 ms 7 ut-hub-utoronto-if.gtanet.ca (205.211.94.129) 12.681 ms 2.541 ms 2.535 ms 8 ORION-GTANET-RNE.DIST1-TORO.IP.orion.on.ca (66.97.23.57) 3.638 ms 4.391 ms 4.384 ms 9 BRDR2-TORO-GE2-1.IP.orion.on.ca (66.97.16.121) 4.368 ms 4.729 ms 4.844 ms10 74.125.51.233 (74.125.51.233) 12.459 ms 12.453 ms 12.808 ms11 216.239.47.114 (216.239.47.114) 4.681 ms 4.795 ms 12.661 ms12 209.85.250.111 (209.85.250.111) 23.666 ms 23.659 ms 13.226 ms13 209.85.242.215 (209.85.242.215) 32.436 ms 32.431 ms 32.913 ms14 72.14.232.213 (72.14.232.213) 33.537 ms 72.14.232.215 (72.14.232.215) 33.525 ms 72.14.232.213 (72.14.232.213) 164.315 ms15 209.85.254.14 (209.85.254.14) 45.864 ms 209.85.254.10 (209.85.254.10) 42.232 ms 209.85.254.6 (209.85.254.6) 42.346 ms16 yi-in-f147.google.com (74.125.159.147) 34.728 ms 34.727 ms 34.713 msCSC 458/CSC 2209 Computer Networks54University of Toronto Fall 201554An Aside Error Reporting (ICMP) and tracerouteInternet Control Message ProtocolUsed by a router/end-host to report some types of error:E.g. Destination Unreachable: packet cant be forwarded to/towards its destination. E.g. Time Exceeded: TTL reached zero, or fragment didnt arrive in time. traceroute uses this error to its advantage.An ICMP message is an IP datagram, and is sent back to the source of the packet that caused the error.CSC 458/CSC 2209 Computer Networks55University of Toronto Fall 201555SummaryShuttling data from one link to anotherBits, frames, packets, Repeaters/hubs, bridges/switches, routers, Key ideas in switchesCut-through switchingSelf learning of the switch tableSpanning treesInternet ProtocolAddresses, subnets, CIDRDNS, Traceroute, ICMPCSC 458/CSC 2209 Computer Networks56University of Toronto Fall 201556