Download presentation
Presentation is loading. Please wait.
1
5-1 Data Link Layer r Today, we will study the data link layer… r This is the last layer in the network protocol stack we will study in this class…
2
5-2 Quick recapitulation r What are the other layers? r What are their functions?
3
r application: supporting network applications m HTTP, FTP, SMTP r transport: process-process data transfer m TCP, UDP r network: routing of datagrams from source to destination m IP addressing, routing protocols r Data link: more concerned about the actual link access m Ethernet r physical: bits “on the wire” 1-3 Internet protocol stack Lecture 3 Introduction application transport network link physical
4
5-4 Link Layer Services r framing, link access: m encapsulate datagram into frame, adding header, trailer m “MAC” addresses used in frame headers to identify source, dest different from IP address! m channel access if shared medium m Data link layer is more concerned about the competition for the link capturing…so that it can actually transmit packets… m We will study ETHERNET mechanism
5
5-5 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
6
5-6 Where is the link layer implemented? r in each and every host r link layer implemented in “adaptor” (aka network interface card NIC) m Ethernet card, 802.11 card m implements link, physical layer r combination of hardware, software, firmware network adapter card
7
5-7 Link Layer is more concerned about competition! r Competition among whom? m Among the hosts (machines) r Shared medium (shared wire or shared air) m Ethernet LAN (local area network) m 802.11 wireless LAN shared RF (e.g., 802.11 WiFi) humans at a cocktail party (shared air, acoustical) shared wire (e.g., cabled Ethernet)
8
5-8 Multiple Access Control protocols r Single shared broadcast medium (Ethernet or air) r Everybody tries to capture that… r Results in “collision” r Collision: When two or more nodes transmit packets simultaneously, the packets collide with each other m Transmissions fail and packets are lost Obviously, this is not good !!! r So, we need a mechanism (protocol) such that collisions can be reduced: Multiple Access Control Protocol
9
5-9 Our very popular Ethernet follows one such Multiple Access Control Protocol Let us see how it works…
10
5-10 CSMA (Carrier Sense Multiple Access) (Step 1) CSMA: listen before transmit: r If channel sensed idle: transmit entire frame r If channel sensed busy, defer transmission till the channel becomes idle… r human analogy: don’t interrupt others!
11
5-11 CSMA/CD (Collision Detection) (step 2) CSMA/CD: carrier sensing, deferral as in CSMA m If channel sensed idle, attempt transmission m What might go wrong now? Another node also sensed the channel idle and transmitted m Collision occurs and collisions detected through high energy received m Retransmission of packets necessary r human analogy: the polite conversationalist
12
5-12 CSMA/CD with Backoff (step 3) CSMA/CD with Backoff: carrier sensing, deferral as in CSMA m If channel sensed idle, attempt transmission m What might go wrong now? Another node also sensed the channel idle and transmitted m Collision occurs and collisions detected through high energy received m After collision, colliding nodes wait a random time (backoff) before retransmissions r human analogy: the polite conversationalist
13
5-13 CSMA/CD with Binary Exponential Backoff (step 4) CSMA/CD with “Binary Exponential Backoff”: How much time for backing off? m When a collision occurs, instead of attempting retransmissions, the nodes wait a random amount of time m 1 st collision: the colliding node chooses a random number in between [0, 1] and waits that many time slots before attempting again… r human analogy: the polite conversationalist
14
5-14 CSMA/CD with Binary Exponential Backoff (contd.) (step 4 contd.) CSMA/CD with “Binary Exponential Backoff”: How much time for backing off? m Suppose, after the first collision, two nodes generated the same random number 1 from [0, 1] m Wait for 1 timeslot and then retransmit again… m Collision happens again… m 2 nd collision: the colliding nodes now increase their range and chooses a random number in between [0, 1, 2, 3] and waits that many time slots before attempting again…
15
5-15 CSMA/CD with Binary Exponential Backoff (contd.) (step 4 contd.) CSMA/CD with “Binary Exponential Backoff”: How much time for backing off? m Still collision happens for a node…(3 rd collision for the packet) m 3 rd collision: the colliding node now increase their range yet again and chooses a random number in between [0, 1, 2, 3, 4, 5, 6, 7] and waits that many time slots before attempting again… m … m after TEN collisions, choose a random number from {0,1,2,3,4,…,1023}, wait for that many slots and retry…
16
5-16 Star topology r bus topology popular through mid 90s m all nodes in same collision domain (can collide with each other) r today: star topology prevails m active switch in center m each “spoke” runs a (separate) Ethernet protocol (nodes do not collide with each other) switch bus: coaxial cable star
17
5-17 Switch r link-layer device: smarter than hubs, take active role m store, forward Ethernet frames m examine incoming frame’s MAC address, selectively forward frame to one-or-more outgoing links 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
18
5-18 Switch: allows multiple simultaneous transmissions r hosts have dedicated, direct connection to switch r switches buffer packets r Ethernet protocol used on each incoming link, but no collisions; full duplex m each link is its own collision domain r switching: A-to-A’ and B- to-B’ simultaneously, without collisions m not possible with dumb hub A A’ B B’ C C’ switch with six interfaces (1,2,3,4,5,6) 1 2 3 4 5 6
19
5-19 Ethernet Frame Structure Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame Preamble: r 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 r used to synchronize receiver, sender clock rates
20
5-20 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 network layer protocol m otherwise, adapter discards frame r Type: indicates higher layer protocol (mostly IP but others possible, e.g., Novell IPX, AppleTalk) r CRC: checked at receiver, if error is detected, frame is dropped
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.