0% found this document useful (0 votes)
18 views

Chapter_5

Uploaded by

khan22205101934
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Chapter_5

Uploaded by

khan22205101934
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 37

Chapter 5

Link Layer

Computer
Networking: A
Top Down
Approach
6th edition
Jim Kurose, Keith
Ross
Addison-Wesley
March 2012

Link Layer 5-1


MAC addresses and ARP
 32-bit IP address:
 network-layer address for interface
 used for layer 3 (network layer) forwarding
 MAC (or LAN or physical or Ethernet)
address:
 function: used ‘locally” to get frame from one
interface to another physically-connected
interface (same network, in IP-addressing
sense)
 48 bit MAC address (for most LANs) burned in
NIC ROM, also sometimes software settable
hexadecimal (base 16) notation
e.g.: 1A-2F-BB-76-09-AD
(each “number” represents 4 bits)

Link Layer 5-2


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

Link Layer 5-3


LAN addresses (more)
 MAC address allocation administered by
IEEE
 manufacturer buys portion of MAC
address space (to assure uniqueness)
 analogy:
 MAC address: like Social Security Number
 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
Link Layer 5-4
ADDRESS MAPPING

The delivery of a packet to a host or a router


requires two levels of addressing: logical and
physical. We need to be able to map a logical
address to its corresponding
physical address and vice versa. This can be done
by using either static or dynamic mapping.

21.5
ARP operation

21.6
ARP packet

21.7
An ARP request is broadcast;
an ARP reply is unicast.

21.8
Example

A host with IP address 130.23.43.20 and physical address


B2:34:55:10:22:10 has a packet to send to another host
with IP address 130.23.43.25 and physical address
A4:6E:F4:59:83:AB. The two hosts are on the same
Ethernet network. Show the ARP request and reply packets
encapsulated in Ethernet frames.

Solution
Figure 21.5 shows the ARP request and reply packets. Note
that the ARP data field in this case is 28 bytes, and that the
individual addresses do not fit in the 4-byte boundary. That
is why we do not show the regular 4-byte boundaries for
these
21.9
addresses.
an ARP request and reply

21.10
Addressing: routing to another
LAN
walkthrough: send datagram from A to B via R
 focus on addressing – at IP (datagram) and MAC layer (frame)
 assume A knows B’s IP address
 assume A knows IP address of first hop router, R (how?)
 assume A knows R’s MAC address (how?)

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

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

Link Layer 5-11


Addressing: routing to another
LAN
 A creates IP datagram with IP source A, destination B
 A creates link-layer frame with R's MAC address as dest,
frame contains A-to-B IP datagram
MAC src: 74-29-9C-E8-FF-55
MAC dest: E6-E9-00-17-BB-4B
IP src: 111.111.111.111
IP dest: 222.222.222.222

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

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

Link Layer 5-12


Addressing: routing to another
LAN
 frame sent from A to R
 frame received at R, datagram removed, passed up to IP

MAC src: 74-29-9C-E8-FF-55


MAC dest: E6-E9-00-17-BB-4B
IP src: 111.111.111.111
IP dest: 222.222.222.222
IP src: 111.111.111.111
IP dest: 222.222.222.222

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

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

Link Layer 5-13


Addressing: routing to another
LAN
 R forwards datagram with IP source A, destination B
 R creates link-layer frame with B's MAC address as dest,
frame contains A-to-B IP datagram

MAC src: 1A-23-F9-CD-06-9B


MAC dest: 49-BD-D2-C7-56-2A
IP src: 111.111.111.111
IP dest: 222.222.222.222
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

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

Link Layer 5-14


Addressing: routing to another
LAN
 R forwards datagram with IP source A, destination B
 R creates link-layer frame with B's MAC address as dest,
frame contains A-to-B IP datagram

MAC src: 1A-23-F9-CD-06-9B


MAC dest: 49-BD-D2-C7-56-2A
IP src: 111.111.111.111
IP dest: 222.222.222.222
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

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

Link Layer 5-15


Addressing: routing to another
LAN
 R forwards datagram with IP source A, destination B
 R creates link-layer frame with B's MAC address as dest,
frame contains A-to-B IP datagram
MAC src: 1A-23-F9-CD-06-9B
MAC dest: 49-BD-D2-C7-56-2A
IP src: 111.111.111.111
IP dest: 222.222.222.222

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

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

Link Layer 5-16


Ethernet switch
 link-layer device: takes an active role
 store, forward Ethernet frames
 examine incoming frame’s MAC address,
selectively forward frame to one-or-
more outgoing links when frame is to be
forwarded on segment, uses CSMA/CD to
access segment
 transparent
 hosts are unaware of presence of
switches
 plug-and-play, self-learning
 switches do not need to be configured

Link Layer 5-17


Switch: multiple simultaneous
transmissions
 hosts have dedicated, A
