Week 1 Introduction and Data Link Layer Week 1 Layers OSI reference model Each layer communicates with its peer layer through the use of a.
Download
Report
Transcript Week 1 Introduction and Data Link Layer Week 1 Layers OSI reference model Each layer communicates with its peer layer through the use of a.
Week 1
Introduction and Data Link
Layer
Week 1
1
Layers
OSI reference model
Each layer communicates with its
peer
layer through the use of a protocol
The communication between n and n-1 is
known as an interface
Week 1
2
Transmission
Week 1
3
Reception
Week 1
4
Layers
Physical Layer
The physical later is concerned with transmitting raw bits over
a communication channel.
The design issues have to do with making sure that when one
side sends a 1 bit, it is received by the other side as a 1 bit, not
as a 0 bit.
Typical questions here ar e how many volts should be used to
represent a 1 and how many for a 0, how many microseconds a
bit lasts, whether transmission may proceed simultaneously in
both directions, how the initial connection is established and
how it is torn down when both sides are finished, and how many
pins the network connector has and what each pin is used for.
The design issues here deal largely with mechanical, electrical,
and procedural interfaces, and the physical transmission
medium, which lies below the physical layer. Physical layer
design can properly be considered to be within the domain of
the electrical engineer.
Examples: RS232C, X.25, Ethernet
Week 1
5
Layers
Data Link Layer
Sometimes called the link layer transmits
chunks of information across a link.
It deals with problems as checksumming to
detect data corruption; coordinating the use of
shared media as in LAN (Local Area Network);
and addressing (when multiple systems are
reachable as in a LAN)
It is common for different links to implement
different data link layers and for a node to
support several data link layer protocols, one
for each of the types of links to which the node
is attached.
Example: HDLC, SDLC, X.25, Ethernet, ATM.
Week 1
6
Layers
Network Layer
The network layer enables any pair of systems to
communicate with each other.
A fully connected network is one in which every pair of
nodes has a direct link between its nodes, but this kind
of topology does not scale beyond a few nodes
Network layer must find a path through a series of
connected nodes and nodes along the path should forward
packets in the appropriate direction.
The network layer deals with problems such as route
calculation, packet assembly and reassembly (when
different links on the path have different maximum
packet sizes), and congestion control.
Examples: IP, IPX, ATM.
Week 1
7
Layers
Transport Layer
This layer provides a reliable communications
stream between a pair of systems
It deals with errors that can be introduced by
the network layer, such as lost packets,
duplicated packets, packet reordering, and
fragmentation and reassembly
It is also nice if the transport layer reacts to
congestion in the network
Example: TCP
Week 1
8
Layers
Session Layer
The session layer assumes that a reliable virtual point-to-point
connection has been made and contains specs for the dialog
between the two end systems such as dialog discipline, data
grouping, and recovery of an interrupted session. Specs are also
included for initiating and concluding a session. Many network
specs contain little or no session specs and leave these
decisions to the applications.
Presentation Layer
Provides transformation of data to standardize the application
interface. Also provides some network services such as
encryption, compression, and text re-formatting.
Application Layer
This layer plays the same role as the 'application interface' in
operating systems. Provides network services to users
(applications) of the network in a distributed processing
environment: examples transaction server, file transfer
protocol, network management, electronic mail, and terminal
access to remote applications.
Week 1
9
PDUs and SDUs
Application
PSDU
Presentation
SSDU
Application
APDU
PPDU
Session
Session
TSDU
Presentation
SPDU
Transport
NSDU
Transport
TPDU
Network
Network
NPDU
LSDU
Data Link
Data Link
LPDU
PhSDU
Physical
PhPDU
Physical
Week 1
10
Service Models
Layer
n-1 can provide either a
connectionless service or connectionoriented service
Communication consists of three phases in a
CO-service
• Connection setup
• Data transfer
• Connnection release
Associated with each of these phases are two
functions:
• Layer n initiates the function
• Layer n-1 informs layer n that some layer n process in
some other node is requesting a connection
Week 1
11
Service Models
Services can vary in their degree of
reliability
Datagram service (also known as best-effort)
accepts data but makes no guarantees as to
delivery in that data may be lost, duplicated,
delivered out of order, or mangled.
A reliable service guarantees the data will be
delivered in the order transmitted, without
corrupting, duplication or loss.
Week 1
12
Examples
Service
Connectionoriented
Connectionless
Datagram
ATM
IP, IPX, DECnet
Reliable
X.25
• In the TCP/IP protocol suite, network layer is
connectionless, TCP offers reliable connection-oriented
service, UDPs datagram service
• ATM offers a connection-oriented, unreliable service
that can be viewed as a network layer. For IP over ATM,
ATM is viewed by IP as a a data link layer
• It’s good to know about layering but it should not be
taken that seriously; however it is a good learning and
Week 1
communication tool.
13
Internet protocol stack
application: supporting network
applications
ftp, smtp, http
transport: host-host data
transfer
tcp, udp
network: routing of datagrams
from source to destination
ip, routing protocols
link: data transfer between
application
transport
network
link
physical
neighboring network elements
ppp, ethernet
physical: bits “on the wire”
Week 1
14
TCP/IP Stack
Application
Presentation
OSI
Reference
Model
Session
Transport
Application
TCP
IP
Transport TCP, UDP Stack
Network
Internet
Data Link
Link
Physical
Week 1
15
Layering: logical communication
Each layer:
Distributed
“entities”
implement
layer functions
at each node
entities
perform
actions,
exchange
messages with
peers
application
transport
network
link
physical
application
transport
network
link
physical
network
link
physical
application
transport
network
link
physical
application
transport
network
link
physical
Week 1
16
Layering: logical communication
E.g.: transport
take data from
app
add addressing,
reliability
check info to
form
“datagram”
send datagram
to peer
wait for peer to
ack receipt
data
application
transport
transport
network
link
physical
application
transport
network
link
physical
ack
data
network
link
physical
application
transport
network
link
physical
data
application
transport
transport
network
link
physical
Week 1
17
Protocol layering and data
Each layer takes data from above
adds header information to create new data
unit
passes new data unit to layer below
source
M
Ht M
Hn Ht M
Hl Hn Ht M
application
transport
network
link
physical
destination
application
Ht
transport
Hn Ht
network
Hl Hn Ht
link
physical
M
message
M
segment
M
M
datagram
frame
Week 1
18
Internet structure: network of
networks
roughly hierarchical
national/international
local
backbone providers
(NBPs)
e.g. BBN/GTE, Sprint,
AT&T, IBM, UUNet
interconnect (peer) with
each other privately, or
at public Network Access
Point (NAPs)
regional ISPs
connect into NBPs
local ISP, company
connect into regional
ISPs
ISP
regional ISP
NBP B
NAP
NAP
NBP A
regional ISP
local
ISP
Week 1
19
Tiered Networks
A Tier 1 Network is an IP network which
connects to the entire Internet solely via
Settlement Free Interconnection,
commonly known as peering.
Tier 1 - A network that peers with every other
network to reach the Internet.
Tier 2 - A network that peers with some
networks, but still purchases IP transit to
reach at least some portion of the Internet.
Tier 3 - A network that solely purchases
transit from other networks to reach the
Internet.
Week 1
20
Routing
In commercial network routing between
autonomous systems, hot-potato routing is
the practice of passing traffic off to
another AS as quickly as possible, thus
using their network for wide-area transit.
Cold-potato routing is the opposite, where
the originating AS holds onto the packet
until it is as near to the destination as
possible.
Week 1
21
Global Backbone Provider
Week 1
22
Important Properties of a
Network
Scope - A network architecture should solve as general a
problem as possible
Scalability - Would work well with very large networks
and be also efficient with small networks
Robustness: The network should continue to
operate even if nodes or links fail
Safety barriers: A fault does not spread beyond a safety
barrier, for example a router confines a broadcast storm
to a single LAN
Self-stabilization: After a failure, the network will
return to normal operation without human intervention
within a reasonable time, e.g., routing protocols
Fault detection
Autoconfigurability
Tweakability
Migration
Week 1
23
How
A new network "philosophy and architecture," is
replacing the vision of an Intelligent Network. The
vision is one in which the public communications
network would be engineered for "always-on" use,
not intermittence and scarcity. It would be
engineered for intelligence at the end-user's
device, not in the network.
And the network would be engineered simply to
"Deliver the Bits" not for fancy network routing
Fundamentally, it would be a Stupid Network.
In the Stupid Network, the data would tell the
network where it needs to go. (In contrast, in a
circuit network, the network tells the data where
to go.) In a Stupid Network, the data on it would
be the boss.
Week 1
24
Scope of this Course
We will study how a packet finds its way from a
source to a destination
Role of Layer 2
• Ethernet, PPP, 802.11
Role of Layer 3
• IP Addressing
• Routing
• OSPF, BGP
Internet architecture
We will also study emerging trends in IP networks
IP QoS
MPLS (Multiprotocol Label Switching)
Traffic Engineering
Multimedia networking
Week 1
25
The Data Link Layer
Our goals:
understand principles behind data link layer
services:
error detection, correction
sharing a broadcast channel: multiple access
link layer addressing
reliable data transfer, flow control:
instantiation and implementation of various link
layer technologies
Week 1
26
Link Layer
5.1 Introduction and
services
5.2 Error detection
and correction
5.3Multiple access
protocols
5.4 Link-Layer
Addressing
5.5 Ethernet
5.6 Hubs and switches
5.7 PPP
5.8 Link Virtualization:
ATM and MPLS
Week 1
27
Link Layer: Introduction
Some terminology:
“link”
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
Week 1
28
Link layer: context
Datagram transferred by
different link protocols
over different links:
e.g., Ethernet on first link,
frame relay on
intermediate links, 802.11
on last link
Each link protocol
provides different
services
e.g., may or may not
provide reliable data
transfer over link
transportation analogy
trip from Princeton to
Lausanne
limo: Princeton to JFK
plane: JFK to Geneva
train: Geneva to Lausanne
tourist = datagram
transport segment =
communication link
transportation mode =
link layer protocol
travel agent = routing
algorithm
Week 1
29
Link Layer Services
Framing, link access:
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!
Reliable delivery between adjacent nodes
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?
Week 1
30
Link Layer Services (more)
Flow Control:
pacing between adjacent sending and receiving nodes
Error Detection:
errors caused by signal attenuation, noise.
receiver detects presence of errors:
• signals sender for retransmission or drops frame
Error Correction:
receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex
with half duplex, nodes at both ends of link can transmit,
but not at same time
Week 1
31
Adaptors Communicating
datagram
sending
node
frame
adapter
rcving
node
link layer protocol
frame
adapter
link layer implemented in receiving side
“adaptor” (aka NIC)
looks for errors, rdt, flow
control, etc
Ethernet card, PCMCI
extracts datagram, passes
card, 802.11 card
to rcving node
sending side:
adapter is semi encapsulates datagram in
autonomous
a frame
adds error checking bits,
link & physical layers
rdt, flow control, etc.
Week 1
32
Link Layer
5.1 Introduction and
services
5.2 Error detection
and correction
5.3Multiple access
protocols
5.4 Link-Layer
Addressing
5.5 Ethernet
5.6 Hubs and switches
5.7 PPP
5.8 Link Virtualization:
ATM
Week 1
33
Error Detection
EDC= Error Detection and Correction bits (redundancy)
D = Data protected by error checking, may include header fields
• Error detection not 100% reliable!
• protocol may miss some errors, but rarely
• larger EDC field yields better detection and correction
Week 1
34
Parity Checking
Single Bit Parity:
Detect single bit errors
Two Dimensional Bit Parity:
Detect and correct single bit errors
0
0
Week 1
35
Checksumming: Cyclic Redundancy Check
view data bits, D, as a binary number
choose r+1 bit pattern (generator), G
goal: choose r CRC bits, R, such that
<D,R> exactly divisible by G (modulo 2)
receiver knows G, divides <D,R> by G. If non-zero remainder:
error detected!
can detect all burst errors less than r+1 bits
widely used in practice (ATM, HDCL)
Week 1
36
CRC Example
Want:
D.2r XOR R = nG
equivalently:
D.2r = nG XOR R
equivalently:
if we divide D.2r by
G, want remainder R
R = remainder[
D.2r
G
]
Week 1
37
Link Layer
5.1 Introduction and
services
5.2 Error detection
and correction
5.3Multiple access
protocols
5.4 Link-Layer
Addressing
5.5 Ethernet
5.6 Hubs and switches
5.7 PPP
5.8 Link Virtualization:
ATM
Week 1
38
Multiple Access Links and Protocols
Two types of “links”:
point-to-point
PPP for dial-up access
point-to-point link between Ethernet switch and host
broadcast (shared wire or medium)
traditional Ethernet
upstream HFC
802.11 wireless LAN
Week 1
39
Multiple Access protocols
single shared broadcast channel
two or more simultaneous transmissions by nodes:
interference
collision if node receives two or more signals at the same time
multiple access protocol
distributed algorithm that determines how nodes
share channel, i.e., determine when node can transmit
communication about channel sharing must use channel
itself!
no out-of-band channel for coordination
Week 1
40
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps
1. When one node wants to transmit, it can send at
rate R.
2. When M nodes want to transmit, each can send at
average rate R/M
3. Fully decentralized:
no special node to coordinate transmissions
no synchronization of clocks, slots
4. Simple
Week 1
41
MAC Protocols: a taxonomy
Three broad classes:
Channel Partitioning
divide channel into smaller “pieces” (time slots,
frequency, code)
allocate piece to node for exclusive use
Random Access
channel not divided, allow collisions
“recover” from collisions
“Taking turns”
Nodes take turns, but nodes with more to send can take
longer turns
Week 1
42
Channel Partitioning MAC protocols: TDMA
TDMA: time division multiple access
access to channel in "rounds"
each station gets fixed length slot (length = pkt
trans time) in each round
unused slots go idle
example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6
idle
Week 1
43
Channel Partitioning MAC protocols: FDMA
FDMA: frequency division multiple access
channel spectrum divided into frequency bands
each station assigned fixed frequency band
unused transmission time in frequency bands go idle
example: 6-station LAN, 1,3,4 have pkt, frequency
frequency bands
bands 2,5,6 idle
Week 1
44
Random Access Protocols
When node has packet to send
transmit at full channel data rate R.
no a priori coordination among nodes
two or more transmitting nodes ➜ “collision”,
random access MAC protocol specifies:
how to detect collisions
how to recover from collisions (e.g., via delayed
retransmissions)
Examples of random access MAC protocols:
slotted ALOHA
ALOHA
CSMA, CSMA/CD, CSMA/CA
Week 1
45
Slotted ALOHA
Assumptions
all frames same size
time is divided into
equal size slots, time to
transmit 1 frame
nodes start to transmit
frames only at
beginning of slots
nodes are synchronized
if 2 or more nodes
transmit in slot, all
nodes detect collision
Operation
when node obtains fresh
frame, it transmits in next
slot
no collision, node can send
new frame in next slot
if collision, node
retransmits frame in each
subsequent slot with prob.
p until success
Week 1
46
Slotted ALOHA
Pros
single active node can
continuously transmit
at full rate of channel
highly decentralized:
only slots in nodes
need to be in sync
simple
Cons
collisions, wasting slots
idle slots
nodes may be able to
detect collision in less
than time to transmit
packet
clock synchronization
Week 1
47
Slotted Aloha efficiency
Efficiency is the long-run
fraction of successful slots
when there are many nodes,
each with many frames to send
Suppose N nodes with
many frames to send,
each transmits in slot
with probability p
prob that node 1 has
success in a slot
= p(1-p)N-1
prob that any node has
a success = Np(1-p)N-1
For max efficiency
with N nodes, find p*
that maximizes
Np(1-p)N-1
For many nodes, take
limit of Np*(1-p*)N-1
as N goes to infinity,
gives 1/e = .37
At best: channel
used for useful
transmissions 37%
of time!
Week 1
48
CSMA (Carrier Sense Multiple Access)
CSMA: listen before transmit:
If channel sensed idle: transmit entire frame
If channel sensed busy, defer transmission
Human analogy: don’t interrupt others!
Week 1
49
CSMA collisions
spatial layout of nodes
collisions can still occur:
propagation delay means
two nodes may not hear
each other’s transmission
collision:
entire packet transmission
time wasted
note:
role of distance & propagation
delay in determining collision
probability
Week 1
50
CSMA/CD (Collision Detection)
CSMA/CD: carrier sensing, deferral as in CSMA
collisions detected within short time
colliding transmissions aborted, reducing channel
wastage
collision detection:
easy in wired LANs: measure signal strengths,
compare transmitted, received signals
difficult in wireless LANs: receiver shut off while
transmitting
human analogy: the polite conversationalist
Week 1
51
CSMA/CD collision detection
Week 1
52
“Taking Turns” MAC protocols
channel partitioning MAC protocols:
share channel efficiently and fairly at high load
inefficient at low load: delay in channel access,
1/N bandwidth allocated even if only 1 active
node!
Random access MAC protocols
efficient at low load: single node can fully
utilize channel
high load: collision overhead
“taking turns” protocols
look for best of both worlds!
Week 1
53
“Taking Turns” MAC protocols
Token passing:
Polling:
control token passed from
master node
one node to next
“invites” slave nodes
sequentially.
to transmit in turn
token message
concerns:
concerns:
polling overhead
latency
single point of
failure (master)
token overhead
latency
single point of failure (token)
Week 1
54
Summary of MAC protocols
What do you do with a shared media?
Channel Partitioning, by time, frequency or code
• Time Division, Frequency Division
Random partitioning (dynamic),
• ALOHA, S-ALOHA, CSMA, CSMA/CD
• carrier sensing: easy in some technologies (wire), hard
in others (wireless)
• CSMA/CD used in Ethernet
• CSMA/CA used in 802.11
Taking Turns
• polling from a central site, token passing
Week 1
55
LAN technologies
Data link layer so far:
services, error detection/correction, multiple
access
Next: LAN technologies
addressing
Ethernet
hubs, switches
PPP
Week 1
56
Link Layer
5.1 Introduction and
services
5.2 Error detection
and correction
5.3Multiple access
protocols
5.4 Link-Layer
Addressing
5.5 Ethernet
5.6 Hubs and switches
5.7 PPP
5.8 Link Virtualization:
ATM
Week 1
57
MAC Addresses and ARP
32-bit IP address:
network-layer address
used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet)
address:
used to get datagram from one interface to
another physically-connected interface (same
network)
48 bit MAC address (for most LANs)
burned in the adapter ROM
Week 1
58
LAN Addresses and ARP
Each adapter on LAN has unique LAN address
1A-2F-BB-76-09-AD
71-65-F7-2B-08-53
LAN
(wired or
wireless)
Broadcast address =
FF-FF-FF-FF-FF-FF
= adapter
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
Week 1
59
LAN Address (more)
MAC address allocation administered by IEEE
manufacturer buys portion of MAC address space
(to assure uniqueness)
Analogy:
(a) MAC address: like Social Security Number
(b) IP address: like postal address
MAC flat address ➜ portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable
depends on IP subnet to which node is attached
Week 1
60
ARP: Address Resolution Protocol
Question: how to determine
MAC address of B
knowing B’s IP address?
237.196.7.78
1A-2F-BB-76-09-AD
237.196.7.23
Each IP node (Host,
Router) on LAN has
ARP table
ARP Table: IP/MAC
address mappings for
some LAN nodes
237.196.7.14
LAN
71-65-F7-2B-08-53
237.196.7.88
< IP address; MAC address; TTL>
58-23-D7-FA-20-B0
TTL (Time To Live): time
after which address
mapping will be forgotten
(typically 20 min)
0C-C4-11-6F-E3-98
Week 1
61
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
Week 1
62
Routing to another LAN
walkthrough: send datagram from A to B via R
assume A know’s B IP address
A
R
B
Two ARP tables in router R, one for each IP
network (LAN)
Week 1
63
A creates 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 adapter sends frame
R’s adapter 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
A
R
B
Week 1
64
Link Layer
5.1 Introduction and
services
5.2 Error detection
and correction
5.3Multiple access
protocols
5.4 Link-Layer
Addressing
5.5 Ethernet
5.6 Hubs and switches
5.7 PPP
5.8 Link Virtualization:
ATM
Week 1
65
Ethernet
“dominant” wired LAN technology:
cheap $20 for 100Mbs!
first widely used LAN technology
Simpler, cheaper than token LANs and ATM
Kept up with speed race: 10 Mbps – 10 Gbps
Metcalfe’s Ethernet
sketch
Week 1
66
Star topology
Bus topology popular through mid 90s
Now star topology prevails
Connection choices: hub or switch (more later)
hub or
switch
Week 1
67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other
network layer protocol packet) in Ethernet frame
Preamble:
7 bytes with pattern 10101010 followed by one
byte with pattern 10101011
used to synchronize receiver, sender clock rates
Week 1
68
Ethernet Frame Structure
(more)
Addresses: 6 bytes
if adapter receives frame with matching destination
address, or with broadcast address (eg ARP packet), it
passes data in frame to net-layer protocol
otherwise, adapter discards frame
Type: indicates the higher layer protocol (mostly
IP but others may be supported such as Novell
IPX and AppleTalk)
CRC: checked at receiver, if error is detected, the
frame is simply dropped
Week 1
69
Unreliable, connectionless service
Connectionless: No handshaking between sending
and receiving adapter.
Unreliable: receiving adapter doesn’t send acks or
nacks to sending adapter
stream of datagrams passed to network layer can have
gaps
gaps will be filled if app is using TCP
otherwise, app will see the gaps
Week 1
70
Ethernet uses CSMA/CD
No slots
adapter doesn’t transmit
if it senses that some
other adapter is
transmitting, that is,
carrier sense
transmitting adapter
aborts when it senses
that another adapter is
transmitting, that is,
collision detection
Before attempting a
retransmission,
adapter waits a
random time, that is,
random access
Week 1
71
Ethernet CSMA/CD algorithm
1. Adaptor receives
4. If adapter detects
datagram from net layer &
another transmission while
creates frame
transmitting, aborts and
sends jam signal
2. If adapter senses channel
idle, it starts to transmit 5. After aborting, adapter
frame. If it senses
enters exponential
channel busy, waits until
backoff: after the mth
channel idle and then
collision, adapter chooses
transmits
a K at random from
{0,1,2,…,2m-1}. Adapter
3. If adapter transmits
waits K·512 bit times and
entire frame without
returns to Step 2
detecting another
transmission, the adapter
is done with frame !
Week 1
72
Ethernet’s CSMA/CD (more)
Jam Signal: make sure all
other transmitters are
aware of collision; 48 bits
Bit time: .1 microsec for 10
Mbps Ethernet ;
for K=1023, wait time is
about 50 msec
Exponential Backoff:
Goal: adapt retransmission
attempts to estimated
current load
heavy load: random wait
will be longer
first collision: choose K
from {0,1}; delay is K· 512
bit transmission times
after second collision:
choose K from {0,1,2,3}…
after ten collisions, choose
K from {0,1,2,3,4,…,1023}
Week 1
73
CSMA/CD efficiency
Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
efficiency
1
1 5t prop / ttrans
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity
Much better than ALOHA, but still decentralized,
simple, and cheap
Week 1
74
Link Layer
5.1 Introduction and
services
5.2 Error detection
and correction
5.3Multiple access
protocols
5.4 Link-Layer
Addressing
5.5 Ethernet
5.6 Interconnections:
Hubs and switches
5.7 PPP
5.8 Link Virtualization:
ATM
Week 1
75
Hubs
Hubs are essentially physical-layer repeaters:
bits coming from one link go out all other links
at the same rate
no frame buffering
no CSMA/CD at hub: adapters detect collisions
provides net management functionality
twisted pair
hub
Week 1
76
Interconnecting with hubs
Backbone hub interconnects LAN segments
Extends max distance between nodes
But individual segment collision domains become one
large collision domain
Can’t interconnect 10BaseT & 100BaseT
hub
hub
hub
hub
Week 1
77
Switch
Link layer device
stores and forwards Ethernet frames
examines frame header and selectively
forwards frame based on MAC dest address
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
Week 1
78
Forwarding
switch
1
2
hub
3
hub
hub
• How do determine onto which LAN segment to
forward frame?
• Looks like a routing problem...
Week 1
79
Self learning
A switch has a switch table
entry in switch table:
(MAC Address, Interface, Time Stamp)
stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through
which interfaces
when frame received, switch “learns” location of
sender: incoming LAN segment
records sender/location pair in switch table
Week 1
80
Filtering/Forwarding
When switch receives a frame:
index switch table using MAC dest address
if entry found for destination
then{
if dest on segment from which frame arrived
then drop the frame
else forward the frame on interface indicated
}
else flood
forward on all but the interface
on which the frame arrived
Week 1
81
Switch example
Suppose C sends frame to D
1
2
B
C
hub
hub
1
1
2
3
A
B
E
G
3
hub
A
address interface
switch
I
D
E
F
G
H
Switch receives frame from from C
notes in bridge table that C is on interface 1
because D is not in table, switch forwards frame into
interfaces 2 and 3
frame received by D
Week 1
82
Switch example
Suppose D replies back with frame to C.
address interface
switch
B
C
hub
hub
hub
A
I
D
E
F
G
1
1
2
3
1
A
B
E
G
C
H
Switch receives frame from from D
notes in bridge table that D is on interface 2
because C is in table, switch forwards frame only to
interface 1
frame received by C
Week 1
83
Switch: traffic isolation
switch installation breaks subnet into LAN
segments
switch filters packets:
same-LAN-segment frames not usually
forwarded onto other LAN segments
segments become separate collision domains
switch
collision
domain
hub
collision domain
hub
collision domain
hub
Week 1
84
Switches: dedicated access
Switch with many
interfaces
Hosts have direct
connection to switch
No collisions; full duplex
Switching: A-to-A’ and B-to-B’
simultaneously, no collisions
A
C’
B
switch
C
B’
A’
Week 1
85
More on Switches
cut-through switching: frame forwarded
from input to output port without first
collecting entire frame
slight reduction in latency
combinations of shared/dedicated,
10/100/1000 Mbps interfaces
Week 1
86
Institutional network
to external
network
mail server
web server
router
switch
IP subnet
hub
hub
hub
Week 1
87
How does the IP router different from an
Ethernet switch?
IP Router
Host C
PCs with Ethernet
Network Interface Cards (NICs)
An IP Router is a packet switch whose line
cards demutliplex out IP datagrams and
forward packets based on destination IP
address and routing table entries
Week 1
88
IP Router vs Ethernet Switch
Week 1
89
Difference between Ethernet
switch and IP router
Data plane - as packets arrive
Ethernet switch
• Exact match of destination MAC address of incoming
packet with destination column entry in routing table
• If there is no match, flood packet to all ports in the
forwarding state
IP router
• Longest-prefix match - notion of subnet mask
• Default entry match
• If no default entry, drop packet
Week 1
90
Difference between Ethernet
switch and IP router
Data plane - as packets arrive
Ethernet switch
• Does not change MAC header
IP router
• Fields in the IP header are changed, such as TTL
Week 1
91
Difference between Ethernet
switch and IP router
Addressing
Ethernet switch
• Flat 6-byte addressing
• Routing tables will be very large because of flat
addressing
IP router
• Hierarchical 4-byte (IPv4) and 16-byte (IPv6)
• Advantage: address summarization used to decrease
the number of entries in the routing table
Week 1
92
Difference between Ethernet
switch and IP router
Routing protocol
Ethernet switch
• Address learning
• Spanning tree algorithm - "default" ports
IP router
• OSPF link-state protocol
• RIP, BGP distance-vector protocols
Week 1
93
Difference between Ethernet
switch and IP router
Ethernet switches
Characteristics like flooding packets and flat
addressing makes these packet switches
• Suitable for Local Area Networks (LANs)
• Hence, used within enterprises
IP routers
Characteristics like default entry and
hierarchical addressing (with subnet masks)
makes these packet switches
• Suitable for Wide Area Networks (WANs)
Week 1
94
An important difference between
Ethernet switch and IP router
Ethernet switches
Plug-and-play
MAC addresses are hardwired into interfaces
(NICs and switches' links)
IP routers
Needs some administration
• Configure IP addresses of interfaces
• Default router setting
Week 1
95
"Routing protocol" in Ethernet switches
(IEEE 802.1D)
Address learning
Spanning tree algorithm
Two points to note:
The word "bridge" is used here since these
protocols are run on generic bridges (that
interconnect any two types of IEEE 802 LANs)
• Current-day interest: Ethernet switches run this
protocol
A network with a hub is shown as a single line.
Assume that multiple hosts are connected to each
hub
M. Veeraraghavan (originals by J. Liebeherr)
Week 1
96
Operation of transparent bridges
Three aspects of bridge (switch) operation:
(1) Forwarding of Frames
(2) Learning of Addresses
(3) Spanning Tree Algorithm
Use to create entries for the
routing table (distributed
scheme: routing protocol)
Bridges that run spanning-tree algorithm and have address
learning are essentially connectionless packet switches
because they perform packet forwarding from one link to
another based on destination addresses carried in the
headers of incoming packets
use the term “bridge” and “switch” interchangeably
use the term “frame” and “packet” interchangeably
The term “transparent” refers to the fact that the hosts
are completely unaware of the presence of bridges in the
network
Introduction of a bridge does not require hosts to be
configured.
Week 1
97
Routing table (called filtering database
in Ethernet switches)
Each bridge maintains a filtering database
(routing table) with entries
< MAC address, port>
MAC address: identifies host network
interface card (NIC)
port: output port number of bridge
Week 1
98
Frame Forwarding
Assume an Ethernet frame
arrives on port x.
Port x
Search if MAC address of
destination is listed for
ports A, B, or C in the
filtering database.
Found?
Forward frame on
corresponding port if different
from the port on which the
frame arrived and the port state
allows it
Bridge 2
Port A
Port C
Port B
Not
found ?
Flood the frame, i.e.,
send the frame on all
ports except port x if port
states allow it.
Week 1
99
Forwarding conditions
Forward the frame if and only if
The receiving port is in a forwarding state
The transmitting port is in a forwarding state
Either the filtering database indicates the port
number for the destination MAC address or no
such entry is present (in which case all ports
are eligible transmission ports)
Do not transmit on port on which frame was
received
The maximum service data unit size supported
by the LAN to which the transmitting port is
connected is not exceeded (e.g., 1500 bytes for
Week 1
Ethernet)
100
Address Learning
In principle, the filtering database could
be set statically (=static routing)
In the 802.1 bridge, the process is made
automatic with a simple heuristic:
The source address field of a frame that arrives on
a port is used by the bridge to update its filtering
database, which indicates the port through which
Port x
each host is reachable.
host n
host n
Hub
Port A
Bridge 2
Bridge 2
Port C
Port B
HUB: LAN3
Week 1
101
Address Learning
Algorithm:
For each frame received, the bridge stores the
source address field in the received frame
header into the filtering database together
with the port on which the frame was received.
All entries are deleted after some time (default
is 300 seconds).
Port x
host n
Bridge 2
Port A
Port C
Port B
HUB: LAN3
Week 1
102
Example
•Consider the following packets:
<Src=A, Dest=F>, <Src=C, Dest=A>, <Src=E, Dest=C>
•What have the bridges learned?
Port 1
Bridge 1
HUB: LAN1
A
B
Port 2
Port 1
HUB: LAN2
C
Bridge 2
Port 2
HUB: LAN3
D
E
F
Week 1
103
Forwarding frames and learning
Port state
information
Filtering
database
Frame forwarding
Port state
information
Learning process
Frame
reception
Frame transmission
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1
104
Danger of Loops
Consider the two LANs that are
connected by two bridges.
Assume host n is transmitting a
frame F with unknown destination.
What is happening?
Bridges A and B flood the frame
Bridge A
to LAN 2.
Bridge B sees F on LAN 2 (with
unknown destination), and copies
the frame back to LAN 1
Bridge A does the same.
host n
The copying continues
Where’s the problem? What’s the
solution ?
HUB: LAN2
Bridge B
HUB: LAN1
F
Week 1
105
Spanning Trees
IEEE 802.1 has an algorithm that builds
and maintains a spanning tree in a dynamic
environment.
Bridges exchange messages to configure
the bridge (Configuration Bridge Protocol
Data Unit, Configuration BPDUs) to build
the tree.
Week 1
106
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes):
Bridge ID = <priority level + MAC address>
Priority level = 2 bytes; Note that a bridge has several MAC addresses
(one for each port), but only one ID using the MAC address of the lowest
numbered bridge port (port 1)
Each port within a bridge has a unique identifier
(port ID).
0:0:1:2:3:5
Bridge
2
3 1
Priority: 0x12:41
51:24:68:1f:3:4
fe:64:96:12:1:3
Example above: Bridge ID = 12:41:fe:64:96:12:1:3
Week 1
107
Concept - Root bridge of a
network
Root Bridge: The bridge with the lowest
identifier is the root of the spanning tree.
Bridge 3 with ID
0:1:34:1:21:56:19:87
1
LAN A
LAN B
2
1
Bridge 1 with ID=
4:1:21:1:21:56:19:87
1
Bridge 2 with ID=
6:4:55:4:21:56:19:87
Root bridge is bridge 3
since it has the smallest ID
Week 1
108
Concept - For each bridge
Root Port: Each bridge has a root port which
identifies the next hop from a bridge to the root.
Root Path Cost: For each bridge, the cost of the
min-cost path to the root
Example on previous slide: What is the root port
and root path cost of bridge 1:
The root port is port 2 since it leads to the root bridge
(bridge 3)
The root path cost is 1 since bridge 1 is one hop away
from the root bridge (I.e., bridge 3).
Note: We assume that “cost” of a path is the number of
“hops”.
Week 1
109
Concept - For each LAN
Designated Bridge, Designated Port: Single
bridge on a LAN that provides the minimal cost
path to the root for this LAN, and the port on this
minimal cost path
if two bridges have the same cost, select the
one with highest priority (lower bridge ID)
if the min-cost bridge has two or more ports
on the LAN, select the port with the lowest
identifier
Example: for LAN A, the designated bridge is
bridge 3 since it is the root bridge itself; port 1 is
the designated port; for LAN B, the designated
bridge is bridge 1 since this is closer to the root
bridge than bridge 2. The designated port is port
Week 1
1.
110
Concept - Designated
bridge/port
Even though each LAN is the entity that has a
designated bridge/designated port, it is each
bridge that determines whether or not it is the
designated bridge for the LAN on each of its
ports.
Example: Bridge 1 in the example determines
whether it is the designated bridge for LAN A (to
which its port 2 is connected) and for LAN B (to
which its port 1 is connected).
Answer in this case is that bridge 1 is the designated
bridge for LAN B, but it is not the designated bridge for
LAN A
Week 1
111
Steps of Spanning Tree
Algorithm
1. Determine the root bridge of the whole network
2. For all other bridges determine root ports
3. For all bridges, determine which of the bridge ports
are designated ports for their corresponding LANs
The spanning tree consists of all the root ports
and the designated ports.
These ports are all set to the “forwarding
state,” while all other ports are in a “blocked
state.”
Week 1
112
What we just did
We just determined the spanning tree for a
network of LANs and bridges in a “centralized
manner.”
We knew the bridge IDs of all the bridges and the port IDs
of all the ports in all the bridges.
We determined the root bridge (the bridge with the smallest
ID.)
For each bridge, we determined the shortest path to the root
by counting hops and thus identified the root port.
For each bridge, we determined which of its ports are
designated ports for each of its LANs
However, the network of bridges determines the
spanning tree in a “distributed manner” - each with
limited knowledge.
This is done using messages called BPDUs.
Week 1
113
How do the bridges determine
the spanning tree?
With the help of the BPDUs, bridges can:
Elect a single bridge as the root bridge.
Each bridge can determine:
a root port, the port that gives the best path to the
root.
And the corresponding root path cost
Each bridge determines whether it is a designated
bridge, for the LANs connected to each of its
ports. The designated bridge will forward packets
towards the root bridge.
Select ports to be included in the spanning tree.
Root ports and designated ports
Week 1
114
Short form notation for BPDUs
Each bridge sends out BPDUs that contain
the following information:
root ID cost bridge ID/port ID
root bridge (what the sender thinks it is)
root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is
sent
Week 1
115
Ordering of Messages
We can order BPDU messages with the following
ordering relation “ <":
M1
ID R1
C1
ID B1
<
ID R2
C2
ID B2
M2
If (R1 < R2)
M1 < M2
elseif ((R1 == R2) and (C1 < C2))
M1 < M2
elseif ((R1 == R2) and (C1 == C2) and (B1 < B2))
M1 < M2
Week 1
116
Determine the Root Bridge
Initially, all bridges assume they are the root bridge.
Each bridge B sends BPDUs of this form on its LANs:
B
0
B
Each bridge looks at the BPDUs received on all its ports
and its own transmitted BPDUs.
Root bridge is the smallest received root ID that has been
received so far (Whenever a smaller ID arrives, the root
is updated)
Week 1
117
Calculate the Root Path Cost
Determine the Root Port
At this time: A bridge B has a belief of who the root is,
say R.
Bridge B determines the Root Path Cost (Cost) as follows:
• If B = R :
• If B R:
Cost = 0.
Cost = {Smallest Cost in any of BPDUs that were
received from R} + 1
B’s root port is the port from which B received the
lowest cost path to R.
Knowing R and Cost, B can generate its BPDU (but will not
necessarily send it out):
R
Cost
B
Week 1
118
Determine if the bridge is the
designated bridge for any of the LANs
connected to its ports
At this time: B has generated its BPDU
R
Cost
B
B will send this BPDU on one of its ports, say port x, only
if its BPDU is lower (via relation “<“) than any BPDU that
B received from port x.
In this case, B also assumes that it
Port x
is the designated bridge for the
LAN to which the port connects.
Bridge B
Port A
Port C
Port B
Week 1
119
Selecting the Ports for the
Spanning Tree
At this time: Bridge B has calculated the root
bridge for the network, its root port, root path
cost, and whether it is the designated bridge for
each of its LANs.
Now B can decide which ports are in the
spanning tree:
• B’s root port is part of the spanning tree
• All ports for which B is the designated bridge are part of
the spanning tree.
B’s ports that are in the spanning tree will forward
packets (=forwarding state)
B’s ports that are not in the spanning tree will
block packets (=blocking state)
Week 1
120
Adapting to Changes
Bridges continually exchange BPDU’s
according to the rules we just discussed.
This allows the bridges to adapt to changes
to the topology.
Whenever a BPDU arrives on a port, say
port x, B bridge determines:
• Can B become the designated bridge for the LAN
that port x is attached to?
• Can port x become the root port?
Week 1
121
Example 1
• Assume a Bridge with ID 18 has received the following as
the lowest messages on its 4 ports:
Bridge
51
12.93.51
15.31.27
Port 1
Bridge 27
Port 4
Bridge 18
Port 2
Bridge 47
12.85.47
Port 3
Bridge 81
81.0.81
• What is the root bridge?
Root is 12
• What is the Root Path Cost?
85 +1 = 86
•What is the root port?
Port 2
• What is 18’s configuration BPDU?
12.86.18
•For which LAN (port), if any, is B the
designated bridge?
For Ports 1,3, 4
Week 1
122
Example 2
• Assume a Bridge with ID 92 is receiving the following as the
lowest messages on its five ports:
81.0.81
41.13.90
Bridge 92
41.19.125
Port 5
Port 1
Port 2
Port 3
41.12.315
Port 4
41.12.111
• What is the root bridge?
• What is the Root Path Cost?
• What is the root port ?
• What is 92’s configuration BPDU?
• For which LAN (port), if any, is Bridge 92 the designated bridge?
Week 1
123
Network Example (Practice)
The attached network
shows 5 LANs that are
interconnected by 5
bridges.
The ID’s of the bridges are
1,2,3,4,5 and the port ID’s
are
as indicated in the figure.
The bridges run the
spanning
tree algorithm.
Assume that the root cost
path is the number of hops.
Assume an initial state.
Show which messages are
exchanged until the tree is
built.
HUB: LAN2
Port
3a
Port
4a
Bridge 4
Bridge 3
Port
4b
Port
3b
Port
1a
HUB: LAN5
Bridge 1
Port
5a
Port
1b
Bridge 5
Port
5b
HUB: LAN1
Port
2b
HUB: LAN3
Port
2a
Bridge 2
Port
2c
HUB: LAN4
Week 1
124
Network Example (Practice
Final Answer)
HUB: LAN2
R: Root ports
D: Designated ports
Show all the BPDUs
Port
3a
R
R
Bridge 4
Bridge 3
Port
1a
D
D
Port
4a
Port
4b
Port
3b
HUB: LAN5
Bridge 1
Port
1b
Port
5a
D
Bridge 5
R
HUB: LAN1
Port
2b
D
HUB: LAN3
Port
2a
Bridge 2
Port
5b
R
Port
2c
D
HUB: LAN4
Week 1
125
Failures
Root bridge periodically transmits
configuration messages with message age 0
Bridges receiving these messages transmit
them on the their designated ports
If the root or any bridge on the spanning
tree fails then the configuration messages
will time out
At that point, the bridge will discard the
configuration message and recalculate the
root, root path cost, and root port.
Week 1
126
Example
41.13.92
41.13.90
Bridge 92
41.13.92
Port 5
Port 1
Port 3
Port 2
Port 4
41.12.315
41.12.111
41.13.92
The new root port is 3
41.13.92
41.13.90
Bridge 92
41.13.92
Port 5
Port 1
Port 2
Port 3
Port 4
41.12.315
41.12.111
41.14.92
41.14.92
The new root port is 5
Week 1
127
Example
92.0.92
92.0.92
Bridge 92
92.0.92
Port 5
Port 1
Port 2
Port 3
41.12.315
Port 4
41.12.111
92.0.92
92.0.92
The bridge 92 will assume itself to be the root and will
transmit 92.0.92 on all five ports until it receives fresh
configuration messages from any of its roots regarding a
better root.
Week 1
128