Скачать презентацию Week 1 Introduction and Data Link Layer Week Скачать презентацию Week 1 Introduction and Data Link Layer Week

462f5ff8b1888ec99821c7dc152bf45e.ppt

  • Количество слайдов: 128

Week 1 Introduction and Data Link Layer Week 1 1 Week 1 Introduction and Data Link Layer Week 1 1

Layers r OSI reference model r Each layer communicates with its peer layer through Layers r OSI reference model r Each layer communicates with its peer layer through the use of a protocol r The communication between n and n-1 is known as an interface Week 1 2

Transmission Week 1 3 Transmission Week 1 3

Reception Week 1 4 Reception Week 1 4

Layers r Physical Layer m m m The physical later is concerned with transmitting Layers r Physical Layer m m m The physical later is concerned with transmitting raw bits over a communication channel. The design issues have to do with making sure that when one side sends a 1 bit, it is received by the other side as a 1 bit, not as a 0 bit. Typical questions here ar e how many volts should be used to represent a 1 and how many for a 0, how many microseconds a bit lasts, whether transmission may proceed simultaneously in both directions, how the initial connection is established and how it is torn down when both sides are finished, and how many pins the network connector has and what each pin is used for. The design issues here deal largely with mechanical, electrical, and procedural interfaces, and the physical transmission medium, which lies below the physical layer. Physical layer design can properly be considered to be within the domain of the electrical engineer. Examples: RS 232 C, X. 25, Ethernet Week 1 5

Layers r Data Link Layer m Sometimes called the link layer transmits chunks of Layers r Data Link Layer m Sometimes called the link layer transmits chunks of information across a link. m It deals with problems as checksumming to detect data corruption; coordinating the use of shared media as in LAN (Local Area Network); and addressing (when multiple systems are reachable as in a LAN) m It is common for different links to implement different data link layers and for a node to support several data link layer protocols, one for each of the types of links to which the node is attached. m Example: HDLC, SDLC, X. 25, Ethernet, ATM. Week 1 6

Layers r Network Layer m The network layer enables any pair of systems to Layers r Network Layer m The network layer enables any pair of systems to communicate with each other. m A fully connected network is one in which every pair of nodes has a direct link between its nodes, but this kind of topology does not scale beyond a few nodes m Network layer must find a path through a series of connected nodes and nodes along the path should forward packets in the appropriate direction. m The network layer deals with problems such as route calculation, packet assembly and reassembly (when different links on the path have different maximum packet sizes), and congestion control. m Examples: IP, IPX, ATM. Week 1 7

Layers r Transport Layer m This layer provides a reliable communications stream between a Layers r Transport Layer m This layer provides a reliable communications stream between a pair of systems m It deals with errors that can be introduced by the network layer, such as lost packets, duplicated packets, packet reordering, and fragmentation and reassembly m It is also nice if the transport layer reacts to congestion in the network m Example: TCP Week 1 8

Layers r Session Layer m The session layer assumes that a reliable virtual point-to-point Layers r Session Layer m The session layer assumes that a reliable virtual point-to-point connection has been made and contains specs for the dialog between the two end systems such as dialog discipline, data grouping, and recovery of an interrupted session. Specs are also included for initiating and concluding a session. Many network specs contain little or no session specs and leave these decisions to the applications. r Presentation Layer m Provides transformation of data to standardize the application interface. Also provides some network services such as encryption, compression, and text re-formatting. r Application Layer m This layer plays the same role as the 'application interface' in operating systems. Provides network services to users (applications) of the network in a distributed processing environment: examples transaction server, file transfer protocol, network management, electronic mail, and terminal access to remote applications. Week 1 9

PDUs and SDUs Application PSDU Presentation SSDU TSDU Application APDU Presentation Session SPDU Transport PDUs and SDUs Application PSDU Presentation SSDU TSDU Application APDU Presentation Session SPDU Transport NSDU Transport TPDU Network NPDU LSDU Data Link LPDU Ph. SDU Physical Ph. PDU Physical Week 1 10

Service Models r Layer n-1 can provide either a connectionless service or connectionoriented service Service Models r Layer n-1 can provide either a connectionless service or connectionoriented service m Communication -service consists of three phases in a CO • Connection setup • Data transfer • Connnection release m Associated functions: with each of these phases are two • Layer n initiates the function • Layer n-1 informs layer n that some layer n process in some other node is requesting a connection Week 1 11

Service Models r Services can vary in their degree of reliability m Datagram service Service Models r Services can vary in their degree of reliability m Datagram service (also known as best-effort) accepts data but makes no guarantees as to delivery in that data may be lost, duplicated, delivered out of order, or mangled. m A reliable service guarantees the data will be delivered in the order transmitted, without corrupting, duplication or loss. Week 1 12

Examples Service Connectionoriented Connectionless Datagram ATM IP, IPX, DECnet Reliable X. 25 • In Examples Service Connectionoriented Connectionless Datagram ATM IP, IPX, DECnet Reliable X. 25 • In the TCP/IP protocol suite, network layer is connectionless, TCP offers reliable connection-oriented service, UDPs datagram service • ATM offers a connection-oriented, unreliable service that can be viewed as a network layer. For IP over ATM, ATM is viewed by IP as a a data link layer • It’s good to know about layering but it should not be taken that seriously; however it is a good learning and Week 1 communication tool. 13

Internet protocol stack r application: supporting network applications m ftp, smtp, http r transport: Internet protocol stack r application: supporting network applications m ftp, smtp, http r transport: host-host data transfer m tcp, udp r network: routing of datagrams from source to destination m ip, routing protocols r link: data transfer between application transport network link physical neighboring network elements m ppp, ethernet r physical: bits “on the wire” Week 1 14

TCP/IP Stack Application Presentation OSI Reference Model Session Transport Application TCP IP Transport TCP, TCP/IP Stack Application Presentation OSI Reference Model Session Transport Application TCP IP Transport TCP, UDP Stack Network Internet Data Link Physical Week 1 15

