1 / 36

CENG415 – Communication Networks

CENG415 – Communication Networks. Lectures 18 Data Link layer – Physical addressing – ARP – Error detection. Introduction. data-link layer has responsibility of transferring datagram from one node to adjacent node over a link Nodes : Hosts and routers

gwyn
Download Presentation

CENG415 – Communication Networks

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. CENG415 – Communication Networks Lectures 18 Data Link layer – Physical addressing – ARP – Error detection

  2. Introduction • data-link layer has responsibility of transferring datagram from one node to adjacent node over a link • Nodes: Hosts and routers • Links: communication channels that connect adjacent nodes along communication path • Layer 2 packet is a frame. The frame encapsulate the datagram. • Links are different (Ethernet, Frame Relay, 802,…) • Different link protocols are used • Each link protocol provides different services

  3. Data Link Layer - Services • The DLL receives service from physical layer and provides service to the network layer • encapsulate datagram into frame, adding header, trailer • Responsible for carrying data from one hop to the next hop

  4. Hop to hop delivery

  5. Addressing • Application layer uses specific addresses • Transport layer uses Port addresses • Network layer uses logical addresses (IP) • Link layer uses physical addresses

  6. Network Interface Card • NIC: Network Interface Card • A network interface card is used to connect a device to a network • The card provides an interface to the media In an Ethernet Network: • Each NIC is assigned an Ethernet source address by the manufacturer (stored in a PROM on the card). • MAC address allocation administered by IEEE • manufacturer buys portion of MAC address space (to assure uniqueness) NOTE: MAC Address is called physical address

  7. Physical address • Most local-area networks use a 48-bit (6-byte) physical address written as 12 hexadecimal digits; every byte (2 hexadecimal digits) is separated by a colon • Example: 07:01:02:01:2C:4B On windows system, you can perform the command GETMAC to get the MAC addresses (physical addresses of your computer)

  8. Link between Hops • Frame travels between Hops • Frame holds the Datagram • Datagram holds the segment • Segment holds the message • The IP address (logical address) is used to simulate all the Internet as homogeneous network • But the Internet is NOT • It is a collection of heterogeneous networks (separated by routers) • Within one network (LAN) the hardware is similar • The hardware understands MAC addresses only

  9. ARP: Address Resolution Protocol Problem • A wants to send datagram to B • A knows the IP of B but not its MAC address Solution • A broadcasts ARP query packet containing B’s IP Address. • Broadcasting MAC address in a LAN is FF:FF:FF:FF:FF:FF • All machines on the LAN receive ARP query • Only B reply directly to A with B’s MAC address • B can send the reply directly to A (unicast) because the request of A contains A’s MAC address • A caches (IP ,MAC) pair in its ARP table until information becomes old (times out 20 minutes). Information that times out are lost • ARP is “plug-and-play”: nodes create their ARP tables without intervention from net administrator

  10. Windows ARP command Open a command prompt window and type arp /? • ARP command is used to display and modifie the IP-to-Physical address translation tables used by address resolution protocol (ARP) IP broadcasting address for this network MAC broadcasting address in a LAN

  11. ARP in depth Consider the following LAN At startup, all ARP tables are empty Scenario 1 A broadcast an ARP request with IP of PC4 The broadcast will reach: • Router 1: You are requesting a MAC of an IP on the same network this is not my business • C2: This is not my IP so I will not reply. But I will add A’s IP and A’s MAC to my ARP table • C3: will do the same as C2 • C4: its me I will send an ARP reply directly to A with my MAC address. I will also add A’s IP and A’s MAC to my ARP table

  12. ARP in depth Consider the following LAN At startup, all ARP tables are empty Scenario 2 A is looking for an IP that is not on the same network • A knows that the IP is not on its network • A knows that only the default gateway can help • A broadcast an ARP request with IP of Router1 • The broadcast will reach: • Router 1: You this is my MAC I will send it to you directly. And I will add your IP and MAC address to my ARP table • C2: This is not my IP so I will not reply. But I will add A’s IP and A’s MAC to my ARP table • C3 and C4 : will do the same as C2

  13. LAB: ARP • We will use the packet tracer network created in lecture 16 • Open PC0 Command prompt and type arp –a • If you have entries in the ARP table clear them using arp -d • Switch to simulation mode • Type ping 192.168.1.4 (PC4) • Open the envelop (ARP) • Notice the following entries

  14. LAB: ARP • Click on Capture and Forward once. The Packet reaches the Switch. • Click on Capture and Forward again. The packet is sent to all other devices. • They all discard it except PC4 • Click on Capture and Forward again • Check the reply (unicast)

  15. ARP message format • Hardware type (HRD) • Protocol type: This field specifies the type of layer three addresses used in the message. For IPv4, this value is 2048 (0800 hex) EtherType code for the Internet Protocol • Hardware Address Length: Specifies how long hardware addresses are. The value is 6 for Ethernet or any IEEE 802 MAC addresses • Protocol Address Length: the complement of the precedingfield; specifies how long protocol (layer three) addresses are in this message. For IP(v4) addresses this value is 4

  16. ARP message format • Opcode: this field specifies the nature of the ARP message

  17. frame frame Adapter communicating datagram • sending side: • Find the corresponding MAC of the receiving node • encapsulates datagram in a frame • adds error checking bits, rdt, flow control, etc receiving node link layer protocol sending node adapter adapter • receiving side • looks for errors, rdt, flow control, etc • extracts datagram, passes to receiving node • adapter is semi-autonomous

  18. Error Detection • The objective is to detect transmission errors • With a possibility to correct errors • Error detection not 100% reliable! • protocol may miss some errors, but rarely • Frames are transmitted as follow • EDC= Error Detection and Correction bits (redundancy) Appended to the message • D = Data protected by error checking, may include header fields NOTE: larger EDC field yields better detection and correction

  19. Error Detection and Correction

  20. Parity Check – Single bit parity • Single bit parity: detects single bit error • Parity bit can be: • Even: the number of ones, including parity bit should be even Example: 01110110001  even parity bit is 0 11110011010  even parity bit is 1 • Odd: the number of ones, including parity bit should be odd Example: 01110110001  odd parity bit is 1 11110011010  odd parity bit is 0 Problems with parity bit. If two bits flip, error is not detected Even parity Original message 01110110001 received message 010101100010  error Original message 01110110001 received message 010101000010  No error

  21. Single bit parity design

  22. Hamming Distance We define: • Hamming distance: d(x, y) between two words x and y (of the same size) is the number of differences between the corresponding bits (XOR) Example: d(000, 011) = 2 since 000 ⊕ 011 = 011 (two 1s) d(10101, 11110) = 3 since 10101 ⊕ 11110 = 01011 (three 1s) • Minimum Hamming distance: is the smallest Hamming distance between all possible pairs in a set of words Example: Find the minimum Hamming distance of the words in the following table Solution: dmin = 3

  23. Hamming Distance • To guarantee the detection of up to s errors in all cases, the minimum Hamming distance in a block code must be dmin= s + 1. • To guarantee correction of up to t errors in all cases, the minimum Hamming distance in a block code must be dmin = 2t + 1. Example: A code has a Hamming distance dmin = 4. What is the error detection and correction capability the code? Solution: This code guarantees the detection of up to three errors (4 = s + 1  s = 3), but it can correct up to one error (4 = 2t + 1  t = 3/1 = 1).

  24. Block Coding In block coding, we divide our message into blocks, each of k bits, called datawords. We add r redundant bits to each block to make the length n = k + r The resulting n-bit blocks are called codewords. • With k bits, we can create a combination of 2Kdatawords • With n bits, we can create a combination of 2ncodewords Since n > k, the number of possible codewords is larger than the number of possible datawords. The block coding process is one-to-one; the same dataword is always encoded as the same codeword. This means that we have 2n− 2K codewords that are not used. We call these codewords invalid or illegal.

  25. Block Coding Error detection Error correction

  26. Linear Block Coding • In a linear block code, the exclusive OR (XOR) of any two valid codewords creates another valid codeword • The minimum Hamming distance is the number of 1s in the nonzero valid codeword with the smallest number of 1s Example: A simple parity-check code is a single-bit error-detecting code in which n = k + 1 with dmin =2 The Syndrome is the addition (⊕) of thecodeword bits Syndrome = 0meaning that the codeword is OK

  27. Linear Block Coding

  28. Cyclic Code Cyclic codes are linear codes with one extra property, if a codeword is cyclically shifted (rotated), the result is another codeword. In this lecture, we will discuss a category of cyclic codes: the cyclic redundancy check (CRC) used in networks such as LANs and WANs Example: CRC Code with C(7, 4) n=7 k = 4

  29. Cyclic Code

  30. Cyclic Code - Encoder In the encoder, the dataword has k bits (4); the codeword has n bits (7). The size of the dataword is augmented by adding n − k (3) 0s to the right-hand side of the word. The n-bit result is fed into the generator. The generator uses a divisor of size n − k + 1 (4), predefined and agreed upon. The generator divides the augmented dataword by the divisor (modulo-2 division). The quotient of the division is discarded; the remainder (r2r1r0) is appended to the dataword to create the codeword.

  31. Cyclic Code - Decoder The decoder receives the possibly corrupted codeword. A copy of all n bits is fed to the checker which is a replica of the generator. The remainder produced by the checker is a syndrome of n − k (3) bits, which is fed to the decision logic analyzer. The analyzer has a simple function. If the syndrome bits are all 0s, the 4 leftmost bits of the codeword are accepted as the dataword otherwise, the 4 bits are discarded

  32. CRC Encoder – Example

  33. CRC Decoder – Example

  34. Using polynomial A binary number can be converted to a polynomial as follow: If there is a 1 in the position i of the binary number add xi-1 to the polynomial Example: 110101  x0 + x2 + x4 + x5 = x5 + x4 + x2+ 1 1001000  x6+ x3 Dataword in the previous example 1011  x3+ x1+ 1 Divisor in the previous example = 1001110

  35. Standard polynomials In a LAN • The sender computes CRC of the message and appends the computed CRC at the end of message • The receiver computes CRC on the message and the received CRC, if result is 0 message is OK This table shows some standard polynomials used in Networking

  36. Internet Checksum 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.

More Related