direct connection to
switch C’ B
 switches buffer packets 1
6 2
 Ethernet protocol used on
each incoming link, but 5 4 3
no collisions; full duplex
 each link is its own B’ C

collision domain
 switching: A-to-A’ and B- A’
to-B’ can transmit switch with six interfaces
simultaneously, without (1,2,3,4,5,6)
collisions

Link Layer 5-18


Switch forwarding table
Q: how does switch know A
A’ reachable via interface B
C’
4, B’ reachable via
interface 5?
 A: each switch has a switch 6 1 2
table, each entry:
 (MAC address of host, 5 4 3
interface to reach host, time
B’ C
stamp)
 looks like a routing table!
A’
Q: how are entries created, switch with six interfaces
maintained in switch table? (1,2,3,4,5,6)
 something like a routing
protocol?
Link Layer 5-19
Switch: self-learning Source: A
Dest: A’

A A A’
 switch learns which
hosts can be reached
C’ B
through which
interfaces
6 1 2
 when frame
received, switch 5 4 3
“learns” location of
sender: incoming B’ C
LAN segment
 records
sender/location pair A’
in switch table MAC addr interface TTL
A 1 60 Switch table
(initially empty)

Link Layer 5-20


Self-learning, forwarding: Source: A
example Dest: A’

A A A’
 frame destination, A’,
locaton unknown:flood C’ B

1
 destination A 6 2
selectively send
location
on just one link known:
A A’
5 4 3

B’ C
A’ A

A’

MAC addr interface TTL


A 1 60 switch table
A’ 4 60 (initially empty)

Link Layer 5-21


Switches vs.
routers application
both are store-and- transport
forward: datagram network
frame link
routers: network-layer
devices (examine network- physical link frame
layer headers) physical
switches: link-layer
switch
devices (examine link-
layer headers)
network datagram
both have forwarding link frame
tables: physical
routers: compute tables
application
using routing algorithms,
IP addresses transport
switches: learn forwarding network
table using flooding, link
learning, MAC addresses physical

Link Layer 5-22


VLANs: motivation
consider:
 CS user moves office to
EE, but wants connect to
CS switch?
 single broadcast domain:
 all layer-2 broadcast
traffic (ARP, DHCP,
unknown location of
destination MAC
Computer
Science
Computer address) must cross
Electrical
Engineering
Engineering entire LAN
 security/privacy,
efficiency issues

Link Layer 5-23


port-based VLAN: switch ports
VLANs grouped (by switch
management software) so
that single physical switch
Virtual Local …… 1 7 9 15
Area Network 2 8 10 16

switch(es) supporting
VLAN capabilities can … …
be configured to Electrical Engineering Computer Science
define multiple virtual (VLAN ports 1-8) (VLAN ports 9-15)

LANS over single … operates as multiple virtual switches


physical LAN
infrastructure. 1 7 9 15
2 8 10 16

… …

Electrical Engineering Computer Science


(VLAN ports 1-8) (VLAN ports 9-16)

Link Layer 5-24


VLANS spanning multiple
switches
1 7 9 15 1 3 5 7

2 8 10 16 2 4 6 8

… …

Electrical Engineering Computer Science Ports 2,3,5 belong to EE VLAN


(VLAN ports 1-8) (VLAN ports 9-15) Ports 4,6,7,8 belong to CS VLAN

 trunk port: carries frames between VLANS defined


over multiple physical switches
 frames forwarded within VLAN between switches can’t be
vanilla 802.1 frames (must carry VLAN ID info)
 802.1q protocol adds/removed additional header fields
for frames forwarded between trunk ports

Link Layer 5-25


Multiprotocol label switching
(MPLS)
 initial goal: high-speed IP forwarding
using fixed length label (instead of IP
address)
 fast lookup using fixed length identifier
(rather than shortest prefix matching)
 borrowing ideas from Virtual Circuit (VC)
approach
 but IP datagram still keeps IP address!
PPP or Ethernet
MPLS header IP header remainder of link-layer frame
header

label Exp S TTL

20 3 1 5
Link Layer 5-26
MPLS capable routers
 a.k.a. label-switched router
 forward packets to outgoing interface based
only on label value (don’t inspect IP
address)
 MPLS forwarding table distinct from IP forwarding
tables
 flexibility: MPLS forwarding decisions can
differ from those of IP
 use destination and source addresses to route
flows to same destination differently (traffic
engineering)
 re-route flows quickly if link fails: pre-computed
backup paths (useful for VoIP)
Link Layer 5-27
MPLS versus IP paths
entry router (R4) can use different MPLS
routes to A based, e.g., on source address
R6
D
R4 R3
R5
A
R2

 IP routing: path to destination IP-only


determined by destination router

 address
MPLS alone
routing: path to destination can MPLS and
be based on source and dest. address IP router
 fast reroute: precompute backup routes
