Presentation is loading. Please wait.

Presentation is loading. Please wait.

Data Link Layer Data Link Layer Functions

Similar presentations


Presentation on theme: "Data Link Layer Data Link Layer Functions"— Presentation transcript:

1 Data Link Layer Data Link Layer Functions
deliver frames over a single link framing, media access, error checking (error correction), … Cyclic Redundancy Code for error detection Local Area Networks (LANs) and MAC Addresses MAC addresses (vs. IP address) point-to-point vs. shared access IP Address Resolution Protocol (ARP) and IP datagram forwarding (revisited!) CSci4211: Data Link Layer

2 Data Link Layer (cont’d)
Extending LANs & Switched LANs: hubs, bridges, and (layer 2) switches Bridging self-learning spanning tree algorithms Media Access Control Random Access Aloha, Slotted Aloha CSMA, CSMA/CD and Ethernet (802.3) CSMA/CA and Wireless LAN (covered in Chapter 6) “Take Turns” Controlled Access Token Passing and Token Ring (802.5) Other Link Layer Technology PPP ATM/MPLS and Link/Network Virtualization Readings: Textbook, Chapter 5 CSci4211: Data Link Layer

3 Data Link Layer: Introduction
Some terminology: hosts and routers are nodes (bridges and switches too) communication channels that connect adjacent nodes along communication path are links wired links wireless links LANs (local area networks) layer 2 PDU (“packet”) referred to as frame, which encapsulates a layer-3 packet, e.g., an IP datagram CSci4211: Data Link Layer

4 What Does Data Link Layer Do?
Data link layer has responsibility of transferring frames from one node to adjacent node over a single link An IP packet from host A to host B may traverses different links using different data link protocols e.g., Ethernet on first link, PPP on intermediate links, on last link Each link protocol provides different services e.g., may or may not provide reliable data delivery Different link protocols are not inter-operable! IP packets are encapsulated/decapsulated with appropriate data link protocol header over each link IP protocol and IP routers glue the links (“physical networks”) together and provide end-to-end data delivery! CSci4211: Data Link Layer

5 Data Link Layer Functions
Framing sender (transmitter): encapsulate datagram into frame, adding header, trailer, transmit frame receiver: detect beginning of frames, receive frame, decapsulate frame, stripping off header, trailer Link Access (Media Access Control) determine whether it’s Okay to transmit over the link particularly important when link shared by many nodes also an issue over “half-duplex” point-to-point link (why?) need media access control (MAC) “physical addresses” identify sender/receiver on a link! particularly important when link shared by many nodes, while over point-to-point link, not necessary (why?) “physical addresses” often referred to as “MAC” addresses different from IP addresses (which are logical & global)! CSci4211: Data Link Layer

6 Other Data Link Layer Functions
Error Detection (commonly implemented, see Section 5.2) errors caused by signal attenuation, noise, etc. sender computes “checksum”, attaches to frame receiver detects presence of errors by verifying “checksum” drops corrupted frame, may ask sender for retransmission Commonly used “checksum”: cyclic redundancy code (CRC) Reliable delivery between adjacent nodes (optional) using, e.g., go-back-N or selective repeat protocol seldom used on low bit error link (fiber, some twisted pair) wireless links: high error rates Q: why both link-level and end-end reliability? Error Correction (optional) receiver identifies and corrects bit error(s) without resorting to retransmission, using forward error correction (FEC) codes Flow Control (optional) negotiating transmission rates between two nodes CSci4211: Data Link Layer

7 Adaptors Communicating
datagram link layer protocol rcving node sending node frame frame adapter adapter link layer implemented in “adaptor” (aka NIC), with “transceiver” in it Ethernet card, dial-up modem, wireless card sending side: encapsulates datagram in a frame adds error checking bits, flow control, reliable data transmission, etc. receiving side looks for errors, flow control, reliable data transmission, etc extracts datagram, passes to receiving node adapter is semi-autonomous data link & physical layers are closely coupled! CSci4211: Data Link Layer

