220 likes | 237 Views
Data Link Issues. Relates to Lab 2. This module covers data link layer issues, such as local area networks (LANs) and point-to-point links, CSMA, and Ethernet,. Data Link Layer. The main tasks of the data link layer are:
E N D
Data Link Issues Relates to Lab 2. This module covers data link layer issues, such as local area networks (LANs) and point-to-point links, CSMA, and Ethernet,
Data Link Layer • The main tasks of the data link layer are: • Transfer data from the network layer of one machine to the network layer of another machine using hop by hop transmission over single links (single segments). • Convert the raw bit stream of the physical layer into groups of bits (“frames”) and vice versa Datagram Frame Electrical and Optical signals
Hop-by-Hop Transport Neon Argon The actual path followed by data Data Link Hop Single Segment
Data Link Layer • Datagram transferred by different link protocols over differentlinks: • e.g., Ethernet (802.3) on first link, frame relay on intermediate links, WiFi (802.11) on last link • Each link protocol provides different services • e.g., may or may not provide error control over link
Data Link Layer Services • flow control • pacing between adjacent sending and receiving nodes • error detection • errors caused by signal attenuation, noise • receiver detects presence of errors: • signals sender for retransmission or drops frame • error correction • receiver identifies and corrects bit error(s) without resorting to retransmission • transmission - half-duplex and full-duplex • half duplex - nodes at both ends of link can transmit, but not at same time • full duplex – nodes can transmit in both directions at the same time • channel access
Data Link Layer Implementation • in each and every host • data link layer implemented in “adaptor” (aka network interface card NIC) or on a chip • Ethernet card, 802.11 card; Ethernet chipset • Implements: • Data Link layer, AND • Physical layer • attaches into host’s system buses • combination of hardware, software, firmware controller physical transmission
Types of “Single Segment” Networks • There are two types of communication networks: • Broadcast Networks: All stations share a single communication channel • Point-to-Point Networks: Pairs of hosts (or routers) are directly connected • Examples of single segment networks: • broadcast: Ethernet, WiFi, • point to point link: Frame Relay • Typically, local area networks (LANs) are broadcast and wide area networks (WANs) are point-to-point
Local Area Network (LAN) • Local area networks (LANs) typically connect devices within a building or a campus • Almost all LANs are broadcast networks • Typical topologies of LANs are bus or ring or star • LANs use an algorithm to gain access to shared channel to transmit Star
LANs: Data Link Layer - MAC and LLC • In any broadcast network, the stations must ensure that only one station transmits at a time on the shared communication channel • The protocol that determines who can transmit on a broadcast channel is called the Medium Access Control (MAC) protocol • The MAC protocol is implemented in the MAC sublayer which is the lower sublayer of the data link layer • The MAC is physical layer/topology dependent • The higher portion of the data link layer is often called the Logical Link Control (LLC)
Logic Link Controls • Frame Structure • Fields: types, lengths • Flow Control • Pacing control: • none • stop and go, window control • Error Control • None • Error detection/correction • Error recovery
MAC Protocols • multiple access protocol • an algorithm that determines how nodes share channel, i.e., determine when node can transmit • Centralized – a master that controls how nodes share the channel • Distributed –no one in charge, nodes cooperate for access • three broad classes: • channel partitioning • divide channel into smaller “pieces” (time slots, frequency, code) • allocate a piece to each node a priori for exclusive use • random access • channel use not allocated - all nodes can use any piece (or full channel) • can result in collisions if nodes transmit at the same time • often implements a mechanism to “recover” from collisions • round robin “taking turns” • nodes take turns using pieces or full channel, but nodes with more to send can take longer/larger turns – causing variable delays
Random Access • when node has packet to send • transmit at full channel data rate R (generally no pieces) • NO a prioriallocation of channel among nodes • two or more transmitting nodes on channel ➜“collision” • random access MAC protocol specifies: • how to detect collisions • how to recover from collisions (e.g., via delayed retransmissions) • examples of random access MAC protocols: • slotted ALOHA • ALOHA • CSMA, CSMA/CD, CSMA/CA
Carrier Sense multiple access (CSMA) • CSMA: listen before transmit, i.e., don’t interrupt others, wait until there is a pause: • if channel sensed idle: transmit entire frame • if channel sensed busy, defer transmission • When channel sensed idle: collisions can still occur: • propagation delay means two nodes may not hear each other’s transmission and the collision occurs in mid transmission • When channel sensed busy: collisions can still occur: • deferred nodes all detect pause at the same time after a transmission is completed and will attempt to transmit • Collision: entire packet transmission time wasted • distance & propagation delay play role in in determining collision probability
CSMA with Collision Detection (CSMA/CD) • CSMA/CD:carrier sensing, deferral as in CSMA • collisions detected within short time (propagation delay) • colliding transmissions aborted and a jam signal transmitted, reducing channel wastage • collision detection: • easy in wired LANs: measure signal strengths, compare transmitted and received signals • difficult in wireless LANs: received signal strength overwhelmed by local transmission strength – detection not functional --> don’t use /CD. Use Collision Avoidance (CA). Small reservation packets used to request channel usage. Possible because of centralized architecture (Access Point (AP).
CSMA with Collision Detection (CSMA/CD) • NIC receives datagram from network layer, creates frame • If NIC senses channel idle, starts frame transmission. If NIC senses channel busy, waits for pause, then checks if channel idle. If YES transmits, if NO, repeats - waits for next pause. • If NIC transmits entire frame without detecting another transmission, NIC is done with frame! • If NIC detects another transmission while transmitting, aborts and sends jam signal • After aborting, NIC enters binary (exponential) back-off: • after mth collision, NIC chooses a value K at random from {0,1,2, …, 2m-1}. • NIC waits K·512 bit times, returns to Step 2 • longer back-off interval with more collisions
CSMA with Collision Detection (CSMA/CD) • spatial layout of nodes B and D
A LAN Data Link Layer Example: Ethernet II • LLC very simple: • Frame structure (next slide) • connectionless: no handshaking between sending and receiving NICs • unreliable: uses error detection only no recovery • detected error: frame dropped • receiving NIC doesnt send acks or nacks to sending NIC • data in dropped frames recovered only if initial sender uses a reliable higher layer (e.g., TCP), otherwise dropped data lost • MAC protocol: • CSMA/CD with binary backoff when collisions occur
Ethernet II frame structure • sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame • preamble: • 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 • used to synchronize receiver and sender clock rates type dest. address source address data (payload) CRC preamble
Ethernet II frame structure (more) • addresses: 6 byte source/destination MAC addresses • if adapter receives frame with matching destination address, or with broadcast address (e.g. ARP packet), it passes data in frame to upper layer (e.g., IP or ARP) • otherwise, adapter discards frame • type: indicates higher layer protocol (mostly IP but others possible, e.g., Novell IPX, AppleTalk) or ARP • CRC: cyclic redundancy check at receiver • error detected: frame is dropped type dest. address source address data (payload) CRC preamble
application transport network link physical fiber physical layer copper (twisted pair) physical layer Ethernet II standards: link & physical layers • manydifferent Ethernet standards • common MAC protocol and LLC frame format • different speeds: 2 Mbps, 10 Mbps, 100 Mbps, 1Gbps, 10G bps • different physical layer media: fiber, cable MAC protocol and LLC frame format 100BASE-T2 100BASE-FX 100BASE-TX 100BASE-BX 100BASE-SX 100BASE-T4
Ethernet II Frame vs IEEE 802.3 • Note: • all fields in bytes • IEEE 802.3 has embedded 8 byte Link Control header 802.2 • Data field is padded if payload is less than < 38bytes • Ethernet II: • FCS is CRC • Data field is padded if payload is less than < 46bytes
Ethernet Star Configurations: Hubs vs. Switches • An Ethernet switch is a packet switch for Ethernet frames • Buffering of frames prevents collisions • Each port is isolated and builds its own collision domain • An Ethernet Hub does not perform buffering • Collisions occur if two frames arrive at the same time (WiFi access points are virtually hubs) Hub Switch