ECE 428
About the Instructor
• Instructor: Sagar Naik
• Office: EIT 4174, ECE Dept.
• Other courses that I teach
– ECE 355: Software Engineering
– ECE 453/CS 447/ SE 465: Software Testing and QA – ECE 454: Distributed and Network-Centric Computing
– ECE 750-4: Protocols, Software, and Issues in Mobile Comp.
• Research interest: Computer networks, mobile computing,
wireless communication, network-based applications
Course Outline
•
Objective #1
– Fundamentals of transporting messages from one
process to another process on another computer.
• Important communication protocols to access the Internet
•
Objective #2
– Fundamentals of network security
• Objective #3
Course Outline
• Objective #1
– To transport messages from a process on one machine to another process on another machine
Client Process
Server Process
IP IP
DLC
Course Outline: Realize Objective #1
• Physical +
M
edium
A
ccess
C
ontrol (MAC) layers
•
D
ata
L
ink
C
ontrol (DLC) layer
•
I
nternet
P
rotocol (IP) layer
•
T
ransmission
C
ontrol
P
rotocol (TCP) layer
• Application Layer Protocols
Course Outline
• Objective #2: Achieve
secure
communication
– Security
• User Authentication
• Privacy (Confidentiality)
• Data Authentication (Data Integrity) • Techniques
Course Outline
• Objective #3
– Advance topics in communication networks
• Cellular communication network
– GSM/ GPRS
• Wireless backbone networks
– WiMAX
Evaluation
• Two assignments
15%
• Mid-term exam
25%
Reading Resources
• Text
–
Computer Networks
, A. S. Tanenbaum, Prentice Hall
– Computer Networking, Kurose and Ross, Addison
Wesley
– TCP/IP Protocol Suite, B. A. Forouzan, McGraw Hill,
3
rded.
– Online notes to be posted
• Course URL
Teaching Style
• Balanced coverage of
functional
,
non-functional
and
design
aspects of network protocols
– Functional aspect: what the protocols
do
– Non-functional aspect: Quality of Service (QoS)
– Design aspects: choices and parameters
• View this course as a
window
to the larger world
of computer networks.
• Stay close to real protocols with a combination of
Tutorial Style
• Near exam times
– Exam related questions and answers
• Otherwise
My assumption about class level
Physical + MAC layers
C C C
Hub Ethernet cable
C C C
Wireless Access Point
C C C
Wired media
Physical + MAC layers
• Physical layer
– Actual movement of bits over comm. medium
– Different communication media
• Wire (fiber optics, coaxial cable, telephone line)
• Free space wireless communication
– Main function
• Bit stream electrical signal/ electromagnetic waves
• Strive for media efficiency
Physical + MAC layers
• Media
– Shared: Ethernet, free space
– Dedicated: a dial-up link
• MAC layer
– Uses the services of the underlying PHY layer.
– Tells the PHY layer
WHEN
to transmit.
– Transmission may not be successful: packet loss.
– Mechanisms for reducing packet loss
Data Link Control layer
• DLC layer
– Runs on top of a MAC layer (unreliable)
– Provides a sense of
reliability
: ACK mechanism
– Synchronize source transmission rate with the sink’s
acceptance rate.
Flow control
– Data multiplexing/ demultiplexing
IP (Network) layer
• IP layer
– Runs on top of a DLC layer.
–
Route
packets from one computer to another.
Transport layer
• TCP layer
– Runs on top of IP layer.
– Provides “end-to-end” communication symantic.
– Packet delivery
• Lossless • In-order
• Single copy (No duplicate) • Confirmation
Applications
• Internet Directory Service – DNS
• Web Access – HTTP protocol
Communication Protocols
• Medium Access Control (MAC)
• Lets two nodes communicate directly. • Node: a computer or a router
• Data (Logical) Link Control (DLC/LLC)
• Lets us have a reliable link between two adjacent nodes.
• Internet Protocol (IP)
• Routes packets from one computer to another. • Uses the services of BGP, OSPF, and RIP
• Transmission Control Protocol (TCP)
Media/Physical Layer
• Computers are “physically” connected by a medium
• Wired medium (Ex.: Ethernet Local Area Network)
• Wireless medium (Ex.: Free space WLAN, Cellular network)
•
Physical layer
• A layer of protocol controlling the hardware system that
actually moves bits from one computer to another • Abstraction: Transmitter and Receiver
Node 1 Node 2
Tx Rx
Rx Medium Tx
Medium Access Control (MAC)
Protocols for LAN and WLAN
Some Basic Ideas
• Concept of layering
• Segment/ Packet/ Frame
• Packet Header
• Five Basic Assumptions
• Aloha Protocols
Concept of Layering
MAC1 DLC1 IP TCP MAC1 DLC1 IP MAC2 DLC2 MAC2 DLC2 IP TCP App. App. LAN1 LAN2PHY PHY PHY PHY
Note: Protocols are executed in
Concepts of segment/packet/frame, and header
DLC1 IP TCP
App. User Data
User Data User Data
User Data DLC1
IP TCP App. User Data User Data User Data User Data
Packet:
A
formatted
stream of bits with the following info.
-
Type:
The receiver knows what to do with this.
-
Addresses: Destination
and source
-
Control information:
Layer related
-
Data: optional
H E A D E R
MAC Protocols
• Function: Send
packets
from one node to another
sharing
the same medium
• Sharing => Nodes
compete
for transmission
• Key problem to resolve
– Each node
finds a good time
for transmission with
the hope that it will not collide with another.
– The decision must be made largely
independently
• Ignore what others are doing
• Look for possible Tx from others (sense carrier) • Take permission from the receiver
MAC Protocols (5 key assumptions)
•
Station Model
– Nodes are independent. When a node generates a packet for Tx, subsequent packets are queued up for Tx.
•
Single channel model
only one can Tx at a time
•
Collision assumption
– Two packets are transmitted at the same time => signal is potentially garbled (collision occurs) at the receiver.
– Collision occurs at receivers. NOTE
– Transmitter needs to know the occurrence of collision
• A Tx can’t actually detect a collision • A Tx can sometimes infer a collision
MAC Protocols (5 key assumptions)
•
Time model
–
Continuous:
A packet Tx can begin at any instant
–
Slotted:
Packets are transmitted at well-known instants
defined by slots.
•
Carrier sense
– No carrier sense: Don’t try to detect an on-going Tx
– Carrier sense
• Mechanism to sense carrier • Utilize its absence
MAC Protocols
• We will study
– Aloha protocols
– CSMA/CD (Carrier Sense Multiple Access/
Collision Detection)
Aloha Protocol
• Developed in the 1970s at U of Hawaii
• To interconnect terminals with mainframes
• LAN/ WLAN: Possible, but not used
• GSM: Phones use this protocol to
request a
channel
from the base stations
• Two types
– Pure Aloha (Continuous time)
– Slotted Aloha
Pure Aloha
Start: i = 0
Start a timer
T = 2*Tp + Δ
ACK received Cancel timer Timeout i++ Transmit Frame
i > Kmax
R = Random(0,2i-1)
Wait
TB = R*Tp
No
(Pure Aloha: Performance Measure)
Throughput:
A commonly used performance metric.Input/ Output System I/O System Input Output Input rate O ut put r at e Throughput:
Pure Aloha: Performance Measure
• Throughput
– Throughput =
• Total input rate (G) * Prob. of successful packet transmission
• G*e-2G
– Throughput peaks at G = 0.5 units of packet/X sec,
where X is the packet transmission time.
– Max throughput = 0.184 packets/X sec.
• Oblivious to collision while transmitting
Slotted Aloha Protocol
• Similar to pure Aloha
• Difference
– Time is slotted
– A terminal
transmits
a packet at the beginning of a
slot.
– Throughput
• G*e-G
Carrier Sense Multiple Access
with Collision Detection
CSMA/CD
Concepts of
Carrier Sense and Collision
Detection
Tx Rx
Data
Compare Carrier?
Collision?
Medium MAC/
IEEE 802.3: PHY
• 10Base5
• Thick co-ax (10 mm diameter) • 500 m segment
• Bus
• 10BaseT
• Twisted pair • 100 m
CSMA/CD
• Assumption
CSMA/CD
Start: i = 0Send jamming Signal +
Abort
i++
Sense medium
i > Kmax
R = Random(0,2i-1)
Wait
TB = R*Tp
No
Busy Y Wait
N No collision Collision Transmit frame WHILE detecting collsion
CSMA/CD
– Time for collision detection
– 2 * Tp (where Tp is max propagation time between two nodes)
– Propagation time
• Includes transceiver delay + physical propagation time • Of the order of 25 microseconds
– Minimum packet length
• Frame transmission time is Tf
• Tf = 2* Tp
Aloha vs. CSMA/CD
• No carrier sense
• ACK
• Oblivious to collision
• No jamming signal
• Low throughput
• Carrier sense
• No ACK
• Collision => Abort
• Jamming signal
– Let all hear the collision
Wireless LAN
Note
• Reminder
–
CSMA/CD Assumption
• Signal from one node can reach all nodes.
– The assumption may not hold in WLAN
– Collision detection is out of question (Use CA)
– Two nodes may not be able to comm. directly
WLAN View
Router
Access Point
To the rest of the network
C
C C: Computer, AP: Access Point
Radio range of the AP
IEEE 802.11 protocol
Other AP
Basic Service Set (BSS): BSSID = MAC address of AP Independent BSS (IBSS)= BSS - AP
IEEE 802.11/a/b/g Family
IEEE Technique Band Rate
Mbps
802.11 DSSS
FHSS
2.4 GHz 2.4 GHz
1 and 2 1 and 2
802.11a OFDM 5.725 GHz 6--54
802.11b DSSS 2.4 GHz 5.5 and 11
Different Modes of Operation of
MAC in IEEE 802.11
Modes of IEEE 802.11 MAC
Point Coordination Function (PCF) mode Distributed Coordination
Function (DCF) mode
PCF Mode: Optional
• The AP
• Acts as the central controller for all nodes within its range.
• Decides who transmits and when.
• Can follow a round-robin policy to allocate slots.
Note: There is no contention for medium access.
• This mode
• Can support real-time traffic due to periodic scheduling.
• Leads to waste of bandwidth if a scheduled node has no traffic. • Is optional <= Spec.
DCF Mode: Mandatory
• An AP
– Not necessarily to be used.
• Computers can communicate among themselves <= Ad hoc.
– Is used to provide connectivity to the Internet.
• In DCF
– All nodes, including the AP, compete for medium access.
– The AP does not act as a central controller.
– Contention => No guarantee of bandwidth
Alternative use of PCF and DCF
• The WLAN operates
• In the PCF mode for T1 seconds
– Bandwidth guarantee for some nodes
• In the DCF mode for T2 seconds
– Nodes with additional traffic can contend for a share of the bandwidth
PCF DCF PCF DCF PCF DCF
DCF with
hand-shake
• A sender obtains
permission
from the receiver
before transmitting a data frame.
• Hand-shake mechanism
• Sender transmits a Request To Send (RTS) frame
• Receiver gives permission by sending back a Clear To Send
(CTS) frame
• Used to increase the probability of successful Tx when
– Traffic is high
– Packet length is long. ( dotRTSThreshold holds the value.)
• Incurs additional cost
DCF
with
and
without
hand-shake
• The two modes are not mutually exclusive.
• A node decides what mode to use on a frame/frame basis. • The MAC management database contains a variable
– dotRTSThreshold: integer in bytes
– Length of a data frame >= dotRTSThreshold
» Use hand-shake
– Length of a data frame < dotRTSThreshold
» Do not use hand-shake
PCF PCF
DCF
PCF
DCF
without hand-shake
• A sender
does not
obtain
permission
from the
receiver before transmitting a data frame.
• RTS/CTS mechanism is
NOT
used.
• There is no prior coordination between sender and receiver
• A sender transmits a frame
– when some
medium sensing
conditions are satisfied.
• To follow …
• When traffic is low OR data frames are short
Problems in WLAN
• Hidden Terminal Problem
• Exposed Terminal Problem
• Inability to detect collision (at the receiver)
•
Assumption
– All nodes have identical radio range
• how far away their signal can be received
• Note
Hidden Terminal Problem
A B C
Tx
• Problem
- C is transmitting a frame to B. - A is unaware of C’s Tx.
- Now, if A transmits, A’s Tx will collide with C’s at B
• The above problem is due to C being hidden from A.
Exposed Terminal Problem
A B C
Tx
• Problem
- A is transmitting a frame to D. - B is aware of the ongoing Tx.
- If B transmits a frame to C, no harm is caused.
- However, B does not transmit because it is unaware of D’s location. D
No collision detection
• Fact: Collision occurs at receivers.
• In a wired LAN
– Collision is
indirectly
detected by the sender by
enforcing the following
assumption
:
• Signal from one node can reach all nodes.
• In a WLAN
– The assumption does
not
hold.
• Evidence: The hidden terminal problem …
WLAN MAC: CSMA/CA
• In CSMA/CA, collision is avoided using
–
PHY-level carrier sensing
: Done by receiver hardware
–
Virtual carrier sensing
: Done by
• Processing all frame headers (RTS, CTS, DATA)
• A duration field in frame headers indicates
– for how long the sender of the frame may use the medium.
• A Network Allocation Vector is managed using duration fields
– Each node has a NAV – essentially an integer
– NAV > 0: A node had announced its intention to use the medium now. – NAV = 0: Nobody had announced its intention to use the medium now.
NAV Update Mechanism
• Each node has its own NAV.
• NAV represents the length of time for which the medium is likely to remain busy
• Initially:
NAV = 0
.
• With each passing
μ
s
• NAV = NAV – 1
• Decrementing stops if NAV = 0.
• NAV is updated using the
duration
field in a
received frame
RTS and CTS Frames
• Frame format
Frame
Control Duration RA TA FCS
RTS
Frame
Control Duration RA FCS
CTS/ ACK
2 2 6 6 4 bytes
DATA Frame
• Frame format
Frame Control
Duration/
ID A1 A2 A3 A4 Seq.
Control Frame Body FCS
Timing Intervals
• The IEEE 802.11 MAC defines 4 timing intervals
– 2 at the PHY level
• SIFS: Short InterFrame Space • aSlot
– 2 at the MAC level
• PIFS: Priority (in PCF) IFS • DIFS: Distributed IFS
Hand-shake using RTS/CTS
RTS CTS SIFS SIFS DATA SIFS ACKValue of “duration” in RTS
Value of “duration” in CTS A
B
C
D
Value of NAV of C
Value of NAV of D
Time
DCF with Hand-shake: Tx
F: a new data frame to be transmitted
i = 0, CW = CWmin
NAV =0?
Idle medium for DIFS interval?
Send an RTS Start a timer
Cancel timer Send DATA (F) Start a timer
Cancel timer Wait for a random interval
i = i+1
CW = CWmin*2i
(At some point, CW Timeout Timeout Random Backoff No Yes
CTS is received
ACK is received
End of backoff
i: Retry count, CW: Contention Window
CWmin: Minimum value of CW (typical value is 32) CWmax: Maximum value of CW (typical value is 256) DIFS: Distributed Interframe Space
SIFS < DIFS Important note
Wait for fairness to others
Backoff Mechanism
• Backoff Time Counter (BTC) = Random(0,CW)
• The time unit of BTC is
aSlotTime
–
aSlotTime:
propagation + transceiver switching time
• BTC is decremented as follows:
– Medium is idle for aSlotTime: BTC = BTC – 1
– Medium is busy: Stop decrementing
– Resume decrementing BTC after finding the medium to
be idle for DIFS interval.
– Subsequent decrementing is done for every aSlotTime
of idleness of the medium.
Backoff Mechanism
Ch. Busy (A) Ch. Busy (C)
DIFS DIFS
X X X X
BTC = 5 4 3 2 2 2 1 0
X = aSlotTime If the channel is idle for at least DIFS interval, it has to remain idle for aSlotTime interval for BTC to be decremented by 1. If the channel is busy, it has to remain idle for DIFS interval
for BTC to be decremented by 1.
Time
DCF with Hand-shake: Rx
Receive an RTS
NAV = 0?
Send a CTS Channel is idle for SIFS and the computer is ready to receive? No Yes No Yes Remain silent.
Receive a DATA frame
Ch. idle for SIFS?
Send an ACK
Note:The above two fragments of flow-charts can be easily merged. No
DCF Mode
without
Hand-shake
• A special case of DCF with hand-shake
– RTS/CTS frames are not exchanged
• The idea of NAV is still used in this mode
– All stations process the received RTS/CTS of others
• NOTE: A node may
broadcast
a DATA frame to
all
– Done in DCF without hand-shake
PCF Mode of Operation
• An AP acts as the controller of a BSS as follows
– AP alternates between PCF and DCF modes
– AP assumes the role of a
controller
as follows
• AP senses the medium at the start of a CF (Contention-Free) period for a PIFS (Priority IFS) interval.
– SIFS < PIFS < DIFS
– PIFS = SIFS + aSlotTime – DIFS = SIFS + 2*aSlotTime
• If the medium is idle for PIFS, transmit a beacon frame
– Beacon contains a CFPMaxDuration field
– (Nodes receiving a beacon update their NAV to CFPMaxDuration)
PCF Mode of Operation (Contd.)
– After
transmitting a beacon
, AP waits for SIFS before
transmitting one of the following
• DATA frame • CF Poll frame
• DATA+CF Poll frame • ACK frame
PCF Mode of Operation (Contd.)
CF Poll frame
AP User 1 User 2 AP User 1
CF Poll CF Poll
DATA DATA
ACK ACK
The polled user sends data to another user.
The polled user sends data to the AP. SIFS
SIFS
SIFS
PCF Mode of Operation (Contd.)
DATA + CF Poll frame
AP User 1 User 2 DATA+
CF Poll
DATA
ACK
The polled user receives data from the AP and sends data to another user.
SIFS
SIFS ACK
PCF Mode of Operation (Contd.)
• DATA frame
– Contains user data from AP to a specific station.
– The receiver sends back an ACK after SIFS interval.
– AP does not receive an ACK
• Retransmit the DATA after a PIFS interval
– AP can
broadcast
a DATA frame
PCF Mode of Operation (Contd.)
• CF Poll frame
– AP grants permission to another node to transmit DATA
to the AP or to a third node.
– Receiver of DATA frame sends an ACK to the sender.
– If the polled node has no data to send, it sends a
null
DATA frame.
– If the polled station does not receive an ACK, it can not
retransmit its data frame until it is polled again.
PCF Mode of Operation (Contd.)
• CF End frame
– Identifies the end of CF period
– Sent by an AP under two conditions
• An AP has no data to send and no node to poll
– Can happen before the pre-announced CFPMaxDuration
– Receivers of CF End reset their NAV to 0.
• Normal end of CF period
– (Initially: CFPDurRemaining = CFPMaxDuration)
A node joining a WLAN with an AP
• (No need for such a procedure in a wired LAN)
• Two ways for a node to join a WLAN
– Passive scanning
• Scan a channel for a Beacon frame
• If a Beacon frame is received
– Negotiate Authentication and Association processes
– Active Scanning
• Transmit a Probe frame