Layering: logical communication Each layer: r Distributed “entities” implement layer functions at each node Layering: logical communication Each layer: r Distributed “entities” implement layer functions at each node r entities perform actions, exchange messages with peers application transport network link physical application transport network link physical Week 1 16

Layering: logical communication E. g. : transport r take data from app r addressing, Layering: logical communication E. g. : transport r take data from app r addressing, reliability check info to form “datagram” r send datagram to peer r wait for peer to ack receipt data application transport network link physical ack data network link physical application transport network link physical data application transport network link physical Week 1 17

Protocol layering and data Each layer takes data from above r adds header information Protocol layering and data Each layer takes data from above r adds header information to create new data unit r passes new data unit to layer below source M Ht M Hn Ht M Hl Hn Ht M application transport network link physical destination application Ht transport Hn Ht network Hl Hn Ht link physical M message M segment M datagram M frame Week 1 18

Internet structure: network of networks r roughly hierarchical r national/international local ISP backbone providers Internet structure: network of networks r roughly hierarchical r national/international local ISP backbone providers (NBPs) m m e. g. BBN/GTE, Sprint, AT&T, IBM, UUNet interconnect (peer) with each other privately, or at public Network Access Point (NAPs) r regional ISPs m connect into NBPs r local ISP, company m connect into regional ISPs regional ISP NBP B NAP NBP A regional ISP local ISP Week 1 19

Tiered Networks r A Tier 1 Network is an IP network which connects to Tiered Networks r A Tier 1 Network is an IP network which connects to the entire Internet solely via Settlement Free Interconnection, commonly known as peering. m Tier 1 - A network that peers with every other network to reach the Internet. m Tier 2 - A network that peers with some networks, but still purchases IP transit to reach at least some portion of the Internet. m Tier 3 - A network that solely purchases transit from other networks to reach the Internet. Week 1 20

Routing r In commercial network routing between autonomous systems, hot-potato routing is the practice Routing r In commercial network routing between autonomous systems, hot-potato routing is the practice of passing traffic off to another AS as quickly as possible, thus using their network for wide-area transit. r Cold-potato routing is the opposite, where the originating AS holds onto the packet until it is as near to the destination as possible. Week 1 21

Global Backbone Provider Week 1 22 Global Backbone Provider Week 1 22

Important Properties of a Network r Scope - A network architecture should solve as Important Properties of a Network r Scope - A network architecture should solve as general a problem as possible r Scalability - Would work well with very large networks and be also efficient with small networks r Robustness: The network should continue to operate even if nodes or links fail m m m Safety barriers: A fault does not spread beyond a safety barrier, for example a router confines a broadcast storm to a single LAN Self-stabilization: After a failure, the network will return to normal operation without human intervention within a reasonable time, e. g. , routing protocols Fault detection r Autoconfigurability r Tweakability r Migration Week 1 23

How r A new network How r A new network "philosophy and architecture, " is replacing the vision of an Intelligent Network. The vision is one in which the public communications network would be engineered for "always-on" use, not intermittence and scarcity. It would be engineered for intelligence at the end-user's device, not in the network. r And the network would be engineered simply to "Deliver the Bits" not for fancy network routing Fundamentally, it would be a Stupid Network. r In the Stupid Network, the data would tell the network where it needs to go. (In contrast, in a circuit network, the network tells the data where to go. ) In a Stupid Network, the data on it would be the boss. Week 1 24

Scope of this Course r We will study how a packet finds its way Scope of this Course r We will study how a packet finds its way from a source to a destination m Role of Layer 2 • Ethernet, PPP, 802. 11 m Role of Layer 3 • IP Addressing • Routing • OSPF, BGP m Internet architecture r We will also study emerging trends in IP networks m IP Qo. S m MPLS (Multiprotocol Label Switching) m Traffic Engineering m Multimedia networking Week 1 25

The Data Link Layer Our goals: r understand principles behind data link layer services: The Data Link Layer Our goals: r understand principles behind data link layer services: m m error detection, correction sharing a broadcast channel: multiple access link layer addressing reliable data transfer, flow control: r instantiation and implementation of various link layer technologies Week 1 26

Link Layer r 5. 1 Introduction and r r services 5. 2 Error detection Link Layer r 5. 1 Introduction and r r services 5. 2 Error detection and correction 5. 3 Multiple access protocols 5. 4 Link-Layer Addressing 5. 5 Ethernet r 5. 6 Hubs and switches r 5. 7 PPP r 5. 8 Link Virtualization: ATM and MPLS Week 1 27

Link Layer: Introduction Some terminology: “link” r hosts and routers are nodes r communication Link Layer: Introduction Some terminology: “link” r hosts and routers are nodes r communication channels that connect adjacent nodes along communication path are links m m m wired links wireless links LANs r layer-2 packet is a frame, encapsulates datagram data-link layer has responsibility of transferring datagram from one node to adjacent node over a link Week 1 28

Link layer: context r Datagram transferred by different link protocols over different links: m Link layer: context r Datagram transferred by different link protocols over different links: m e. g. , Ethernet on first link, frame relay on intermediate links, 802. 11 on last link r Each link protocol provides different services m e. g. , may or may not provide reliable data transfer over link transportation analogy r trip from Princeton to Lausanne m limo: Princeton to JFK m plane: JFK to Geneva m train: Geneva to Lausanne r tourist = datagram r transport segment = communication link r transportation mode = link layer protocol r travel agent = routing algorithm Week 1 29

Link Layer Services r Framing, link access: m encapsulate datagram into frame, adding header, Link Layer Services r Framing, link access: m encapsulate datagram into frame, adding header, trailer m channel access if shared medium m “MAC” addresses used in frame headers to identify source, dest • different from IP address! r Reliable delivery between adjacent nodes m seldom used on low bit error link (fiber, some twisted pair) m wireless links: high error rates • Q: why both link-level and end-end reliability? Week 1 30

Link Layer Services (more) r Flow Control: m pacing between adjacent sending and receiving Link Layer Services (more) r Flow Control: m pacing between adjacent sending and receiving nodes r Error Detection: m errors caused by signal attenuation, noise. m receiver detects presence of errors: • signals sender for retransmission or drops frame r Error Correction: m receiver identifies and corrects bit error(s) without resorting to retransmission r Half-duplex and full-duplex m with half duplex, nodes at both ends of link can transmit, but not at same time Week 1 31

