Computer Networks Lecture 5.0 - Link Layer and LANs PDF
Document Details
Uploaded by CostEffectiveObsidian824
Alexandria University
2024
Sahar M. Ghanem
Tags
Related
- Computer Networks Admin - Data Link Technology - PDF
- COM204 Computer Networks Chapter 3 PDF
- CNT 4007 - Computer Networks I: Link Layer Lecture (Fall 2024) PDF
- CSC 2773 LAN Technologies PDF
- Reti (Computer Networks) - Capitolo 6 - Livello Data Link - 2024/2025 PDF
- Computer Networks LEC #8 DataLink Layer PDF
Summary
This is a lecture on computer networks, focusing on the link layer and local area networks. It covers topics such as error detection techniques and multiple access protocols.
Full Transcript
Computer Networks The Link Layer and LANs Prof. Dr. Sahar M. Ghanem Associate Professor Computer and Systems Engineering Department Faculty of Engineering, Alexandria University Outline Introduction to the Link Layer Error-Detection and -Correction Techniques Multipl...
Computer Networks The Link Layer and LANs Prof. Dr. Sahar M. Ghanem Associate Professor Computer and Systems Engineering Department Faculty of Engineering, Alexandria University Outline Introduction to the Link Layer Error-Detection and -Correction Techniques Multiple Access Links and Protocols Switched Local Area Networks Link Virtualization: A Network as a Link Layer Data Center Networking Retrospective: A Day in the Life of a Web Page Request Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 2 Introduction to the Link Layer Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 3 Introduction (1/2) There are two fundamentally different types of link-layer channels. The first type are broadcast channels, which connect multiple hosts in wireless LANs, in satellite networks, and in hybrid fiber-coaxial cable (HFC) access networks. The second type of link-layer channel is the point-to-point communication link, such as that often found between two routers connected by a long-distance link, or between a user’s office computer and the nearby Ethernet switch to which it is connected. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 4 Introduction (2/2) Any device that runs a link-layer (i.e., layer 2) protocol is referred to as a node that includes hosts, routers, switches, and WiFi access points. The communication channels that connect adjacent nodes along the communication path are referred to as links. In order for a datagram to be transferred from source host to destination host, it must be moved over each of the individual links in the end-to-end path. Over a given link, a transmitting node encapsulates the datagram in a link-layer frame and transmits the frame into the link. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 5 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 6 Possible Services Provided by the Link Layer Framing. The structure of the frame is specified by the link-layer protocol. Link access. A medium access control (MAC) protocol specifies the rules by which a frame is transmitted onto the link. When multiple nodes share a single broadcast link, there is the so-called multiple access problem. Reliable delivery. A link-layer reliable delivery service is often used for links that are prone to high error rates, such as a wireless link, for correcting an error locally. Error detection and correction. Bit errors are introduced by signal attenuation and electromagnetic noise. Error detection in the link layer is usually implemented in hardware. Error correction determines exactly where in the frame the errors have occurred and then corrects these errors. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 7 Where Is the Link Layer Implemented? Much of a link-layer controller’s functionality is implemented in hardware. The Ethernet capabilities are either integrated into the motherboard chipset or implemented via a low-cost dedicated Ethernet chip (network adapter/network interface controller (NIC)). Part of the link layer is implemented in software for functionality such as assembling link-layer addressing information and activating the controller hardware. On the receiving side, link-layer software responds to controller interrupts, handling error conditions and passing a datagram up to the network layer. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 8 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 9 Error-Detection and –Correction Techniques Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 10 Overview The data to be protected includes the datagram and also link-level addressing information, sequence numbers, and other fields in the link frame header. At the sending node, data, D, to be protected against bit errors is augmented with error-detection and -correction bits (EDC). At the receiving node, a sequence of bits, D’ and EDC’ is received that may differ as a result of in-transit bit flips. Even with the use of error-detection bits there still may be undetected bit errors. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 11 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 12 Parity Checks (1/3) The simplest form of error detection is the use of a single parity bit. In an even parity scheme, the sender simply includes one additional bit and chooses its value such that the total number of 1s in the d + 1 bits is even. The receiver need only count the number of 1s in the received d + 1 bits. If the probability of bit errors is small and errors can be assumed to occur independently, the probability of multiple bit errors in a packet would be extremely small. However, measurements have shown that, rather than occurring independently, errors are often clustered together in “bursts.” Using single-bit, undetected errors can approach 50 percent. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 13 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 14 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 15 Parity Checks (2/3) A two-dimensional generalization of the single-bit parity: the d bits in D are divided into i rows and j columns a parity value is computed for each row and for each column the resulting i + j + 1 parity bits comprise the error-detection bits If a single bit error occurs, the parity of both the column and the row containing the flipped bit will be in error. The receiver can thus use the column and row indices to identify the bit that was corrupted. A single error in the parity bits themselves is also detectable and correctable. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 16 Parity Checks (3/3) Two-dimensional parity can also detect (but not correct!) any combination of two errors in a packet. The ability of the receiver to both detect and correct errors is known as forward error correction (FEC). Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 17 Checksumming Methods (1/2) The d bits of data are treated as a sequence of k-bit integers. Sum these k-bit integers and use the resulting sum as the error- detection bits. In the TCP and UDP protocols, the Internet checksum is computed over all fields (header and data fields included). In IP, the checksum is computed over the IP header. Checksumming methods require relatively little packet overhead. However, they provide relatively weak protection against errors. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 18 Checksumming Methods (2/2) Checksumming used at the transport layer and cyclic redundancy check (CRC) used at the link layer. Because transport-layer error detection is implemented in software, it is important to have a simple and fast error-detection scheme. Error detection at the link layer is implemented in dedicated hardware in adapters, which can rapidly perform the more complex CRC operations. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 19 Cyclic Redundancy Check (CRC) (1/4) CRC codes are also known as polynomial codes, since it views the bit string as a polynomial whose coefficients are the 0 and 1 values in the bit string. The sender and receiver must first agree on an 𝒓 + 𝟏 bit pattern, known as a generator, which we will denote as 𝑮 (the most significant bit of G be a 1). Consider the 𝒅-bit piece of data, 𝑫. The sender will choose 𝒓 additional bits, 𝑹, and append them to 𝑫 such that the resulting 𝒅 + 𝒓 bit pattern is exactly divisible by 𝑮 using modulo-2 arithmetic. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 20 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 21 Cyclic Redundancy Check (CRC) (2/4) Addition and subtraction are identical, and both are equivalent to the bitwise exclusive-or (XOR) of the operands. Multiplication and division are the same as in base-2 arithmetic, except that any required addition or subtraction is done without carries or borrows. Multiplication by 𝟐𝒌 left shifts a bit pattern by 𝒌 places. (𝑫 × 𝟐𝒓 ) 𝑿𝑶𝑹 𝑹 yields the 𝒅 + 𝒓 bit pattern. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 22 Cyclic Redundancy Check (CRC) (3/4) Find 𝑹 such that 𝑫 × 𝟐𝒓 𝑿𝑶𝑹 𝑹 = 𝒏𝑮 𝑫 × 𝟐𝒓 = 𝒏𝑮 𝑿𝑶𝑹 𝑹 𝑫 × 𝟐𝒓 𝑹 = 𝒓𝒆𝒎𝒂𝒊𝒏𝒅𝒆𝒓 𝑮 Example: 𝐷 = 101110 ; 𝑑 = 6 𝐺 = 1001; 𝑟 = 3 𝑅 = 011 bits transmitted are 101 110 011 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 23 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 24 Cyclic Redundancy Check (CRC) (4/4) International standards have been defined for 8-, 12-, 16-, and 32-bit generators, 𝑮. Each of the CRC standards can detect burst errors of fewer than 𝑟 + 1 bits. In some cases, burst of length greater than 𝑟 + 1 bits can be detected with probability 1 − 0.5𝑟. Can detect any odd number of bit errors. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 25 Multiple Access Links and Protocols Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 26 Multiple Access Problem A point-to-point link consists of a single sender at one end of the link and a single receiver at the other end of the link. The point-to-point protocol (PPP) and high-level data link control (HDLC) are two such protocols. A broadcast link, can have multiple sending and receiving nodes all connected to the same, single, shared broadcast channel. Ethernet and wireless LANs are examples of broadcast link-layer technologies. Multiple access problem: how to coordinate the access of multiple sending and receiving nodes to a shared broadcast channel. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 27 Broadcast Human Protocols As humans, we’ve evolved an elaborate set of protocols for sharing the broadcast channel: “Give everyone a chance to speak.” “Don’t speak until you are spoken to.” “Don’t monopolize the conversation.” “Raise your hand if you have a question.” “Don’t interrupt when someone is speaking.” “Don’t fall asleep when someone is talking.” Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 28 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 29 MAC collision Because all nodes are capable of transmitting frames, more than two nodes can transmit frames at the same time. When this happens, all of the nodes receive multiple frames at the same time; that is, the transmitted frames collide at all of the receivers. The signals of the colliding frames become inextricably tangled together. All the frames involved in the collision are lost, and the broadcast channel is wasted during the collision interval. The coordination job is the responsibility of the multiple access protocol. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 30 MAC protocols classification Multiple access protocols can be classified as belonging to one of three categories: channel partitioning protocols, random access protocols, and taking-turns protocols. Desirable characteristics: 1. When only one node has data to send, that node has a throughput of R bps. 2. When M nodes have data to send, each of these nodes has an average throughput of R/M bps. 3. The protocol is decentralized; that is, there is no master node that represents a single point of failure for the network. 4. The protocol is simple, so that it is inexpensive to implement. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 31 Channel Partitioning Protocols (1/2) Time-division multiplexing (TDM) and frequency-division multiplexing (FDM) are two techniques that can be used to partition a broadcast channel’s bandwidth among all nodes sharing that channel. TDM is appealing because it eliminates collisions and is perfectly fair but has two problems: a node is limited to an average rate of R/N bps even when it is the only node with packets to send. a node must always wait for its turn in the transmission sequence Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 32 Channel Partitioning Protocols (2/2) FDM divides the R bps channel into different frequencies (each with a bandwidth of R/N) and assigns each frequency to one of the N nodes. FDM shares both the advantages and drawbacks of TDM. Code division multiple access (CDMA) assigns a different code to each node. Each node then uses its unique code to encode the data bits it sends. If the codes are chosen carefully, CDMA nodes can transmit simultaneously and yet have their respective receivers correctly receive a sender’s encoded data bits in spite of interfering transmissions by other nodes. CDMA is used in cellular telephony and wireless channels. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 33 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 34 Random Access Protocols A transmitting node always transmits at the full rate of the channel, namely, R bps. When there is a collision, each node involved in the collision repeatedly retransmits its frame until its frame gets through without a collision. A node waits a random delay before retransmitting the frame. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 35 Random Access Protocol: Slotted ALOHA (1/5) Assumptions: All frames consist of exactly L bits. Time is divided into slots of size L/R seconds (to transmit one frame). Nodes start to transmit frames only at the beginnings of slots. Nodes are synchronized. If two or more frames collide in a slot, then all the nodes detect the collision event before the slot ends. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 36 Random Access Protocol: Slotted ALOHA (2/5) When the node has a fresh frame to send, it waits until the beginning of the next slot. If there isn’t a collision, the node can prepare a new frame for transmission. If there is a collision, node retransmits its frame in each subsequent slot with probability p until the frame is transmitted without a collision. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 37 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 38 Random Access Protocol: Slotted ALOHA (3/5) Slotted ALOHA allows a node to transmit continuously at the full rate, R, when that node is the only active node and is also highly decentralized. It require the slots to be synchronized in the nodes. Two possible efficiency concerns: When there are multiple active nodes, a certain fraction of the slots will have collisions and will therefore be “wasted.” Another fraction of the slots will be empty because all active nodes refrain from transmitting as a result of the probabilistic transmission policy. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 39 Random Access Protocol: Slotted ALOHA (4/5) The efficiency of the protocol is defined to be the long-run fraction of successful slots in the case when there are a large number of active nodes, each always having a large number of frames to send. If no form of access control were used, and each node were to immediately retransmit after each collision, the efficiency would be zero. Assume each node attempts to transmit a frame in each slot with probability 𝒑. Suppose there are 𝑵 nodes. The probability a given node has a success is 𝑝(1 − 𝑝)𝑁−1. The probability that any one of the 𝑵 nodes has a success is 𝑵𝒑(𝟏 − 𝒑)𝑵−𝟏 and is the efficiency of slotted ALOHA. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 40 Random Access Protocol: Slotted ALOHA (5/5) And to obtain the maximum efficiency for a large number of active nodes, we take the limit of 𝑵𝒑∗ (𝟏 − 𝒑∗ )𝑵−𝟏 as 𝑁 approaches infinity. The maximum efficiency of the protocol is given by 𝟏/𝒆 = 𝟎. 𝟑𝟕. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 41 Random Access Protocol: ALOHA (1/3) The slotted ALOHA protocol required that all nodes synchronize their transmissions to start at the beginning of a slot. In pure ALOHA, when a frame first arrives, the node immediately transmits the frame in its entirety into the broadcast channel. If a transmitted frame experiences a collision, the node will then immediately retransmit the frame with probability p. Otherwise, the node waits for a frame transmission time. After this wait, it then transmits the frame with probability p, or waits for another frame time with probability 1 – p. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 42 Random Access Protocol: ALOHA (2/3) Assume, the frame transmission time is the unit of time. At any given time, the probability that a node is transmitting a frame is 𝒑. Suppose this frame begins transmission at time 𝒕𝟎. In order for this frame to be successfully transmitted, no other nodes can begin their transmission in the interval of time [𝒕𝟎 − 𝟏, 𝒕𝟎 ]. The probability that all other nodes do not begin a transmission in this interval is (𝟏 − 𝒑)𝑵−𝟏. Similarly, no other node can begin a transmission while node i is transmitting. The probability that all other nodes do not begin a transmission in this interval is also (𝟏 − 𝒑)𝑵−𝟏. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 43 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 44 Random Access Protocol: ALOHA (3/3) The probability that a given node has a successful transmission is 𝒑(𝟏 − 𝒑)𝟐(𝑵−𝟏). By taking limits as in the slotted ALOHA case, the maximum efficiency of the pure ALOHA protocol is only 𝟏/(𝟐𝒆). Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 45 Random Access Protocol: CSMA (1/2) In ALOHA, a node neither pays attention to whether another node happens to be transmitting when it begins to transmit, nor stops transmitting if another node begins to interfere with its transmission. For polite human conversation: Listen before speaking (called carrier sensing); If someone else begins talking at the same time, stop talking (called collision detection) We’ll consider characteristics of Carrier Sense Multiple Access (CSMA) and CSMA with collision detection CSMA/CD. Why, if all nodes perform carrier sensing, do collisions occur? Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 46 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 47 Random Access Protocol: CSMA (2/2) Example: Figure shows a space-time diagram of four nodes (A, B, C, D) attached to a linear broadcast bus. At time t0, node B senses the channel is idle. It thus begins transmitting, with its bits propagating in both directions. A nonzero amount of time is needed for B’s bits actually to propagate (channel propagation delay). At time t1 (t1 > t0), node D has a frame to send. D senses the channel idle at t1. A short time later, B’s transmission begins to interfere with D’s transmission at D. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 48 Random Access Protocol: CSMA/CD (1/6) Carrier Sense Multiple Access with Collision Detection: the two nodes each abort their transmission a short time after detecting a collision. It helps the protocol performance by not transmitting a useless, damaged frame in its entirety. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 49 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 50 Random Access Protocol: CSMA/CD (2/6) Summary of CSMA/CD operation: 1. The adapter prepares a link-layer frame, and puts the frame adapter buffer. 2. If the adapter senses that the channel is idle, it starts to transmit the frame. If, the adapter senses that the channel is busy, it waits until it senses no signal energy and then starts to transmit the frame. 3. While transmitting, the adapter monitors for the presence of signal energy coming from other adapters. 4. If, the adapter detects signal energy from other adapters while transmitting, it aborts the transmission. 5. After aborting, the adapter waits a random amount of time and then returns to step 2. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 51 Random Access Protocol: CSMA/CD (3/6) What is a good interval of time from which to choose the random back off time? If the interval is large and the number of colliding nodes is small, nodes are likely to wait a large amount of time. If the interval is small and the number of colliding nodes is large, it’s likely that transmitting nodes will again collide. We’d like is an interval that is short when the number of colliding nodes is small, and long when the number of colliding nodes is large. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 52 Random Access Protocol: CSMA/CD (4/6) The binary exponential back off algorithm (used in Ethernet): When transmitting a frame that has already experienced 𝒏 collisions, a node chooses the value of 𝑲 at random from {𝟎, 𝟏, 𝟐,.... 𝟐𝒏 − 𝟏}. The actual amount of time a node waits is 𝑲 × 𝟓𝟏𝟐 bit times and the maximum value that 𝒏 can take is capped at 10. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 53 Random Access Protocol: CSMA/CD (5/6) Example: Suppose that a node attempts to transmit a frame for the first time and while transmitting it detects a collision. The node chooses K = 0 with probability 0.5 or chooses K = 1 with probability 0.5. If K = 0, then it immediately begins sensing the channel. If K = 1, it waits 512 bit times (e.g., 5.12 microseconds for a 100 Mbps Ethernet) before beginning the sense-and-transmit-when-idle cycle. After a second collision, K is chosen with equal probability from {0,1,2,3}. After 10 or more collisions, K is chosen from {0,1,2,... , 1023}. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 54 Random Access Protocol: CSMA/CD (6/6) The efficiency of CSMA/CD is defined to be the long-run fraction of time during which frames are being transmitted on the channel without collisions when there is a large number of active nodes, with each node having a large number of frames to send. Let 𝒅𝒑𝒓𝒐𝒑 denote the maximum time it takes signal energy to propagate between any two adapters. Let 𝒅𝒕𝒓𝒂𝒏𝒔 be the time to transmit a maximum- size frame. 𝑬𝒇𝒇𝒊𝒄𝒊𝒆𝒏𝒄𝒚 = 𝟏/(𝟏 + 𝟓𝒅𝒑𝒓𝒐𝒑 /𝒅𝒕𝒓𝒂𝒏𝒔 ) As 𝒅𝒑𝒓𝒐𝒑 approaches 0, the efficiency approaches 1 (colliding nodes will abort immediately). As 𝒅𝒕𝒓𝒂𝒏𝒔 becomes very large, efficiency approaches 1 (when a frame grabs the channel, it will hold on to the channel for a very long time). Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 55 Taking-Turns Protocols: polling (1/2) The polling protocol requires one of the nodes to be designated as a master node. The master node polls each of the nodes in a round-robin fashion. The master node first sends a message to node 1, saying that it can transmit up to some maximum number of frames. After node 1, the master node tells node 2, … The master node can determine when a node has finished sending its frames by observing the lack of a signal on the channel. This allows polling to achieve a much higher efficiency. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 56 Taking-Turns Protocols: polling (2/2) The first drawback is that the protocol introduces a polling delay. If, for example, only one node is active, then the node will transmit at a rate less than R bps. The second drawback, is that if the master node fails, the entire channel becomes inoperative. The Bluetooth protocol, is an example of a polling protocol. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 57 Taking-Turns Protocols: token-passing (1/2) A small, special-purpose frame known as a token is exchanged among the nodes in some fixed order. When a node receives a token, it holds onto the token only if it has some frames to transmit; otherwise, it immediately forwards the token to the next node. If a node does have frames to transmit when it receives the token, it sends up to a maximum number of frames and then forwards the token to the next node. Token passing is decentralized and highly efficient. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 58 Taking-Turns Protocols: token-passing (2/2) The failure of one node can crash the entire channel. If a node accidentally neglects to release the token, then some recovery procedure must be invoked to get the token back in circulation. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 59 The Link-Layer Protocol for Cable Internet Access The Data-Over-Cable Service Interface Specifications (DOCSIS) specifies the cable data network architecture and its protocols. DOCSIS makes for a case study, where we’ll find aspects of each of the three classes of multiple access protocols (channel partitioning protocols, random access protocols, and taking turns protocols) with the cable access network! Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 60 Summary Introduction to the Link Layer Error-Detection and -Correction Techniques Multiple Access Links and Protocols Switched Local Area Networks Link Virtualization: A Network as a Link Layer Data Center Networking Retrospective: A Day in the Life of a Web Page Request Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 61