CSCI 4760 - Computer Networks Fall 2016
Instructor: Prof. Roberto Perdisci perdisci@cs.uga.edu
source: computer-networks-webdesign.com
These slides are adapted from the textbook slides by J.F. Kurose and K.W. Ross
CSCI 4760 - Computer Networks Fall 2016 Instructor: Prof. Roberto - - PowerPoint PPT Presentation
source: computer-networks-webdesign.com CSCI 4760 - Computer Networks Fall 2016 Instructor: Prof. Roberto Perdisci perdisci@cs.uga.edu These slides are adapted from the textbook slides by J.F. Kurose and K.W. Ross Chapter 5: The Data Link
Instructor: Prof. Roberto Perdisci perdisci@cs.uga.edu
source: computer-networks-webdesign.com
These slides are adapted from the textbook slides by J.F. Kurose and K.W. Ross
5: DataLink Layer 5-2
} error detection, correction } sharing a broadcast channel: multiple access } link layer addressing } reliable data transfer, flow control: done!
5: DataLink Layer 5-3
5: DataLink Layer 5-4
} hosts and routers are nodes } communication channels that
} wired links } wireless links } LANs
} layer-2 packet is a frame,
5: DataLink Layer 5-5
} e.g., Ethernet on first link, frame
} e.g., may or may not provide rdt
} trip from Princeton to Lausanne } limo: Princeton to JFK } plane: JFK to Geneva } train: Geneva to Lausanne
5: DataLink Layer 5-6
} encapsulate datagram into frame, adding header, trailer } channel access if shared medium } “MAC” addresses used in frame headers to identify source, dest } different from IP address!
} we learned how to do this already (chapter 3)! } 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?
5: DataLink Layer 5-7
} pacing between adjacent sending and receiving nodes
} errors caused by signal attenuation, noise. } receiver detects presence of errors: } signals sender for retransmission or drops frame
} receiver identifies and corrects bit error(s) without resorting to
} with half duplex, nodes at both ends of link can transmit, but not at same
5-8
} Ethernet card, PCMCI card,
} implements link, physical layer
controller physical transmission cpu memory host bus (e.g., PCI) network adapter card host schematic application transport network link link physical
5: DataLink Layer 5-9
} encapsulates datagram in frame } adds error checking bits, rdt,
} looks for errors, rdt, flow
} extracts datagram, passes to
controller controller
sending host receiving host
datagram datagram datagram
frame
5: DataLink Layer 5-10
5: DataLink Layer 5-11
} PPP for dial-up access } point-to-point link between Ethernet switch and host
} old-fashioned Ethernet } upstream HFC } 802.11 wireless LAN
shared wire (e.g., cabled Ethernet) shared RF (e.g., 802.11 WiFi) shared RF (satellite) humans at a cocktail party (shared air, acoustical)
5: DataLink Layer 5-12
} collision if node receives two or more signals at the same time
} no out-of-band channel for coordination
5: DataLink Layer 5-13
} no special node to coordinate transmissions } no synchronization of clocks, slots
5: DataLink Layer 5-14
} divide channel into smaller “pieces” (time slots, frequency, code) } allocate piece to node for exclusive use
} channel not divided, allow collisions } “recover” from collisions
} nodes take turns, but nodes with more to send can take longer
5: DataLink Layer 5-15
1 3 4 1 3 4 6-slot frame
5: DataLink Layer 5-16
5: DataLink Layer 5-17
} transmit at full channel data rate R. } no a priori coordination among nodes
} how to detect collisions } how to recover from collisions (e.g., via delayed retransmissions)
} slotted ALOHA } ALOHA } CSMA, CSMA/CD, CSMA/CA
5: DataLink Layer 5-18
} if no collision: node can send
} if collision: node retransmits
5: DataLink Layer 5-19
5: DataLink Layer 5-20
} suppose: N nodes with many
} prob that given node has
} prob that any node has a
} max efficiency: find p* that
} for many nodes, take limit of
Max efficiency = 1/e = .37
5: DataLink Layer 5-21
} transmit immediately
} frame sent at t0 collides with other frames sent in [t0-1,t0+1]
5: DataLink Layer 5-22
= p . (1-p)2(N-1)
… choosing optimum p and then letting n -> infty ... = 1/(2e) = .18
5: DataLink Layer 5-23
5: DataLink Layer 5-24
spatial layout of nodes
5: DataLink Layer 5-25
} collisions detected within short time } colliding transmissions aborted, reducing channel wastage
} easy in wired LANs: measure signal strengths, compare
} difficult in wireless LANs: received signal strength overwhelmed
5: DataLink Layer 5-26
5: DataLink Layer 5-27
} share channel efficiently and fairly at high load } inefficient at low load: delay in channel access, 1/N bandwidth
} efficient at low load: single node can fully utilize channel } high load: collision overhead
5: DataLink Layer 5-28
} polling overhead } latency } single point of failure
poll data data
5: DataLink Layer 5-29
❍ token overhead ❍ latency ❍ single point of failure
5: DataLink Layer 5-30
} Time Division, Frequency Division
} ALOHA, S-ALOHA, CSMA, CSMA/CD } carrier sensing: easy in some technologies (wire), hard in others
} CSMA/CD used in Ethernet } CSMA/CA used in 802.11
} polling from central site, token passing } Bluetooth, FDDI, IBM Token Ring
5: DataLink Layer 5-31
5: DataLink Layer 5-32
} network-layer address } used to get datagram to destination IP subnet
} function: get frame from one interface to another physically-
} 48 bit MAC address (for most LANs)
} 3 bytes for organization-specific prefix + 3 bytes to identify the card } burned in NIC ROM, also sometimes software settable
5: DataLink Layer 5-33
1A-2F-BB-76-09-AD 58-23-D7-FA-20-B0 0C-C4-11-6F-E3-98 71-65-F7-2B-08-53
5: DataLink Layer 5-34
} can move LAN card from one LAN to another
} address depends on IP subnet to which node is attached
5: DataLink Layer 5-35
}
TTL (Time To Live): time after
1A-2F-BB-76-09-AD 58-23-D7-FA-20-B0 0C-C4-11-6F-E3-98 71-65-F7-2B-08-53
137.196.7.23 137.196.7.78 137.196.7.14 137.196.7.88
5: DataLink Layer 5-36
} A wants to send datagram to B,
} A broadcasts ARP query packet,
} dest MAC address = FF-FF-
} all machines on LAN receive
} B receives ARP packet, replies to
} frame sent to A’s MAC address
} A caches (saves) IP-to-MAC
} soft state: information that
} nodes create their ARP tables
5: DataLink Layer 5-37
1A-23-F9-CD-06-9B 222.222.222.220 111.111.111.110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D 111.111.111.112 111.111.111.111
74-29-9C-E8-FF-55 222.222.222.221 88-B2-2F-54-1A-0F
222.222.222.222 49-BD-D2-C7-56-2A
5: DataLink Layer 5-38
} 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
} 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
1A-23-F9-CD-06-9B 222.222.222.220 111.111.111.110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D 111.111.111.112 111.111.111.111
74-29-9C-E8-FF-55 222.222.222.221 88-B2-2F-54-1A-0F
222.222.222.222 49-BD-D2-C7-56-2A
5: DataLink Layer 5-39
5: DataLink Layer 5-40
5: DataLink Layer 5-41
} all nodes in same collision domain (can collide with each other)
} active switch in center } each node runs a (separate) Ethernet protocol (nodes do not
switch
5: DataLink Layer 5-42
5: DataLink Layer 5-43
} if adapter receives frame with matching destination address, or with
} otherwise, adapter discards frame
5: DataLink Layer 5-44
} stream of datagrams passed to network layer can have gaps (missing
} gaps will be filled if app is using TCP } otherwise, app will see gaps
5: DataLink Layer 5-45
5: DataLink Layer 5-46
} Goal: adapt retransmission
} heavy load: random wait will be
} first collision: choose K from {0,1};
} after second collision: choose K
} after ten collisions, choose K from
5: DataLink Layer 5-47 } Tprop = max prop delay between 2 nodes in LAN } ttrans = time to transmit max-size frame } efficiency goes to 1 } as tprop goes to 0 } as ttrans goes to infinity } better performance than ALOHA: and simple, cheap, decentralized!
5: DataLink Layer 5-48
} common MAC protocol and frame format } different speeds: 2 Mbps, 10 Mbps, 100 Mbps, 1Gbps, 10G
} different physical layer media: fiber, cable
MAC protocol and frame format
100BASE-TX 100BASE-T4 100BASE-FX 100BASE-T2 100BASE-SX 100BASE-BX
5: DataLink Layer 5-49
} used in 10BaseT } each bit has a transition } allows clocks in sending and receiving nodes to synchronize to
} no need for a centralized, global clock among nodes!
} Hey, this is physical-layer stuff!
5: DataLink Layer 5-50
5: DataLink Layer 5-51
} bits coming in one link go out all other links at same rate } all nodes connected to hub can collide with one another } no frame buffering } no CSMA/CD at hub: host NICs detect collisions
twisted pair hub
5: DataLink Layer 5-52
} store, forward Ethernet frames } examine incoming frame’s MAC address, selectively forward
} hosts are unaware of presence of switches
} switches do not need to be configured
5: DataLink Layer 5-53
} each link is its own collision domain
} not possible with dumb hub
5: DataLink Layer 5-54
} (MAC address of host, interface to
} something like a routing protocol?
5: DataLink Layer 5-55
} when frame received, switch
} records sender/location pair in
Source: A Dest: A’
5: DataLink Layer 5-56
5: DataLink Layer 5-57
Source: A Dest: A’
5: DataLink Layer 5-58
5: DataLink Layer 5-59
5: DataLink Layer 5-60
5: DataLink Layer 5-61
} both store-and-forward devices
} routers: network layer devices (examine network layer headers) } switches are link layer devices
} routers maintain routing tables, implement routing algorithms } switches maintain switch tables, implement filtering, learning
5: DataLink Layer 5-62
} Send Eth packets with spoofed src-MAC to the switch } Objective: fill the MAC-to-NIC map } Result: switch gets flooded, all frames will be broadcasted and
} Can be more targeted } Objective: Poison the ARP table of a host X } How? Attacker
} Result: Man-in-the-Middle Attack!
5: DataLink Layer 5-63
5: DataLink Layer 5-64
} application, transport, network, link
} goal: identify, review, understand protocols (at all layers)
} scenario: student attaches laptop to campus network,
5: DataLink Layer 5-65
Comcast network 68.80.0.0/13 Google’s network 64.233.160.0/19 64.233.169.105 web server DNS server school network 68.80.2.0/24
browser web page
5: DataLink Layer 5-66
} connecting laptop needs to get
DHCP UDP IP Eth Phy
DHCP DHCP DHCP DHCP DHCP
DHCP UDP IP Eth Phy
DHCP DHCP DHCP DHCP DHCP
❒ DHCP request encapsulated
❒ Ethernet frame broadcast
❒ Ethernet demux’ed to IP
5: DataLink Layer 5-67 } DHCP server formulates
DHCP UDP IP Eth Phy
DHCP DHCP DHCP DHCP
DHCP UDP IP Eth Phy
DHCP DHCP DHCP DHCP DHCP
❒ encapsulation at DHCP
❒ DHCP client receives DHCP
5: DataLink Layer 5-68
} before sending HTTP request, need IP
DNS UDP IP Eth Phy
DNS DNS DNS
❒ DNS query created, encapsulated
❒ client now knows MAC address
ARP query
Eth Phy
ARP ARP ARP reply
5: DataLink Layer 5-69
DNS UDP IP Eth Phy
DNS DNS DNS DNS DNS
❒ IP datagram containing DNS
❒ IP datagram forwarded from
❒ demux’ed to DNS server ❒ DNS server replies to
Comcast network 68.80.0.0/13 DNS server DNS UDP IP Eth Phy
DNS DNS DNS DNS
5: DataLink Layer 5-70
HTTP TCP IP Eth Phy
HTTP
❒ to send HTTP request,
❒ TCP SYN segment (step 1
❒ TCP connection established!
64.233.169.105 web server
SYN SYN SYN SYN
TCP IP Eth Phy
SYN SYN SYN SYNACK SYNACK SYNACK SYNACK SYNACK SYNACK SYNACK
❒ web server responds with
5: DataLink Layer 5-71
HTTP TCP IP Eth Phy
HTTP
❒ HTTP request sent into
❒ IP datagram containing
❒ IP datgram containing HTTP
64.233.169.105 web server HTTP TCP IP Eth Phy
❒ web server responds with
HTTP HTTP HTTP HTTP HTTP HTTP HTTP HTTP HTTP HTTP HTTP HTTP HTTP
❒ web page finally (!!!)