Adaptors Communicating datagram sending node rcving node link layer protocol frame adapter r link Adaptors Communicating datagram sending node rcving node link layer protocol frame adapter r link layer implemented in r receiving side “adaptor” (aka NIC) m looks for errors, rdt, flow control, etc m Ethernet card, PCMCI m extracts datagram, passes card, 802. 11 card to rcving node r sending side: m m encapsulates datagram in a frame adds error checking bits, rdt, flow control, etc. r adapter is semi- autonomous r link & physical layers Week 1 32

Link Layer r 5. 1 Introduction and r r services 5. 2 Error detection Link Layer r 5. 1 Introduction and r r services 5. 2 Error detection and correction 5. 3 Multiple access protocols 5. 4 Link-Layer Addressing 5. 5 Ethernet r 5. 6 Hubs and switches r 5. 7 PPP r 5. 8 Link Virtualization: ATM Week 1 33

Error Detection EDC= Error Detection and Correction bits (redundancy) D = Data protected by Error Detection EDC= Error Detection and Correction bits (redundancy) D = Data protected by error checking, may include header fields • Error detection not 100% reliable! • protocol may miss some errors, but rarely • larger EDC field yields better detection and correction Week 1 34

Parity Checking Single Bit Parity: Detect single bit errors Two Dimensional Bit Parity: Detect Parity Checking Single Bit Parity: Detect single bit errors Two Dimensional Bit Parity: Detect and correct single bit errors 0 0 Week 1 35

Checksumming: Cyclic Redundancy Check r view data bits, D, as a binary number r Checksumming: Cyclic Redundancy Check r view data bits, D, as a binary number r choose r+1 bit pattern (generator), G r goal: choose r CRC bits, R, such that m m m exactly divisible by G (modulo 2) receiver knows G, divides by G. If non-zero remainder: error detected! can detect all burst errors less than r+1 bits r widely used in practice (ATM, HDCL) Week 1 36

CRC Example Want: D. 2 r XOR R = n. G equivalently: D. 2 CRC Example Want: D. 2 r XOR R = n. G equivalently: D. 2 r = n. G XOR R equivalently: if we divide D. 2 r by G, want remainder R R = remainder[ D. 2 r G ] Week 1 37

Link Layer r 5. 1 Introduction and r r services 5. 2 Error detection Link Layer r 5. 1 Introduction and r r services 5. 2 Error detection and correction 5. 3 Multiple access protocols 5. 4 Link-Layer Addressing 5. 5 Ethernet r 5. 6 Hubs and switches r 5. 7 PPP r 5. 8 Link Virtualization: ATM Week 1 38

Multiple Access Links and Protocols Two types of “links”: r point-to-point m PPP for Multiple Access Links and Protocols Two types of “links”: r point-to-point m PPP for dial-up access m point-to-point link between Ethernet switch and host r broadcast (shared wire or medium) m traditional Ethernet m upstream HFC m 802. 11 wireless LAN Week 1 39

Multiple Access protocols r single shared broadcast channel r two or more simultaneous transmissions Multiple Access protocols r single shared broadcast channel r two or more simultaneous transmissions by nodes: interference m collision if node receives two or more signals at the same time multiple access protocol r distributed algorithm that determines how nodes share channel, i. e. , determine when node can transmit r communication about channel sharing must use channel itself! m no out-of-band channel for coordination Week 1 40

Ideal Mulitple Access Protocol Broadcast channel of rate R bps 1. When one node Ideal Mulitple Access Protocol Broadcast channel of rate R bps 1. When one node wants to transmit, it can send at rate R. 2. When M nodes want to transmit, each can send at average rate R/M 3. Fully decentralized: m m no special node to coordinate transmissions no synchronization of clocks, slots 4. Simple Week 1 41

MAC Protocols: a taxonomy Three broad classes: r Channel Partitioning m m divide channel MAC Protocols: a taxonomy Three broad classes: r Channel Partitioning m m divide channel into smaller “pieces” (time slots, frequency, code) allocate piece to node for exclusive use r Random Access m channel not divided, allow collisions m “recover” from collisions r “Taking turns” m Nodes take turns, but nodes with more to send can take longer turns Week 1 42

Channel Partitioning MAC protocols: TDMA: time division multiple access r access to channel in Channel Partitioning MAC protocols: TDMA: time division multiple access r access to channel in "rounds" r each station gets fixed length slot (length = pkt trans time) in each round r unused slots go idle r example: 6 -station LAN, 1, 3, 4 have pkt, slots 2, 5, 6 idle Week 1 43

Channel Partitioning MAC protocols: FDMA: frequency division multiple access r channel spectrum divided into Channel Partitioning MAC protocols: FDMA: frequency division multiple access r channel spectrum divided into frequency bands r each station assigned fixed frequency band r unused transmission time in frequency bands go idle r example: 6 -station LAN, 1, 3, 4 have pkt, frequency bands 2, 5, 6 idle frequency bands time Week 1 44

Random Access Protocols r When node has packet to send m transmit at full Random Access Protocols r When node has packet to send m transmit at full channel data rate R. m no a priori coordination among nodes r two or more transmitting nodes ➜ “collision”, r random access MAC protocol specifies: m how to detect collisions m how to recover from collisions (e. g. , via delayed retransmissions) r Examples of random access MAC protocols: m slotted ALOHA m CSMA, CSMA/CD, CSMA/CA Week 1 45

Slotted ALOHA Assumptions r all frames same size r time is divided into equal Slotted ALOHA Assumptions r all frames same size r time is divided into equal size slots, time to transmit 1 frame r nodes start to transmit frames only at beginning of slots r nodes are synchronized r if 2 or more nodes transmit in slot, all nodes detect collision Operation r when node obtains fresh frame, it transmits in next slot r no collision, node can send new frame in next slot r if collision, node retransmits frame in each subsequent slot with prob. p until success Week 1 46