in case of link failure
Link Layer 5-28
MPLS forwarding tables
in out out
label label dest
interface
10 A 0 in out out
12 D 0 label label dest
interface
8 A 1 10 6 A 1
12 9 D 0

R6
0 0
D
1 1
R4 R3
R5
0 0
A
R2 in outR1 out
label label dest
in out out
interface
label label dest 6 15 A 0
interface
8 6 A 0
Link Layer 5-29
Synthesis: a day in the life of a web
request
 journey down protocol stack complete!
 application, transport, network, link
 putting-it-all-together: synthesis!
 goal: identify, review, understand protocols
(at all layers) involved in seemingly simple
scenario: requesting www page
 scenario: student attaches laptop to campus
network, requests/receives
www.google.com

Link Layer 5-30


A day in the life: scenario

browser DNS server


Comcast network
68.80.0.0/13

school network
68.80.2.0/24

web page

web server Google’s network


64.233.169.105 64.233.160.0/19

Link Layer 5-31


A day in the life… connecting to the
Internet
DHCP DHCP  connecting laptop needs to
DHCP UDP get its own IP address,
DHCP IP addr of first-hop router,
DHCP Eth addr of DNS server: use
Phy DHCP
DHCP
 DHCP request encapsulated
in UDP, encapsulated in IP,
DHCP DHCP encapsulated in 802.3
DHCP UDP Ethernet
DHCP IP
DHCP Eth router
Phy (runs DHCP)  Ethernet frame
broadcast (dest:
FFFFFFFFFFFF) on LAN,
received at router
 running DHCP
Ethernet server
demuxed to
IP demuxed, UDP
demuxed to DHCP
Link Layer 5-32
A day in the life… connecting to the
Internet
DHCP DHCP  DHCP server formulates
DHCP UDP DHCP ACK containing
DHCP IP client’s IP address, IP
DHCP Eth address of first-hop
Phy router for client, name &
IP address of DNS server
 encapsulation at DHCP
DHCP
server, frame forwarded
DHCP
DHCP UDP
(switch learning)
DHCP IP through LAN,
DHCP Eth router demultiplexing at client
Phy (runs DHCP)
DHCP
 DHCP client receives
DHCP ACK reply

Client now has IP address, knows name & addr of DNS


server, IP address of its first-hop router

Link Layer 5-33


A day in the life… ARP (before DNS,
before HTTP)
DNS DNS
 before sending HTTP
DNS UDP request, need IP address of
DNS
ARP
IP www.google.com: DNS
ARP query Eth
Phy  DNS query created, encapsulated in
UDP, encapsulated in IP,
encapsulated in Eth. To send frame
to router, need MAC address of
ARP
router interface: ARP
ARP reply Eth
Phy

router
 ARP query broadcast,
(runs DHCP) received by router, which
replies with ARP reply
giving MAC address of
 router interface
client now knows MAC
address of first hop router,
so can now send frame
containing DNS query
Link Layer 5-34
A day in the life… using DNSDNS
DNS UDP DNS server
DNS IP
DNS DNS DNS Eth
DNS UDP DNS Phy
DNS IP
DNS Eth
Phy
DNS
Comcast network
68.80.0.0/13

router
 IP datagram forwarded
(runs DHCP) from campus network into
 IP datagram containing comcast network, routed
DNS query forwarded (tables created by RIP,
via LAN switch from OSPF, IS-IS and/or BGP
client to 1st hop router  routing protocols)
demux’ed to DNS
to DNS server
server
 DNS server replies to
client with IP address of
www.google.com
Link Layer 5-35
A day in the life…TCP connection
carrying HTTP
HTTP
HTTP
SYNACK
SYN TCP
SYNACK
SYN IP
SYNACK
SYN Eth
Phy

 to send HTTP request,


client first opens TCP
socket to web server
router  TCP SYN segment (step 1 in
(runs DHCP) 3-way handshake) inter-
SYNACK
SYN TCP domain routed to web server
SYNACK
SYN IP
SYN
SYNACK Eth
Phy  web server responds
with TCP SYNACK (step 2
web server in 3-way handshake)
64.233.169.105  TCP connection established!

Link Layer 5-36


A day in the life… HTTP
request/reply
HTTP
HTTP HTTP
 web page finally (!!!) displayed
HTTP
HTTP TCP
HTTP
HTTP IP
HTTP
HTTP Eth
Phy

 HTTP request sent into


TCP socket
router  IP datagram containing
HTTP (runs DHCP)
HTTP
HTTP TCP
HTTP request routed to
HTTP IP www.google.com
HTTP Eth  web server responds
Phy with HTTP reply
(containing web page)
web server  IP datagram containing HTTP
64.233.169.105 reply routed back to client

Link Layer 5-37

You might also like