CSEN 503 Introduction to Communication Networks Mervat AbuElkheir Hana Medhat Ayman Dayf **Slides are attributed to J. F. Kurose
1-2 Link Layer
Link Layer: Introduction Some terminology: hosts and routers are nodes communication channels that connect adjacent nodes along communication path are links wired links wireless links LANs layer-2 packet is a frame, encapsulates datagram data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Link Layer Functions 1-4 Framing Medium Access Control (MAC) Reliable delivery Flow control Error detection and correction
IP Address vs. MAC Address 5-5 32-bit IP address: network-layer address used to get datagram to destination IP subnet MAC (or LAN or physical or Ethernet) address: function: get frame from one interface to another physicallyconnected interface (same network) 48 bit MAC address (for most LANs) burned in NIC ROM, also sometimes software settable Each network card (adapter) has a permanent unique MAC address (a.k.a hardware address, physical address, LAN address) represented in hexadecimal notation 5: DataLink Layer
IP Address vs. MAC Address 5-6 IP Address xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx 223 191 056 008 MAC Address xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx 1C 22 F3 D1 42 A9 5: DataLink Layer
LAN Addresses and ARP 5-7 Each adapter on LAN has unique LAN address 1A-2F-BB-76-09-AD Broadcast address = FF-FF-FF-FF-FF-FF 71-65-F7-2B-08-53 LAN (wired or wireless) 58-23-D7-FA-20-B0 = adapter 0C-C4-11-6F-E3-98 5: DataLink Layer
LAN Address (more) 5-8 MAC address allocation administered by IEEE manufacturer buys portion of MAC address space (to assure uniqueness) analogy: (a) MAC address: like Social Security Number, SIN (b) IP address: like postal address MAC flat address portability can move LAN card from one LAN to another IP hierarchical address NOT portable address depends on IP subnet to which node is attached 5: DataLink Layer
MACs in Frame 1-9 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
ARP: Address Resolution Protocol 5-10 Each IP node (host, router) on LAN has ARP table 137.196.7.78 1A-2F-BB-76-09-AD ARP table: IP/MAC address mappings for some LAN nodes < IP address; MAC address; TTL> 137.196.7.23 71-65-F7-2B-08-53 LAN 137.196.7.14 58-23-D7-FA-20-B0 TTL (Time To Live): time after which address mapping will be forgotten (typically 20 min) 137.196.7.88 0C-C4-11-6F-E3-98
ARP protocol: Same LAN (network) A wants to send datagram to B, and B s MAC address not in A s ARP table. A broadcasts ARP query packet, containing B's IP address dest MAC address = FF-FF-FF-FF-FF-FF all machines on LAN receive ARP query 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
Addressing: routing to another LAN 5-12 walkthrough: send datagram from A to B via R assume A knows B s IP address 74-29-9C-E8-FF-55 A 88-B2-2F-54-1A-0F 193.154.112.111 LAN E6-E9-00-17-BB-4B 1A-23-F9-CD-06-9B 222.182.191.007 193.154.112.110 LAN 222.182.191.008 222.182.191.009 B 193.154.112.112 49-BD-D2-C7-56-2A CC-49-DE-D0-AB-7D two ARP tables in router R, one for each IP network (LAN) 5: DataLink Layer
5-13 A creates IP datagram with source A, destination B A uses ARP to get R s MAC address for 111.111.111.110 A creates link-layer frame with R's MAC address as dest, frame contains A-to-B IP datagram A s NIC sends frame R s NIC receives frame R removes IP datagram from Ethernet frame, sees its destined to B R uses ARP to get B s MAC address R creates frame containing A-to-B IP datagram sends to B 74-29-9C-E8-FF-55 A 111.111.111.111 E6-E9-00-17-BB-4B 1A-23-F9-CD-06-9B 88-B2-2F-54-1A-0F 222.222.222.221 111.111.111.112 CC-49-DE-D0-AB-7D 222.222.222.220 111.111.111.110 R 5: DataLink Layer 222.222.222.222 B 49-BD-D2-C7-56-2A
Switches and Routers 1-14 Larger networks require routers as they have better traffic isolation and can find better routes Routers Switches Traffic Isolation Yes Yes Plug and Play No Yes Optimal Routing Yes No
Multiple Access for Radio Channels 1-15 Wireless radio is a broadcast link Link divided to channels with separate frequencies Hosts compete for channel access If more than one host attempts to use the same channel at one time to transmit information, collision occurs Collision signals in the same frequency range are jammed Receiver cannot interpret signal
Multiple Access for Radio Channels 1-16 Protocols are designed to avoid collisions Design a way to give one host exclusive access to channel at a given time Protocols are designed to either: Detect and resolve collision after it happens Or prevent collision from happening
Multiple Access Radio Channels 1-17 Contention-based Methods Host may use the shared channel to transmit message at any time, hoping that no other hosts will transmit at the same time But other hosts may decide to use the shared channel at the exact same time! Protocol needs to provide a mechanism for retransmitting collided messages Random access protocols allow an host to retransmit a collided message only after a random delay
Multiple Access Pure ALOHA 1-18 Developed in the 70s @ University of Hawaii Each MS generates packets, all with fixed transmission length T If host is trying to send/resend a packet, it cannot generate a new packet
Pure ALOHA - Protocol 1-19 1. When host has a packet to send, it sends it right away 2. If sender host detects data from another host, it concludes that a collision has occurred 3. If collision occurs, packet is retransmitted after random delay
Slotted ALOHA 1-20 Proposed to improve the throughput of Pure ALOHA Use slotted time with slot size equal to packet transmission duration Improves Pure ALOHA by reducing the length of the vulnerable period to a single slot But synchronization of time slots between hosts is crucial
Slotted ALOHA Protocol 1-21 If host has a packet to send, it waits until the beginning of the next slot before it sends the packet Transmission will be successful if and only if exactly one packet is scheduled for current slot Full collision; no partial collisions What does partial collision mean?
Carrier Sense Multiple Access/Collision 1-22 Detection Improve throughput of ALOHA and slotted ALOHA Support high-speed communications Attempt to prevent collisions! Listen to channel before transmit to check if other hosts are using it
CSMA/CD 1-23 1. When MS has packet to send, it senses channel 2. If channel is busy, host waits until channel becomes idle 3. If channel is idle, host transmits packet immediately 4. If collision is detected during transmission, host aborts transmission and attempts retransmit after random time period
A Day in the Life of a Webpage Request GUC 68.85.2.0/24 DNS Server 68.87.71.226 Bob 00:16:D3:23:63:8A ISP 68.80.0.0/13 00:22:6B:45:1F:1B 68.85.2.1 Bob wishes to retrieve a page from www.google.com Bob has just booted up the computer www.google.com 68.233.169.105 Google 68.233.160.0/19
A Day in the Life of a Webpage Request 68 67 0.0.0.0 255.255.255.255 00:16:D3:23:63:8A FF:FF:FF:FF:FF:FF GUC 68.85.2.0/24 DNS Server 68.87.71.226 Bob 00:16:D3:23:63:8A ISP 68.80.0.0/13 00:22:6B:45:1F:1B 68.85.2.1 Yiaddr: 68.85.2.101 67 68 68.85.2.1 255.255.255.255 00:22:6B:45:1F:1B 00:16:D3:23:63:8A DHCP ACK also includes IP of default gateway (router in this case) and DNS server www.google.com 68.233.169.105 Google 68.233.160.0/19 25
A Day in the Life of a Webpage Request ARP Query 68.85.2.101 68.85.2.1 00:16:D3:23:63:8A FF:FF:FF:FF:FF:FF GUC 68.85.2.0/24 DNS Server 68.87.71.226 Bob 00:16:D3:23:63:8A 68.85.2.101 ISP 68.80.0.0/13 00:22:6B:45:1F:1B 68.85.2.1 ARP Reply 68.85.2.1 68.85.2.101 00:22:6B:45:1F:1B 00:16:D3:23:63:8A Before sending a DNS query, Bob must first discover the MAC address of the router through ARP www.google.com 68.233.169.105 Google 68.233.160.0/19 26
A Day in the Life of a Webpage Request DNS query: www.google.com 61334 53 68.85.2.101 68.87.71.226 00:16:D3:23:63:8A 00:22:6B:45:1F:1B GUC 68.85.2.0/24 DNS reply: 68.233.169.105 53 61334 68.87.71.226 68.85.2.101 MAC of DNS MAC of default R DNS Server 68.87.71.226 Bob 00:16:D3:23:63:8A 68.85.2.101 ISP 68.80.0.0/13 00:22:6B:45:1F:1B 68.85.2.1 To send HTTP request, Bob s browser has to create a TCP socket. Thus, it needs the IP address of www.google.com www.google.com 68.233.169.105 Google 68.233.160.0/19 27
A Day in the Life of a Webpage Request 52122 80 68.85.2.101 68.233.169.105 00:16:D3:23:63:8A 00:22:6B:45:1F:1B GUC 68.85.2.0/24 DNS Server 68.87.71.226 Bob 00:16:D3:23:63:8A 68.85.2.101 ISP 68.80.0.0/13 00:22:6B:45:1F:1B 68.85.2.1 To establish TCP connection, TCP SYN packet is sent 80 52122 68.233.169.105 68.85.2.101 www.google.com 68.233.169.105 Google 68.233.160.0/19 MAC of web server MAC of default R 28
A Day in the Life of a Webpage Request HTTP Request: google search 52122 80 68.85.2.101 68.233.169.105 00:16:D3:23:63:8A 00:22:6B:45:1F:1B GUC 68.85.2.0/24 DNS Server 68.87.71.226 Bob 00:16:D3:23:63:8A 68.85.2.101 ISP 68.80.0.0/13 00:22:6B:45:1F:1B 68.85.2.1 Finally HTTP request can be sent HTTP Reply: search results 80 52122 68.233.169.105 68.85.2.101 www.google.com 68.233.169.105 Google 68.233.160.0/19 MAC of web server MAC of default R 29