Slotted ALOHA Pros r single active node can continuously transmit at full rate of Slotted ALOHA Pros r single active node can continuously transmit at full rate of channel r highly decentralized: only slots in nodes need to be in sync r simple Cons r collisions, wasting slots r idle slots r nodes may be able to detect collision in less than time to transmit packet r clock synchronization Week 1 47

Slotted Aloha efficiency Efficiency is the long-run fraction of successful slots when there are Slotted Aloha efficiency Efficiency is the long-run fraction of successful slots when there are many nodes, each with many frames to send r Suppose N nodes with many frames to send, each transmits in slot with probability p r prob that node 1 has success in a slot = p(1 -p)N-1 r prob that any node has a success = Np(1 -p)N-1 r For max efficiency with N nodes, find p* that maximizes Np(1 -p)N-1 r For many nodes, take limit of Np*(1 -p*)N-1 as N goes to infinity, gives 1/e =. 37 At best: channel used for useful transmissions 37% of time! Week 1 48

CSMA (Carrier Sense Multiple Access) CSMA: listen before transmit: If channel sensed idle: transmit CSMA (Carrier Sense Multiple Access) CSMA: listen before transmit: If channel sensed idle: transmit entire frame r If channel sensed busy, defer transmission r Human analogy: don’t interrupt others! Week 1 49

CSMA collisions spatial layout of nodes collisions can still occur: propagation delay means two CSMA collisions spatial layout of nodes collisions can still occur: propagation delay means two nodes may not hear each other’s transmission collision: entire packet transmission time wasted note: role of distance & propagation delay in determining collision probability Week 1 50

CSMA/CD (Collision Detection) CSMA/CD: carrier sensing, deferral as in CSMA m collisions detected within CSMA/CD (Collision Detection) CSMA/CD: carrier sensing, deferral as in CSMA m collisions detected within short time m colliding transmissions aborted, reducing channel wastage r collision detection: m easy in wired LANs: measure signal strengths, compare transmitted, received signals m difficult in wireless LANs: receiver shut off while transmitting r human analogy: the polite conversationalist Week 1 51

CSMA/CD collision detection Week 1 52 CSMA/CD collision detection Week 1 52

“Taking Turns” MAC protocols channel partitioning MAC protocols: m share channel efficiently and fairly “Taking Turns” MAC protocols channel partitioning MAC protocols: m share channel efficiently and fairly at high load m inefficient at low load: delay in channel access, 1/N bandwidth allocated even if only 1 active node! Random access MAC protocols m efficient at low load: single node can fully utilize channel m high load: collision overhead “taking turns” protocols look for best of both worlds! Week 1 53

“Taking Turns” MAC protocols Token passing: Polling: r control token passed from r master “Taking Turns” MAC protocols Token passing: Polling: r control token passed from r master node one node to next “invites” slave nodes sequentially. to transmit in turn r token message r concerns: m polling overhead m m latency single point of failure (master) m m m token overhead latency single point of failure (token) Week 1 54

Summary of MAC protocols r What do you do with a shared media? m Summary of MAC protocols r What do you do with a shared media? m Channel Partitioning, by time, frequency or code • Time Division, Frequency Division m Random partitioning (dynamic), • ALOHA, S-ALOHA, CSMA/CD • carrier sensing: easy in some technologies (wire), hard in others (wireless) • CSMA/CD used in Ethernet • CSMA/CA used in 802. 11 m Taking Turns • polling from a central site, token passing Week 1 55

LAN technologies Data link layer so far: m services, access error detection/correction, multiple Next: LAN technologies Data link layer so far: m services, access error detection/correction, multiple Next: LAN technologies m addressing m Ethernet m hubs, switches m PPP Week 1 56

Link Layer r 5. 1 Introduction and r r services 5. 2 Error detection Link Layer r 5. 1 Introduction and r r services 5. 2 Error detection and correction 5. 3 Multiple access protocols 5. 4 Link-Layer Addressing 5. 5 Ethernet r 5. 6 Hubs and switches r 5. 7 PPP r 5. 8 Link Virtualization: ATM Week 1 57

MAC Addresses and ARP r 32 -bit IP address: m network-layer address m used MAC Addresses and ARP r 32 -bit IP address: m network-layer address m used to get datagram to destination IP subnet r MAC (or LAN or physical or Ethernet) address: m used to get datagram from one interface to another physically-connected interface (same network) m 48 bit MAC address (for most LANs) burned in the adapter ROM Week 1 58

LAN Addresses and ARP Each adapter on LAN has unique LAN address 1 A-2 LAN Addresses and ARP Each adapter on LAN has unique LAN address 1 A-2 F-BB-76 -09 -AD 71 -65 -F 7 -2 B-08 -53 LAN (wired or wireless) Broadcast address = FF-FF-FF-FF = adapter 58 -23 -D 7 -FA-20 -B 0 0 C-C 4 -11 -6 F-E 3 -98 Week 1 59

LAN Address (more) r MAC address allocation administered by IEEE r manufacturer buys portion LAN Address (more) r MAC address allocation administered by IEEE r manufacturer buys portion of MAC address space (to assure uniqueness) r Analogy: (a) MAC address: like Social Security Number (b) IP address: like postal address r MAC flat address ➜ portability m can move LAN card from one LAN to another r IP hierarchical address NOT portable m depends on IP subnet to which node is attached Week 1 60

ARP: Address Resolution Protocol Question: how to determine MAC address of B knowing B’s ARP: Address Resolution Protocol Question: how to determine MAC address of B knowing B’s IP address? 237. 196. 7. 78 1 A-2 F-BB-76 -09 -AD 237. 196. 7. 23 r Each IP node (Host, Router) on LAN has ARP table r ARP Table: IP/MAC address mappings for some LAN nodes 237. 196. 7. 14 m LAN 71 -65 -F 7 -2 B-08 -53 237. 196. 7. 88 < IP address; MAC address; TTL> 58 -23 -D 7 -FA-20 -B 0 TTL (Time To Live): time after which address mapping will be forgotten (typically 20 min) 0 C-C 4 -11 -6 F-E 3 -98 Week 1 61

