15 - Data Link LayerV2
15 - Data Link LayerV2
Computer
Networking: A Top
• The slides are adapted from Kurose and Ross, Down Approach
Computer Networks 7th edition, Kurose and 7th edition
Ross. Jim Kurose, Keith Ross
Pearson/Addison Wesley
All material copyright 1996-2016 April 2016 2
J.F Kurose and K.W. Ross, All Rights Reserved
Chapter 6: Link layer and LANs
Objectives:
•understand principles behind link layer services:
•error detection, correction (done in CSE320)
•sharing a broadcast channel: multiple access (done in
CSE320)
•Framing - link layer addressing
•ARP
•local area networks: Ethernet 3
Application
Presentation
Session
Transport
Network Introduction to Link Layer
Data link
Physical
4
Link Layer Terminology
•Nodes : hosts and routers
•Links:
•wired links
•wireless links
• Frame : layer-2 packet
data-link layer has responsibility of
transferring datagram from one node
to physically adjacent node over a link 5
Link layer: context
Transportation analogy:
• error correction:
• receiver identifies and corrects bit error(s) without resorting to
retransmission (there are various protocols)
• flow control:
• pacing between adjacent sending and receiving nodes
• half-duplex and full-duplex
• with half duplex, nodes at both ends of link can transmit, but not at same 8
time
Where is the link layer implemented?
• in each and every host
• link layer implemented in
“adaptor” (aka network
interface card NIC) or on a application
transport
chip network cpu
memor
y
link
• Ethernet card, 802.11 card; Ethernet
chipset host
control bus
ler (e.g., PCI)
• implements link, physical layer link
physical
physical
transmission
• attaches into host’s system
buses network adapter
card
• combination of hardware, 9
software, firmware
Objectives – Part 1
Our objectives
•Link Layer Addressing
•MAC Address
•Types of MAC Addresses
•ARP
•ARP within LAN
•LAN Switch
10
Link Layer Addressing
11
IP address IP Address vs MAC Address
MAC address
•32 bits • 48 bits
•Dotted decimal notation • 12 Hexadecimal digits
• Example : 192.168.10.1 • Example : 1A-2F-BB-76-09-AD
• Network-layer address for • Data Link-layer address for
interface interface
• Hierarchal • Flat
• Not portable • portable
• Function
• Function 12
MAC or LAN or Physical or Ethernet
addresses (more)
• 48 bits MAC address (for most LANs) burned in NIC ROM, also
sometimes software settable
• Analogy:
• MAC address: like National ID
• IP address: like Postal Address 13
MAC Address
• 48 bits MAC address (for most LANs) burned in NIC ROM, also sometimes
software settable 0000 1100
14
Types of MAC Address
MAC Address
Unicast
Multicast
Broadcast
15
Unicast MAC Addresses
• The unique address used when a frame is sent from a single
transmitting device to a single destination device.
16
Multicast MAC Addresses
• “ 01-00-5E” in an IPv4 multicast packet
17
Broadcast MAC Address
• A destination MAC address of FF-FF-FF-FF-FF-FF
• To be processed by all devices in the network
18
LAN addresses and ARP
each adapter on LAN has unique LAN address
1A-2F-BB-76-09-AD
LAN
(wired or adapter
wireless)
71-65-F7-2B-08-53
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
19
ARP: address resolution protocol
Question: how to determine • ARP
interface’s MAC address,
knowing its IP address? • Mapping _IP Add___ to
_MAC Add____
137.196.7.78
Host or PC
21
Router
ARP: address resolution protocol
137.196.7.78
X A wants to send datagram to B
1A-2F-BB-76-09-AD
137.196.7.23
ARP 137.196.7.14
A ARP
LAN
ARP
ARP
ARP
Reply
B ✔
71-65-F7-2B-08-53
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
137.196.7.88
X
71-65-F7-2B-08-53 58-23-D7-FA-20-B0 137.196.7.23 137.196.7.14 ARP Reply
22
FF-FF-FF-FF-FF-FF 71-65-F7-2B-08-53 137.196.7.14 137.196.7.23 ARP Request
Dest MAC Source MAC Dest IP Add Source IP Add ARP Req/Reply
ARP protocol: same LAN
• A wants to send datagram to B
• B’s MAC address not in A’s ARP
table.
•A caches (saves) IP-to-MAC
• A broadcasts ARP query address pair in its ARP table
packet, containing B's IP
address •Soft state: information that times
• destination MAC address = out (goes away) unless refreshed
FF-FF-FF-FF-FF-FF
A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
222.222.222.220 49-BD-D2-C7-56-
1A-23-F9-CD-06-9B 2A
Default Gateway’s
??? MAC 74-29-9C-E8-FF-55 222.222.222.222 111.111.111.111 A to B Packet
Address
Dest MAC Source MAC Dest IP Add Source IP Add Packet Type
Addressing: routing to another LAN
Send datagram from A to B via R
▪Does A know the IP address of first hop router, R which is
also known as Default Gateway? (how?)
▪Will A know R’s MAC address?
ARP
A B
R
111.111.111.111 ARP
ARP
ARP Reply 222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
IP
Eth
Phy
A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-
2A
1A-23-F9-CD-06-9B
222.222.222.220
111.111.111.112 111.111.111.110 222.222.222.221
CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B
88-B2-2F-54-1A-0F
Addressing: routing to another LAN
▪ frame sent from A to R
▪ frame received at R, datagram removed, passed up to IP
IP IP
Eth Eth
Phy Phy
A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
A ARP
Reply
B
R
111.111.111.111
ARP 222.222.222.222
74-29-9C-E8-FF-55 ARP
ARP 49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
IP
Eth
Phy
A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
•Switch
•Characteristics of a switch
•Role of switch in a LAN
Switch
• link-layer device: takes an active role
• transparent
• hosts are unaware of presence of switches
• plug-and-play, self-learning
• switches do not need to be configured
Switch: multiple simultaneous transmissions
• hosts have dedicated, direct A
connection to switch
C’ B
• switches buffer packets
6 1 2
• Ethernet protocol used on each
incoming link, but no collisions; full 5 4 3
duplex
B’ C
• each link is its own collision
domain A’
A A A’
A’
S1
S3
A S2
F
D I
B C
G H
E
S4
S1
S3
A S2
F
D I
B C
G H
E
Suppose C sends frame to I, I responds to C
mail server
to external
network
router web server
IP subnet
Switches vs. routers
application
transport
both are store-and-forward: datagram network
▪ routers: network-layer frame link
physical link frame
devices (examine
physical
network-layer headers)
▪ switches: link-layer devices switch
(examine link-layer headers)
network datagram
link frame
both have forwarding tables: physical
▪ routers: compute tables
using routing algorithms, IP application
addresses transport
▪ switches: learn forwarding network
table using flooding, learning, link
MAC addresses physical
THE END!