8 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 Fall 2006 CSci4211: Data Link Layer

9 Parity Checking Two Dimensional Bit Parity: Single Bit Parity:
Detect and correct single bit errors Single Bit Parity: Detect single bit errors CSci4211: Data Link Layer

10 Internet Checksum Goal: detect “errors” (e.g., flipped bits) in transmitted segment (note: used at transport layer only) Sender: treat segment contents as sequence of 16-bit integers checksum: addition (1’s complement sum) of segment contents sender puts checksum value into UDP checksum field Receiver: compute checksum of received segment check if computed checksum equals checksum field value: NO - error detected YES - no error detected. But maybe errors nonetheless? More later …. CSci4211: Data Link Layer

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

12 CRC Example Want: equivalently:
D.2r XOR R = nG equivalently: D.2r = nG XOR R if we divide D.2r by G, want remainder R D.2r G R = remainder[ ] CSci4211: Data Link Layer

13 Multiple Access Links and LANs
Two types of “links”: point-to-point, e.g., PPP for dial-up access, or over optical fibers broadcast (shared wire or medium), e.g. traditional Ethernet wireless LAN CSci4211: Data Link Layer

14 LAN: Issues & Technologies
addressing: physical (or MAC) addresses media access control (MAC) for broadcast LANs expanding LANs: connecting multiple LAN segments hubs, bridges, (layer-2) switches (we’ll explain difference later) Various commonly used LAN technologies Ethernet 802.11(WiFi) PPP ATM (not really LAN) (example of non-broadcast multi-access network) CSci4211: Data Link Layer

15 MAC (Physical, or LAN) Addresses
used to get frames from one interface to another physically-connected interface (same physical network, i.e., p2p or LAN) 48 bit MAC address (for most LANs) fixed for each adaptor, burned in the adapter ROM MAC address allocation administered by IEEE 1st bit: 0 unicast, 1 multicast. all 1’s : broadcast MAC flat address -> portability can move LAN card from one LAN to another MAC addressing operations on a LAN: each adaptor on the LAN “sees” all frames accept a frame if dest. MAC address matches its own MAC address accept all broadcast (MAC= all1’s) frames accept all frames if set in “promiscuous” mode can configure to accept certain multicast addresses (first bit = 1) CSci4211: Data Link Layer

16 MAC vs. IP Addresses 32-bit IP address: network-layer address, logical
i.e., not bound to any physical device, can be re-assigned IP hierarchical address NOT portable depends on IP network to which an interface is attached when move to another IP network, IP address re-assigned used to get IP packets to destination IP network Recall how IP datagram forwarding is performed IP network is “virtual,” actually packet delivery done by the underlying physical networks from source host to destination host, hop-by-hop via IP routers over each link, different link layer protocol used, with its own frame headers, and source and destination MAC addresses Underlying physical networks do not understand IP protocol and datagram format! CSci4211: Data Link Layer

17 Recall: IP Datagram Forwarding
Starting at A, given IP datagram addressed to B: look up net. address of B, find B on same net. as A link layer send datagram to B inside link-layer frame A B E B’s MAC addr A’s MAC A’s IP B’s IP IP payload datagram frame frame source, dest address datagram source, CSci4211: Data Link Layer

18 ARP: Address Resolution Protocol
Question: how to determine MAC address of B knowing B’s IP address? Each IP node (host, router) on LAN has ARP table ARP Table: IP/MAC address mappings for some LAN nodes < IP address; MAC address; timer> timer: time after which address mapping will be forgotten (typically 20 min) try out “arp –a” command CSci4211: Data Link Layer