ARP protocol: Same LAN (network) r A wants to send datagram to B, and ARP protocol: Same LAN (network) r A wants to send datagram to B, and B’s MAC address not in A’s ARP table. r A broadcasts ARP query packet, containing B's IP address m Dest MAC address = FFFF-FF-FF m all machines on LAN receive ARP query r B receives ARP packet, replies to A with its (B's) MAC address m frame sent to A’s MAC address (unicast) r A caches (saves) IP-to- MAC address pair in its ARP table until information becomes old (times out) m soft state: information that times out (goes away) unless refreshed r ARP is “plug-and-play”: m nodes create their ARP tables without intervention from net administrator Week 1 62

Routing to another LAN walkthrough: send datagram from A to B via R assume Routing to another LAN walkthrough: send datagram from A to B via R assume A know’s B IP address A R B r Two ARP tables in router R, one for each IP network (LAN) Week 1 63

r A creates datagram with source A, destination B r A uses ARP to r A creates datagram with source A, destination B r A uses ARP to get R’s MAC address for 111. 110 r A creates link-layer frame with R's MAC address as dest, r r r frame contains A-to-B IP datagram A’s adapter sends frame R’s adapter receives frame R removes IP datagram from Ethernet frame, sees its destined to B R uses ARP to get B’s MAC address R creates frame containing A-to-B IP datagram sends to B A R B Week 1 64

Link Layer r 5. 1 Introduction and r r services 5. 2 Error detection Link Layer r 5. 1 Introduction and r r services 5. 2 Error detection and correction 5. 3 Multiple access protocols 5. 4 Link-Layer Addressing 5. 5 Ethernet r 5. 6 Hubs and switches r 5. 7 PPP r 5. 8 Link Virtualization: ATM Week 1 65

Ethernet “dominant” wired LAN technology: r cheap $20 for 100 Mbs! r first widely Ethernet “dominant” wired LAN technology: r cheap $20 for 100 Mbs! r first widely used LAN technology r Simpler, cheaper than token LANs and ATM r Kept up with speed race: 10 Mbps – 10 Gbps Metcalfe’s Ethernet sketch Week 1 66

Star topology r Bus topology popular through mid 90 s r Now star topology Star topology r Bus topology popular through mid 90 s r Now star topology prevails r Connection choices: hub or switch (more later) hub or switch Week 1 67

Ethernet Frame Structure Sending adapter encapsulates IP datagram (or other network layer protocol packet) Ethernet Frame Structure Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame Preamble: r 7 bytes with pattern 1010 followed by one byte with pattern 10101011 r used to synchronize receiver, sender clock rates Week 1 68

Ethernet Frame Structure (more) r Addresses: 6 bytes m if adapter receives frame with Ethernet Frame Structure (more) r Addresses: 6 bytes m if adapter receives frame with matching destination address, or with broadcast address (eg ARP packet), it passes data in frame to net-layer protocol m otherwise, adapter discards frame r Type: indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and Apple. Talk) r CRC: checked at receiver, if error is detected, the frame is simply dropped Week 1 69

Unreliable, connectionless service r Connectionless: No handshaking between sending and receiving adapter. r Unreliable: Unreliable, connectionless service r Connectionless: No handshaking between sending and receiving adapter. r Unreliable: receiving adapter doesn’t send acks or nacks to sending adapter m m m stream of datagrams passed to network layer can have gaps will be filled if app is using TCP otherwise, app will see the gaps Week 1 70

Ethernet uses CSMA/CD r No slots r adapter doesn’t transmit if it senses that Ethernet uses CSMA/CD r No slots r adapter doesn’t transmit if it senses that some other adapter is transmitting, that is, carrier sense r transmitting adapter aborts when it senses that another adapter is transmitting, that is, collision detection r Before attempting a retransmission, adapter waits a random time, that is, random access Week 1 71

Ethernet CSMA/CD algorithm 1. Adaptor receives datagram 4. If adapter detects from net layer Ethernet CSMA/CD algorithm 1. Adaptor receives datagram 4. If adapter detects from net layer & creates another transmission while frame transmitting, aborts and sends jam signal 2. If adapter senses channel idle, it starts to transmit 5. After aborting, adapter frame. If it senses enters exponential channel busy, waits until backoff: after the mth channel idle and then collision, adapter chooses transmits a K at random from {0, 1, 2, …, 2 m-1}. Adapter 3. If adapter transmits waits K·512 bit times and entire frame without returns to Step 2 detecting another transmission, the adapter is done with frame ! Week 1 72

Ethernet’s CSMA/CD (more) Jam Signal: make sure all other transmitters are aware of collision; Ethernet’s CSMA/CD (more) Jam Signal: make sure all other transmitters are aware of collision; 48 bits Bit time: . 1 microsec for 10 Mbps Ethernet ; for K=1023, wait time is about 50 msec Exponential Backoff: r Goal: adapt retransmission attempts to estimated current load m heavy load: random wait will be longer r first collision: choose K from {0, 1}; delay is K· 512 bit transmission times r after second collision: choose K from {0, 1, 2, 3}… r after ten collisions, choose K from {0, 1, 2, 3, 4, …, 1023} Week 1 73

CSMA/CD efficiency r Tprop = max prop between 2 nodes in LAN r ttrans CSMA/CD efficiency r Tprop = max prop between 2 nodes in LAN r ttrans = time to transmit max-size frame r Efficiency goes to 1 as tprop goes to 0 r Goes to 1 as ttrans goes to infinity r Much better than ALOHA, but still decentralized, simple, and cheap Week 1 74

Link Layer r 5. 1 Introduction and r r services 5. 2 Error detection Link Layer r 5. 1 Introduction and r r services 5. 2 Error detection and correction 5. 3 Multiple access protocols 5. 4 Link-Layer Addressing 5. 5 Ethernet r 5. 6 Interconnections: Hubs and switches r 5. 7 PPP r 5. 8 Link Virtualization: ATM Week 1 75

