1 / 95

INFO 330 Computer Networking Technology I

INFO 330 Computer Networking Technology I. Chapter 5 The Link Layer & LANs Glenn Booker. The Link Layer. So, let’s see where we’ve been The transport layer provides process to process communication The network layer provides host to host communication

macey-wise
Download Presentation

INFO 330 Computer Networking Technology I

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. INFO 330Computer Networking Technology I Chapter 5 The Link Layer & LANs Glenn Booker INFO 330 Chapter 5

  2. The Link Layer • So, let’s see where we’ve been • The transport layer provides process to process communication • The network layer provides host to host communication • Now the Link Layer provides the ability to send packets across a single … link • So this layer tells how to send a packet/segment/ datagram from one router/host to another INFO 330 Chapter 5

  3. The Link Layer • There are two types of link layer channels • Broadcast channels, used in LANs, wireless LANs, satellite networks, and HFC cable networks • Point-to-point communication link, such as between two routers or between an ISP and a modem • We’ll focus on Ethernet and PPP (Point-to-Point Protocol) • Wi-Fi (IEEE 802.11 protocols) is in chapter 6 INFO 330 Chapter 5

  4. Datagram Link Layer Terms • A node is a router or host – here we don’t care which one we’re dealing with! • Any connection between nodes is a link • The transmitting node puts the datagram in a frame, and transmits it into the link • The receiving node receives the frame, and extracts the datagram INFO 330 Chapter 5

  5. Link Layer Services • A link layer protocol moves a datagram over a (one, individual, eins, uno) link • It defines the format of packets (frames) exchanged between nodes at each end of the link, and the actions the nodes do to send and receive these packets • Over a host-to-host route, links may use several different link-layer protocols – but only one per link • Typically, one link layer frame contains one network layer datagram INFO 330 Chapter 5

  6. Link Layer Services • The link layer’s actions can also include • Reliable delivery • Error detection • Retransmission • Flow control • Random access • Link layer protocols include PPP, Ethernet, Token Ring, Wi-Fi, and some parts of ATM INFO 330 Chapter 5

  7. Link Layer Services • Now elaborate a little on these services • Framing a datagram into a frame means we have data (the datagram) and one or more headers • Technically, can have header and trailer fields, but we’ll generically call both headers • Header format is defined by the protocol INFO 330 Chapter 5

  8. Link Layer Services • Link Access uses the Medium Access Control (MAC) protocol to define how a frame is transmitted over a link • MAC negotiates transmission when many nodes share the same link • Reliable delivery is provided by high error- rate links (e.g. wireless) to keep the transport layer from retransmitting over the entire route INFO 330 Chapter 5

  9. Link Layer Services • Flow control helps keep the sending node from overwhelming the receiving node • Error detection looks for bit errors, usually more elaborately than in the transport and network layers • Error correction – some protocols (ATM) can also fix errors detected INFO 330 Chapter 5

  10. Link Layer Services • Half vs full duplex – with half duplex, a node can only send or receive at one time; with full duplex, it can send and receive at the same time • Yes, lots of the link layer services are similar to transport layer services • But the link layer only provides them between two nodes, whereas the transport layer does between hosts INFO 330 Chapter 5

  11. Adapters • Most link layer protocols are implemented in an adapter (since we’re getting really close to the physical layer!) • Adapter = network interface card (NIC) • The adapter is the last connection between a host and the physical link to the network • Error checking occurs in the adapter, oblivious to the host • Only datagrams which come in cleanly are passed up the protocol stack to the application INFO 330 Chapter 5

  12. Adapters • The main parts of an adapter are the link interface and the bus interface • The link interface connects to the physical network • The bus interface connects to the “parent” node’s I/O bus (e.g. PCI, PCI-X, Serial ATA, IDE, etc.) • Not much to it! INFO 330 Chapter 5

  13. Error Detection and Correction • We can detect, and sometimes correct, bit errors at the link layer INFO 330 Chapter 5

  14. Error Detection and Correction • We add error-detection and correction (EDC) to the data (D) to be sent across the link, in addition to other header info (address, sequence number, etc.) • At the other end of the link, the data could be changed (D’) and the EDC info could be corrupted (EDC’) • Telling from D’ and EDC’ if the original D was corrupted isn’t a perfect science! INFO 330 Chapter 5

  15. Error Detection and Correction • Hence there could be undetected bit errors • The lower the undetected error rate, the larger the overhead to add to each frame • Three main methods for detection • Parity Checks • Checksum • Cyclic Redundancy Check (CRC) INFO 330 Chapter 5

  16. Parity Checks • A simple error detection scheme, parity check adds one bit to the data • That one bit depends on the type of parity scheme • For even parity, the parity bit is chosen so that the total number of 1’s in the frame is … even • For odd parity, the parity bit is chosen so that the total number of 1’s in the frame is … odd INFO 330 Chapter 5

  17. Parity Checks • If the receiver of an even parity link finds an odd number of parity, then there must have been some odd number of bit errors (1, 3, 5, …) • Notice that an even number of errors isn’t detected! • And yes, it helps if both sides of the link are using the same parity rules • Modems used to set even or odd parity INFO 330 Chapter 5

  18. Parity Checks • A better approach is to break the data into a table with i rows and j columns, and define parity for each row and column • In this two-dimensional parity check, there are i+j+1 parity values (bits) • But by cross-referencing the parity errors, exactly which bit(s) were in error can be known, and hence fixed! INFO 330 Chapter 5

  19. Parity Checks • If the receiver can detect and fix errors, it’s forward error correction (FEC) • Commonly used in audio devices to compensate for, e.g., scratched CD’s • In a network, this helps avoid retransmission, and the associated delays INFO 330 Chapter 5

  20. Checksum Methods • Yup, this is just like the approach we saw before…here we call it an Internet checksum • Add the digits of the data • Take the 1s complement of the result – that’s the checksum • Data + checksum = 111111111… if not, there’s an error somewhere • See RFC 1071 INFO 330 Chapter 5

  21. Cyclic Redundancy Check • A Cyclic Redundancy Check (CRC) code is widely used in the link layer • Checksums are easy to calculate in software, so they’re ok for the transport and network layers, but here we can use hardware to calculate CRC codes for us • A.k.a. polynomial codes • The use of CRC codes provides more sophisticated error checking INFO 330 Chapter 5

  22. Cyclic Redundancy Check • CRC uses modulo-2 arithmetic, a.k.a. Boolean arithmetic • It’s equivalent to XOR (exclusive OR): • A B (A xor B) • 0 0 0 • 0 1 1 • 1 0 1 • 1 1 0 INFO 330 Chapter 5

  23. Cyclic Redundancy Check • Multiplication by 2^k moves the bits left byk places • 1011 * 2^3 = 1011000 (11*8 = 64+16+8=88) • So much for the math lesson, so what? • The CRC code defines the ‘r’ CRC bits with a value of R • There’s a generator, G, which has some value starting with 1, and has r+1 bits INFO 330 Chapter 5

  24. Cyclic Redundancy Check • Assume our data has ‘d’ bits, and is a string called D • The value of R is defined so that D * 2^r XOR R is equal to some exact integer multiple of G • (D * 2^r) XOR R = n*G • So R = remainder [D*2^r / G] INFO 330 Chapter 5

  25. Cyclic Redundancy Check • The value of G is typically predefined by IEEE standards • Standard G lengths are 8, 12, 16, and 32 bits • Hence the corresponding lengths of R are r = 7, 11, 15, and 31 bits INFO 330 Chapter 5

  26. Cyclic Redundancy Check • So how does this mess work? • Pick a length of G • Calculate R from the previous slide for each data frame, D • Send the frame • The receiver divides the d+r bits by G • If the remainder is zero, there are no errors • If the remainder is not zero, there were errors INFO 330 Chapter 5

  27. Cyclic Redundancy Check • So what? Why all this work? • Errors tend to occur in bursts – not one error all by itself • Using CRC codes allows you to catch up to ‘r’ errors in a single frame • And errors of more than ‘r’ in a frame might be caught, (1 - 0.5r)*100 percent of the time • And this will catch any number of odd errors • So that’s why we use it a lot at the link layer INFO 330 Chapter 5

  28. Multiple Access Protocols • Network links can be point-to-point (one sender and one receiver) or broadcast links • For a broadcast link • A node sends a frame to all of the other nodes • Used by wired, wireless, and satellite networks, plus the occasional cocktail party INFO 330 Chapter 5

  29. Multiple Access Protocols • This motivates the multiple access problem – how do we control transmission onto a shared broadcast channel • Frames can arrive at a node (yes, technically the adapter on that node) at the same time, producing a collision (both frames on top of each other, a mess) INFO 330 Chapter 5

  30. Multiple Access Protocols • Dozens of multiple access protocols have been defined, but they fall into three types • Channel partitioning protocols • Random access protocols • Taking-turns protocols INFO 330 Chapter 5

  31. Multiple Access Protocols • We want multiple access protocols to provide • One node can send data at a rate of R bps • If M nodes want to transmit, each can transmit an average of R/M bps • The protocol should be decentralized, so that a single point failure doesn’t take down the system • It’s cheap to implement and simple INFO 330 Chapter 5

  32. Channel Partitioning Protocols • Could use FDM or TDM (frequency or time division multiplexing) to share a channel’s bandwidth across some number of slots • Avoids collisions, which is good • But each slot only gets a fraction of the bandwidth, even if no one else is transmitting INFO 330 Chapter 5

  33. Channel Partitioning Protocols • Instead use Code Division Multiple Access (CDMA), which assigns codes to each node which sends data • CDMA is also good for avoiding signal jamming, hence is used by the military • Is used widely for wireless protocols INFO 330 Chapter 5

  34. Random Access Protocols • Here each node transmits as though it has the full channel bandwidth available • When a collision occurs, it waits a random amount of delay time before retransmitting • Keep retransmitting until the frame gets through • There are many protocols of this type, e.g. • Slotted ALOHA • ALOHA • CSMA (of which Ethernet is an example) INFO 330 Chapter 5

  35. Slotted ALOHA • Suppose • All frames have size L bits • Time is divided into slots of duration L/R seconds (= time to transmit one frame) • Nodes only transmit at the start of a slot • Nodes all know when the slots start • If a collision occurs, the nodes know that before the end of the slot occurs • There is a probability, p, between 0 and 1 INFO 330 Chapter 5

  36. Slotted ALOHA • Slotted ALOHA works like this: • When a node needs to transmit a frame, it waits until the next slot starts and transmits it • If there’s no collision, the node can transmit the next frame if needed • If there was a collision, the next time a random number is greater than p, transmit in that slot • So if the random value is less than 1-p, wait for retransmission INFO 330 Chapter 5

  37. Slotted ALOHA • This takes advantage of the link when only one node is active – it gets the full rate • If there are multiple active nodes, some slots will be wasted because nobody is transmitting • The efficiency is the percent of slots where a successful transmission occurs • The efficiency for N active nodes is N*p*(1-p)^(N-1) • Bad part is: max efficiency is only 37% INFO 330 Chapter 5

  38. ALOHA • What is we ignore the part about transmitting only at the start of a slot? • Transmit when you want to • If there’s a collision, retransmit immediately if value is >p, otherwise wait one slot duration and reevaluate retransmitting then • The icky part is that the efficiency of this is only half of Slotted ALOHA – the price for decentralized control INFO 330 Chapter 5

  39. CSMA • CSMA (Carrier Sense Multiple Access) pays attention to whether anyone else is transmitting, before a node does so • Like listening for a break in conversation before jumping in, carrier sensing listens for a break in link traffic (basic CSMA protocol) • Collision detection is done by sensing if another node starts transmitting while you are (CSMA/CD) INFO 330 Chapter 5

  40. CSMA • There are many variations on CSMA & CSMA/CD • Collisions can occur because of the time needed for transmitting frames – the channel propagation delay INFO 330 Chapter 5

  41. Taking-turns Protocols • The ALOHA and CSMA protocols both take advantage of full bandwidth when available, but neither is good at assuring fair share of throughput when multiple nodes are active • To fix the latter, taking-turns protocols have been made – hundreds of them! • We’ll focus on two major kinds • Polling protocols • Token-passing protocols INFO 330 Chapter 5

  42. Polling Protocols • Polling protocols make one node a master node • The master node polls each node in turn, and tells each node it can send some number of frames • This eliminates collisions and empty slots • But it adds a polling delay to notify each node it’s turn is up, and delays to check nodes which are inactive • And it’s really bad if the master node dies! INFO 330 Chapter 5

  43. Token-passing Protocols • Token-passing protocols have no master node, but instead pass a small token frame among the nodes in a fixed order • Each node holds the token only if they have frames to transmit, up to some max number • Then keep passing the token • Failure of ANY node crashes the network! • Or if the token isn’t released, there’s trouble • FDDI and yes, Token Ring, are examples INFO 330 Chapter 5

  44. Local Area Networks (LANs) • Local Area Networks use multiple access protocols extensively • Ethernet is the most common random access protocol • Token Ring had a slight speed advantage, so it was popular in the late 1980’s • A node sends a frame around the network, and it’s read by the recipient node • The sender removes it from the network INFO 330 Chapter 5

  45. Local Area Networks (LANs) • FDDI (Fiber Distributed Data Interface) was designed for larger LANs, specifically Metropolitan Area Networks (MANs) • Under FDDI, the destination node removes the frame from the network • Hence it isn’t a pure broadcast channel, since nodes downstream will never get the frame INFO 330 Chapter 5

  46. Link Layer Addressing • C’mon, we haven’t had an address format in at least two or three days • Here we’ll go over MAC and ARP • As stated earlier, the adapter is the real location of a link layer address • The MAC address (a.k.a. LAN address or physical address) is the link layer address of an adapter INFO 330 Chapter 5

  47. MAC Address • A MAC address usually has 6 bytes, so there are 2^48 MAC addresses • 2^48 = 281,474,976,710,656 in case you wondered • Each byte is expressed as two hexadecimal numbers (0-9; A-F for 10-15) • 01:90:4B:5F:31:13 • Letters are case-insensitive INFO 330 Chapter 5

  48. MAC Address • The IEEE makes sure each MAC address is unique • The first 24 bits are assigned to the hardware vendor; the rest are the item identifier • MAC addresses have no other structure, and shouldn’t change for a given adapter • MAC addresses were supposed to be permanent, but they can now be changed via software INFO 330 Chapter 5

  49. MAC Address • Like the IP address, the MAC address is used to verify that the destination host (adapter) has been reached • The MAC broadcast address is all F’s, analogous to the 255.255.255.255 IP address • FF:FF:FF:FF:FF:FF INFO 330 Chapter 5

  50. Address Resolution Protocol • The Address Resolution Protocol (ARP) (no, not AARP) translates between IP addresses and MAC addresses • RFC 826, and a nice tutorial in RFC 1180 • ARP only works within the local subnet • Unlike DNS, which resolves addresses anywhere • Each node (host / router) maintains an ARP table to map IP addresses & MAC addresses INFO 330 Chapter 5

More Related