19 ARP Protocol B receives ARP packet, replies to A with its (B's) MAC address frame sent to A’s MAC address (unicast) A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state: information that times out (goes away) unless refreshed ARP is “plug-and-play”: nodes create their ARP tables without intervention from net administrator A wants to send datagram to B, and A knows B’s IP address. A looks up B’s MAC address in its ARP table Suppose B’s MAC address is not in A’s ARP table. A broadcasts (why?) ARP query packet, containing B's IP address all machines on LAN receive ARP query CSci4211: Data Link Layer

20 ARP Messages Hardware Address Type: e.g., Ethernet
Here is the structure of an ARP packet. Whether it’s a request or reply is specified by the operation. Hardware Address Type: e.g., Ethernet Protocol address Type: e.g., IP Operation: ARP request or ARP response CSci4211: Data Link Layer

21 ARP Request & Response Processing
The requester broadcasts ARP request The target node unicasts (why?) ARP reply to requester With its physical address Adds the requester into its ARP table (why?) On receiving the response, requester updates its table, sets timer Other nodes upon receiving the ARP request Refresh the requester entry if already there No action otherwise (why?) Some questions to think about: Shall requester buffer IP datagram while performing ARP? What shall requester do if never receive any ARP response? We can categorize the nodes in the local network into requester node, target node and all others. Lets see what each of them do in turn. The target node responds only to the sender with its hardware address. Why not broadcast the reply also? All others may not necessarily be interested in communicating with target node and a broadcast incurs processing overhead at every node in the network. The target node adds the requester’s IP and hardware addresses into its ARP cache (if not already there). Why? It is likely that target node would also send IP packets to the requester node later and so it makes sense to avoid an ARP request broadcast by the target node that time. The requester node on receiving the response, updates its ARP table. All other nodes, receive only the request not the reply. They check if the requester has an entry in their caches. If found, they refresh that entry. Otherwise, no action taken. Why not add an entry for the requester? We don’t want to grow the ARP table unnecessarily. Finally, a lifetime is associated with each entry in the ARP cache and an entry is deleted if it not refreshed within that time. CSci4211: Data Link Layer

22 ARP Operation Illustration
Here is an illustration of ARP broadcast by W requesting hardware address of Y. As you can see, every node in the local physical network receive this request. Only Y sends the reply and also only to W. CSci4211: Data Link Layer

23 Forwarding to Another LAN
walkthrough: send datagram from A to B via R assume A knows B IP address Two ARP tables in router R, one for each IP network (LAN) In routing table at source host, find router In ARP table at source, find MAC address E6-E BB-4B, etc A R B CSci4211: Data Link Layer

24 B A R A creates datagram with source A, destination B
A uses ARP to get R’s MAC address for A creates link-layer frame with R's MAC address as dest, frame contains A-to-B IP datagram A’s data link layer sends frame R’s data link layer receives frame R removes IP datagram from Ethernet frame, sees its destined to B R uses ARP to get B’s physical layer address R creates frame containing A-to-B IP datagram sends to B CSci4211: Data Link Layer

25 Interconnecting LAN Segments & Switched LANs
Hubs Bridges (Layer-2) Switches Remark: switches are essentially multi-port bridges. What we say about bridges also holds for switches! CSci4211: Data Link Layer

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

27 Interconnecting with Hubs
Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large collision domain Can’t interconnect 10BaseT & 100BaseT hub CSci4211: Data Link Layer

28 Bridge and Layer-2 Switch
Link layer device stores and forwards Ethernet frames examines frame header and selectively forwards frame based on MAC destionation address when frame is to be forwarded on segment, uses CSMA/CD to access segment transparent hosts are unaware of presence of switches plug-and-play, self-learning switches do not need to be configured CSci4211: Data Link Layer

29 Bridge/Switch: Traffic Isolation
Bridge/switch installation breaks subnet into LAN segments Bridge/switch filters packets: same-LAN-segment frames not usually forwarded onto other LAN segments segments become separate collision domains hub switch collision domain collision domain LAN (IP network) CSci4211: Data Link Layer

30 Forwarding How do determine onto which LAN segment to forward frame?
hub switch 1 3 2 How do determine onto which LAN segment to forward frame? Looks like a routing problem... CSci4211: Data Link Layer

31 Self Learning A bridge/switch has a forwarding (or switch) table
entry in forwarding table: (MAC Address, Interface, Time Stamp) stale entries in table dropped (TTL can be 60 min) Bridge/switch learns which hosts can be reached through which interfaces when frame received, switch “learns” location of sender: incoming LAN segment records sender/location pair in forwarding table CSci4211: Data Link Layer

32 Filtering/Forwarding
When bridge/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 CSci4211: Data Link Layer

33 Bridge/Switch Example
Suppose C sends frame to D hub switch A B C D E F G H I 1 2 3 address interface A B E G 1 2 3 Switch receives frame from C notes in bridge/switch table that C is on interface 1 because D is not in table, switch forwards frame into interfaces 2 and 3 frame received by D CSci4211: Data Link Layer

34 Bridge/Switch Example
Suppose D replies back with frame to C. hub switch B C D E F G H I address interface A B E G C 1 2 3 A Switch receives frame from from D notes in bridge/switch table that D is on interface 2 because C is in table, switch forwards frame only to interface 1 frame received by C CSci4211: Data Link Layer

35 Switches: Dedicated Access
Switch with many interfaces Hosts have direct connection to switch No collisions; full duplex Switching: A-to-A’ and B-to-B’ simultaneously, no collisions A C’ B switch C B’ A’ CSci4211: Data Link Layer

36 More on Switches cut-through switching: frame forwarded from input to output port without first collecting entire frame slight reduction in latency combinations of shared/dedicated, 10/100/1000 Mbps interfaces CSci4211: Data Link Layer

37 Interconnection without Backbone
Not recommended for two reasons: - single point of failure at Computer Science hub - all traffic between EE and SE must path over CS segment CSci4211: Data Link Layer

38 Backbone Configuration
Recommended ! CSci4211: Data Link Layer

39 Bridges Spanning Tree for increased reliability, desirable to have redundant, alternative paths from source to dest with multiple paths, cycles result - bridges may multiply and forward frame forever solution: organize bridges in a spanning tree by disabling subset of interfaces Disabled CSci4211: Data Link Layer

40 Bridge Spanning Tree Algorithm: Algorhyme
I think that I shall never see A graph more lovely than a tree. A tree whose crucial property Is loop-free connectivity. A tree that must be sure to span So packets can reach every LAN. First, the root must be selected. By ID, it is elected. Least cost paths from root are traced. In the tree, these paths are placed. A mesh is made by folks like me, Then bridges find a spanning tree -- Radia Perlman CSci4211: Data Link Layer

41 Some Bridge/Switch Features
Isolates collision domains resulting in higher total max throughput limitless number of nodes and geographical coverage Can connect different Ethernet types Transparent (“plug-and-play”): no configuration necessary CSci4211: Data Link Layer

42 Institutional Network
hub switch to external network router IP subnet mail server web server CSci4211: Data Link Layer

43 Not an atypical LAN (IP network)
Dedicated Shared CSci4211: Data Link Layer

44 Bridges/Switches vs. Routers
both store-and-forward devices routers: network layer devices (examine network layer headers) bridges are link layer devices routers maintain routing tables, implement routing algorithms bridges maintain bridge forwarding tables, implement filtering, learning and spanning tree algorithms CSci4211: Data Link Layer

45 Routers vs. Bridges/Switches
Bridges + and - + Bridge operation is simpler requiring less packet processing + Bridge tables are self learning - All traffic confined to spanning tree, even when alternative bandwidth is available - Bridges do not offer protection from broadcast storms CSci4211: Data Link Layer

46 Routers vs. Bridges/Switches …
Routers + and - + arbitrary topologies can be supported, cycling is limited by TTL counters (and good routing protocols) + provide protection against broadcast storms - require IP address configuration (not plug and play) - require higher packet processing bridges do well in small (few hundred hosts) while routers used in large networks (thousands of hosts) CSci4211: Data Link Layer

47 Summary Comparison CSci4211: Data Link Layer


Download ppt "Data Link Layer Data Link Layer Functions"

Similar presentations


Ads by Google