Hubs are essentially physical-layer repeaters: m bits coming from one link go out all Hubs are essentially physical-layer repeaters: m bits coming from one link go out all other links m at the same rate m no frame buffering m no CSMA/CD at hub: adapters detect collisions m provides net management functionality twisted pair hub Week 1 76

Interconnecting with hubs r Backbone hub interconnects LAN segments r Extends max distance between Interconnecting with hubs r Backbone hub interconnects LAN segments r Extends max distance between nodes r But individual segment collision domains become one large collision domain r Can’t interconnect 10 Base. T & 100 Base. T hub hub Week 1 77

Switch r Link layer device m stores and forwards Ethernet frames m examines frame Switch r Link layer device m stores and forwards Ethernet frames m examines frame header and selectively forwards frame based on MAC dest address m when frame is to be forwarded on segment, uses CSMA/CD to access segment r transparent m hosts are unaware of presence of switches r plug-and-play, self-learning m switches do not need to be configured Week 1 78

Forwarding switch 1 2 hub 3 hub • How do determine onto which LAN Forwarding switch 1 2 hub 3 hub • How do determine onto which LAN segment to forward frame? • Looks like a routing problem. . . Week 1 79

Self learning r A switch has a switch table r entry in switch table: Self learning r A switch has a switch table r entry in switch table: m (MAC Address, Interface, Time Stamp) m stale entries in table dropped (TTL can be 60 min) r switch learns which hosts can be reached through which interfaces m when frame received, switch “learns” location of sender: incoming LAN segment m records sender/location pair in switch table Week 1 80

Filtering/Forwarding When switch receives a frame: index switch table using MAC dest address if 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 Week 1 81

Switch example Suppose C sends frame to D 1 2 B C hub 1 Switch example Suppose C sends frame to D 1 2 B C hub 1 1 2 3 A B E G 3 hub A address interface switch I D E F G H r Switch receives frame from C m notes in bridge table that C is on interface 1 m because D is not in table, switch forwards frame into interfaces 2 and 3 r frame received by D Week 1 82

Switch example Suppose D replies back with frame to C. address interface switch B Switch example Suppose D replies back with frame to C. address interface switch B C hub hub A I D E F G A B E G C 1 1 2 3 1 H r Switch receives frame from D m notes in bridge table that D is on interface 2 m because C is in table, switch forwards frame only to interface 1 r frame received by C Week 1 83

Switch: traffic isolation r switch installation breaks subnet into LAN segments r switch filters Switch: traffic isolation r switch installation breaks subnet into LAN segments r switch filters packets: m same-LAN-segment frames not usually forwarded onto other LAN segments m segments become separate collision domains switch collision domain hub Week 1 84

Switches: dedicated access r Switch with many interfaces r Hosts have direct connection to Switches: dedicated access r Switch with many interfaces r Hosts have direct connection to switch r No collisions; full duplex Switching: A-to-A’ and B-to-B’ simultaneously, no collisions A C’ B switch C B’ A’ Week 1 85

More on Switches r cut-through switching: frame forwarded from input to output port without More on Switches r cut-through switching: frame forwarded from input to output port without first collecting entire frame m slight reduction in latency r combinations of shared/dedicated, 10/1000 Mbps interfaces Week 1 86

Institutional network to external network mail server web server router switch IP subnet hub Institutional network to external network mail server web server router switch IP subnet hub hub Week 1 87

How does the IP router different from an Ethernet switch? IP Router Host C How does the IP router different from an Ethernet switch? IP Router Host C PCs with Ethernet Network Interface Cards (NICs) An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries Week 1 88

IP Router vs Ethernet Switch Week 1 89 IP Router vs Ethernet Switch Week 1 89

Difference between Ethernet switch and IP router r Data plane - as packets arrive Difference between Ethernet switch and IP router r Data plane - as packets arrive m Ethernet switch • Exact match of destination MAC address of incoming packet with destination column entry in routing table • If there is no match, flood packet to all ports in the forwarding state m IP router • Longest-prefix match - notion of subnet mask • Default entry match • If no default entry, drop packet Week 1 90

Difference between Ethernet switch and IP router r Data plane - as packets arrive Difference between Ethernet switch and IP router r Data plane - as packets arrive m Ethernet switch • Does not change MAC header m IP router • Fields in the IP header are changed, such as TTL Week 1 91

Difference between Ethernet switch and IP router r Addressing m Ethernet switch • Flat Difference between Ethernet switch and IP router r Addressing m Ethernet switch • Flat 6 -byte addressing • Routing tables will be very large because of flat addressing m IP router • Hierarchical 4 -byte (IPv 4) and 16 -byte (IPv 6) • Advantage: address summarization used to decrease the number of entries in the routing table Week 1 92

Difference between Ethernet switch and IP router r Routing protocol m Ethernet switch • Difference between Ethernet switch and IP router r Routing protocol m Ethernet switch • Address learning • Spanning tree algorithm - "default" ports m IP router • OSPF link-state protocol • RIP, BGP distance-vector protocols Week 1 93

Difference between Ethernet switch and IP router r Ethernet switches m Characteristics like flooding Difference between Ethernet switch and IP router r Ethernet switches m Characteristics like flooding packets and flat addressing makes these packet switches • Suitable for Local Area Networks (LANs) • Hence, used within enterprises r IP routers m Characteristics like default entry and hierarchical addressing (with subnet masks) makes these packet switches • Suitable for Wide Area Networks (WANs) Week 1 94

An important difference between Ethernet switch and IP router r Ethernet switches m Plug-and-play An important difference between Ethernet switch and IP router r Ethernet switches m Plug-and-play m MAC addresses are hardwired into interfaces (NICs and switches' links) r IP routers m Needs some administration • Configure IP addresses of interfaces • Default router setting Week 1 95

"Routing protocol" in Ethernet switches (IEEE 802. 1 D) r Address learning r Spanning tree algorithm r Two points to note: m The word "bridge" is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs) • Current-day interest: Ethernet switches run this protocol m A network with a hub is shown as a single line. Assume that multiple hosts are connected to each hub M. Veeraraghavan (originals by J. Liebeherr) Week 1 96

Operation of transparent bridges r Three aspects of bridge (switch) operation: (1) Forwarding of Operation of transparent bridges r Three aspects of bridge (switch) operation: (1) Forwarding of Frames (2) Learning of Addresses (3) Spanning Tree Algorithm Use to create entries for the routing table (distributed scheme: routing protocol) r Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets m m use the term “bridge” and “switch” interchangeably use the term “frame” and “packet” interchangeably r The term “transparent” refers to the fact that the hosts are completely unaware of the presence of bridges in the network m Introduction of a bridge does not require hosts to be configured. Week 1 97

Routing table (called filtering database in Ethernet switches) r. Each bridge maintains a filtering Routing table (called filtering database in Ethernet switches) r. Each bridge maintains a filtering database (routing table) with entries < MAC address, port> MAC address: identifies host network interface card (NIC) port: output port number of bridge Week 1 98

Frame Forwarding r Assume an Ethernet frame arrives on port x. Search if MAC Frame Forwarding r Assume an Ethernet frame arrives on port x. Search if MAC address of destination is listed for ports A, B, or C in the filtering database. Found? Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it Not found ? Flood the frame, i. e. , send the frame on all ports except port x if port states allow it. Week 1 99

Forwarding conditions r Forward the frame if and only if m The receiving port Forwarding conditions r Forward the frame if and only if m The receiving port is in a forwarding state m The transmitting port is in a forwarding state m Either the filtering database indicates the port number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports) m Do not transmit on port on which frame was received m The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (e. g. , 1500 bytes for Week 1 Ethernet) 100

Address Learning r In principle, the filtering database could be set statically (=static routing) Address Learning r In principle, the filtering database could be set statically (=static routing) r In the 802. 1 bridge, the process is made automatic with a simple heuristic: The source address field of a frame that arrives on a port is used by the bridge to update its filtering database, which indicates the port through which each host is reachable. Hub Bridge 2 Week 1 101

Address Learning Algorithm: r For each frame received, the bridge stores the source address Address Learning Algorithm: r For each frame received, the bridge stores the source address field in the received frame header into the filtering database together with the port on which the frame was received. r All entries are deleted after some time (default is 300 seconds). Week 1 102

Example • Consider the following packets: <Src=A, Dest=F>, <Src=C, Dest=A>, <Src=E, Dest=C> • What Example • Consider the following packets: , , • What have the bridges learned? Week 1 103

Forwarding frames and learning Learning process writes Filtering database Frame forwarding reads Filtering database Forwarding frames and learning Learning process writes Filtering database Frame forwarding reads Filtering database Week 1 104

Danger of Loops r Consider the two LANs that are connected by two bridges. Danger of Loops r Consider the two LANs that are connected by two bridges. r Assume host n is transmitting a frame F with unknown destination. What is happening? r Bridges A and B flood the frame to LAN 2. r Bridge B sees F on LAN 2 (with unknown destination), and copies the frame back to LAN 1 r Bridge A does the same. r The copying continues Where’s the problem? What’s the solution ? Week 1 105

Spanning Trees r IEEE 802. 1 has an algorithm that builds and maintains a Spanning Trees r IEEE 802. 1 has an algorithm that builds and maintains a spanning tree in a dynamic environment. r Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit, Configuration BPDUs) to build the tree. Week 1 106

Concept - Bridge ID r Each bridge has a unique identifier (8 bytes): Bridge Concept - Bridge ID r Each bridge has a unique identifier (8 bytes): Bridge ID = Priority level = 2 bytes; Note that a bridge has several MAC addresses (one for each port), but only one ID using the MAC address of the lowest numbered bridge port (port 1) r Each port within a bridge has a unique identifier (port ID). 0: 0: 1: 2: 3: 5 Bridge 2 3 1 Priority: 0 x 12: 41 51: 24: 68: 1 f: 3: 4 fe: 64: 96: 12: 1: 3 Example above: Bridge ID = 12: 41: fe: 64: 96: 12: 1: 3 Week 1 107

Concept - Root bridge of a network r Root Bridge: The bridge with the Concept - Root bridge of a network r Root Bridge: The bridge with the lowest identifier is the root of the spanning tree. Bridge 3 with ID 0: 1: 34: 1: 21: 56: 19: 87 1 LAN A LAN B 2 1 Bridge 1 with ID= 4: 1: 21: 56: 19: 87 1 Bridge 2 with ID= 6: 4: 55: 4: 21: 56: 19: 87 Root bridge is bridge 3 since it has the smallest ID Week 1 108

Concept - For each bridge r Root Port: Each bridge has a root port Concept - For each bridge r Root Port: Each bridge has a root port which identifies the next hop from a bridge to the root. r Root Path Cost: For each bridge, the cost of the min-cost path to the root r Example on previous slide: What is the root port and root path cost of bridge 1: m The root port is port 2 since it leads to the root bridge (bridge 3) m The root path cost is 1 since bridge 1 is one hop away from the root bridge (I. e. , bridge 3). r Note: We assume that “cost” of a path is the number of “hops”. Week 1 109

Concept - For each LAN r Designated Bridge, Designated Port: Single bridge on a Concept - For each LAN r Designated Bridge, Designated Port: Single bridge on a LAN that provides the minimal cost path to the root for this LAN, and the port on this minimal cost path m m if two bridges have the same cost, select the one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports on the LAN, select the port with the lowest identifier r Example: for LAN A, the designated bridge is bridge 3 since it is the root bridge itself; port 1 is the designated port; for LAN B, the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2. The designated port is port 1. Week 1 110

Concept - Designated bridge/port r Even though each LAN is the entity that has Concept - Designated bridge/port r Even though each LAN is the entity that has a designated bridge/designated port, it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports. r Example: Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected). m Answer in this case is that bridge 1 is the designated bridge for LAN B, but it is not the designated bridge for LAN A Week 1 111

Steps of Spanning Tree Algorithm 1. Determine the root bridge of the whole network Steps of Spanning Tree Algorithm 1. Determine the root bridge of the whole network 2. For all other bridges determine root ports 3. For all bridges, determine which of the bridge ports are designated ports for their corresponding LANs r The spanning tree consists of all the root ports and the designated ports. r These ports are all set to the “forwarding state, ” while all other ports are in a “blocked state. ” Week 1 112

What we just did r We just determined the spanning tree for a network What we just did r We just determined the spanning tree for a network of LANs and bridges in a “centralized manner. ” m m We knew the bridge IDs of all the bridges and the port IDs of all the ports in all the bridges. We determined the root bridge (the bridge with the smallest ID. ) For each bridge, we determined the shortest path to the root by counting hops and thus identified the root port. For each bridge, we determined which of its ports are designated ports for each of its LANs r However, the network of bridges determines the spanning tree in a “distributed manner” - each with limited knowledge. m This is done using messages called BPDUs. Week 1 113

How do the bridges determine the spanning tree? With the help of the BPDUs, How do the bridges determine the spanning tree? With the help of the BPDUs, bridges can: r Elect a single bridge as the root bridge. r Each bridge can determine: m m a root port, the port that gives the best path to the root. And the corresponding root path cost r Each bridge determines whether it is a designated bridge, for the LANs connected to each of its ports. The designated bridge will forward packets towards the root bridge. r Select ports to be included in the spanning tree. m Root ports and designated ports Week 1 114

Short form notation for BPDUs r Each bridge sends out BPDUs that contain the Short form notation for BPDUs r Each bridge sends out BPDUs that contain the following information: root ID cost bridge ID/port ID root bridge (what the sender thinks it is) root path cost for sending bridge Identifies port on which this BPDU is sent Week 1 115

Ordering of Messages r We can order BPDU messages with the following ordering relation Ordering of Messages r We can order BPDU messages with the following ordering relation “ <": M 1 ID R 1 C 1 ID B 1 < ID R 2 C 2 ID B 2 M 2 If (R 1 < R 2) M 1 < M 2 elseif ((R 1 == R 2) and (C 1 < C 2)) M 1 < M 2 elseif ((R 1 == R 2) and (C 1 == C 2) and (B 1 < B 2)) M 1 < M 2 Week 1 116

Determine the Root Bridge r Initially, all bridges assume they are the root bridge. Determine the Root Bridge r Initially, all bridges assume they are the root bridge. r Each bridge B sends BPDUs of this form on its LANs: B 0 B r Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs. r Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives, the root is updated) Week 1 117

Calculate the Root Path Cost Determine the Root Port r At this time: A Calculate the Root Path Cost Determine the Root Port r At this time: A bridge B has a belief of who the root is, say R. r Bridge B determines the Root Path Cost (Cost) as follows: • If B = R : • If B R: Cost = 0. Cost = {Smallest Cost in any of BPDUs that were received from R} + 1 r B’s root port is the port from which B received the lowest cost path to R. r Knowing R and Cost, B can generate its BPDU (but will not necessarily send it out): R Cost B Week 1 118

Determine if the bridge is the designated bridge for any of the LANs connected Determine if the bridge is the designated bridge for any of the LANs connected to its ports r At this time: B has generated its BPDU R Cost B r B will send this BPDU on one of its ports, say port x, only if its BPDU is lower (via relation “<“) than any BPDU that B received from port x. r In this case, B also assumes that it is the designated bridge for the LAN to which the port connects. Week 1 119

Selecting the Ports for the Spanning Tree r At this time: Bridge B has Selecting the Ports for the Spanning Tree r At this time: Bridge B has calculated the root bridge for the network, its root port, root path cost, and whether it is the designated bridge for each of its LANs. r Now B can decide which ports are in the spanning tree: • B’s root port is part of the spanning tree • All ports for which B is the designated bridge are part of the spanning tree. r B’s ports that are in the spanning tree will forward packets (=forwarding state) r B’s ports that are not in the spanning tree will block packets (=blocking state) Week 1 120

Adapting to Changes r Bridges continually exchange BPDU’s according to the rules we just Adapting to Changes r Bridges continually exchange BPDU’s according to the rules we just discussed. r This allows the bridges to adapt to changes to the topology. r Whenever a BPDU arrives on a port, say port x, B bridge determines: • Can B become the designated bridge for the LAN that port x is attached to? • Can port x become the root port? Week 1 121

Example 1 • Assume a Bridge with ID 18 has received the following as Example 1 • Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports: • What is the root bridge? Root is 12 • What is the Root Path Cost? 85 +1 = 86 • What is the root port? Port 2 • What is 18’s configuration BPDU? 12. 86. 18 • For which LAN (port), if any, is B the designated bridge? For Ports 1, 3, 4 Week 1 122

Example 2 • Assume a Bridge with ID 92 is receiving the following as Example 2 • Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports: • What is the root bridge? • What is the Root Path Cost? • What is the root port ? • What is 92’s configuration BPDU? • For which LAN (port), if any, is Bridge 92 the designated bridge? Week 1 123

Network Example (Practice) r The attached network r r r shows 5 LANs that Network Example (Practice) r The attached network r r r shows 5 LANs that are interconnected by 5 bridges. The ID’s of the bridges are 1, 2, 3, 4, 5 and the port ID’s are as indicated in the figure. The bridges run the spanning tree algorithm. Assume that the root cost path is the number of hops. Assume an initial state. Show which messages are exchanged until the tree is built. Week 1 124

Network Example (Practice Final Answer) r R: Root ports r D: Designated ports r Network Example (Practice Final Answer) r R: Root ports r D: Designated ports r Show all the BPDUs Week 1 125

Failures r Root bridge periodically transmits configuration messages with message 0 r Bridges receiving Failures r Root bridge periodically transmits configuration messages with message 0 r Bridges receiving these messages transmit them on their designated ports r If the root or any bridge on the spanning tree fails then the configuration messages will time out r At that point, the bridge will discard the configuration message and recalculate the root, root path cost, and root port. Week 1 126

Example The new root port is 3 The new root port is 5 Week Example The new root port is 3 The new root port is 5 Week 1 127

Example The bridge 92 will assume itself to be the root and will transmit Example The bridge 92 will assume itself to be the root and will transmit 92. 0. 92 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root. Week 1 128