Univ. of Tehran Wireless Ad Hoc/Sensor Networks 1 Special Topics Special Topics on on Wireless Ad-hoc Wireless Ad-hoc Networks Networks University of Tehran Dept. of EE and Computer Engineering By: Dr. Nasser Yazdani & Farshad Lahouti Lecture 5: Review of Review of Computer Networking Computer Networking
109
Embed
Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Univ. of TehranWireless Ad Hoc/Sensor
Networks 1
Special TopicsSpecial Topics on on
Wireless Ad-hoc Wireless Ad-hoc NetworksNetworks
University of TehranDept. of EE and Computer Engineering
By:Dr. Nasser Yazdani & Farshad Lahouti
Lecture 5: Review of Review of Computer NetworkingComputer Networking
Univ. of Tehran Computer Network 2
A tour of networking Goal and objective
needs design requirement
Whirlwind tour of networking
Univ. of Tehran Computer Network 3
Information, Computers and Networks
Information: anything that is represented in bits Form (can be represented) vs substance
(cannot) Properties:
Infinitely replicable Computers can “manipulate” information Networks create “access” to information
Potential of networking: move bits everywhere, cheaply, and with
desired performance characteristics Break the space barrier for information
Univ. of Tehran Computer Network 4
Objective of Networking ? Direct or indirect access to every other
node in the network Connectivity is the magic needed to
communicate if you do not have a link. Must understand many connection
factors Traffic data rate Traffic pattern (bursty or constant bit rate) Traffic target (multipoint or single
destination, mobile or fixed) Application requirements, Delay sensitivity
Loss sensitivity.
Univ. of Tehran Computer Network 5
Another view
Building a network to support diverse ranges of applications Distributed computing. Multimedia. Telecommunication. E-commerce, etc.
What kind of technology do we need? Hardware. Software.
Univ. of Tehran Computer Network 6
What is a Network?
What is computer Network? Different views. Differences from other networks, Its
Send a packet, stop and wait until acknowledgement arrives
Use sequence number to recognize repeat
Sender Receiver
Univ. of Tehran Computer Network 47
How to Keep the Pipe Full?How to Keep the Pipe Full? Send multiple packets
Number of pkts in flight = window
How large a window is needed Round trip delay * bandwidth =
capacity of pipe Reliable, unordered delivery
Several parallel stop & waits Send new packet after each ack
After Nack Go back N Resent the Nacked packet only
Univ. of Tehran Computer Network 48
Data Link Layer Three or more machines are physically
connected and communicating. Problems:
How to connect them? Topology Sharing links
How to address each machine? Addressing How to regulate accessing to the media?
MAC (Media Access method or protocol) Collision!
Different LAN technology Ethernet ~85 Token Ring ~12
Univ. of Tehran Computer Network 49
Goals of MAC Protocols
MAC Protocols arbitrate access to acommon shared channel among a
population of nodes
Goals:1. Fair among users2. High efficiency3. Low delay4. Fault tolerant5- Simple
Univ. of Tehran Computer Network 50
Multiplexing/Media Access/Sharing
Partition the channel and give everybody a time/freq slot FDMA CDMA: (Code Division Multiple Access)
Different codes TDMA
Taking turn Token Ring
Random Access ALOHA CSMA, etc
Reservation Based access or Centralized arbiter
Univ. of Tehran Computer Network 51
Examples of MAC Protocols
Packet-Switched Radio NetworkAloha
Carrier Sense Multiple Access/Collision Detection
Ethernet (IEEE 802.3)Token Passing
Token Ring (IEEE 802.5)Fiber Distributed Data Interface (FDDI)
Sim
ple
Ran
dom
Com
ple
x
Dete
rmin
isti
c
Wireless
Univ. of Tehran Computer Network 52
Internetworking Communication between networks. Problems & Challenges
Different Networking technologies (Heterogeneity).
So many Networks (Scaling). Some terminologies:
“internetworking” refer to an arbitrary collection of connected networks.
“Internet” the global internetwork. “Network” either directly connected or
switched network using any LAN technology such as Ethernet, Token ring, ATM, etc.
Univ. of Tehran Computer Network 53
Goals0 Connect existing networks
initially ARPANET and ARPA packet radio network
1. Survivability- ensure communication service even in the
presence of network and router failures
2. Support multiple types of services3. Must accommodate a variety of networks4. Allow distributed management5. Allow host attachment with a low level of effort6. Allow resource accountability
Univ. of Tehran Computer Network 54
Gateway Alternatives Translation
Difficulty in dealing with different features supported by networks
Scales poorly with number of network types (N2 conversions)
Standardization “IP over everything” (Design Principle 1) Minimal assumptions about network Hourglass design
Univ. of Tehran Computer Network 55
Survivability Continue to operate even in the presence of
network failures (e.g., link and router failures) As long as the network is not partitioned, two endpoint
should be able to communicate, moreover, any other failure (excepting network partition) should be transparent to endpoints
Decision: maintain state only at end-points (fate-sharing)
Eliminate the problem of handling state inconsistency and performing state restoration when router fails
Internet: stateless network architecture
Univ. of Tehran Computer Network 56
IP Layering (Principle 8) Relatively simple
Router RouterHost Host
Application
Transport
Network
Link
Univ. of Tehran Computer Network 57
End-to-End Argument (Principle 2)
Deals with where to place functionality Inside the network (in switching elements) At the edges
Argument There are functions that can only be correctly
implemented by the endpoints do not try to completely implement these at them elsewhere
Can provide a partial form as performance enhancement
Guideline not a law
Univ. of Tehran Computer Network 58
Common View of the Telco Network
Brick
Univ. of Tehran Computer Network 59
Common View of the IP Network
Univ. of Tehran Computer Network 60
Needs some intelligence!
routing
Univ. of Tehran Computer Network 61
IP Internet Concatenation of Networks or
“networks of Networks”. “R” is routers and “H” is hosts.
R2
R1
H4
H5
H3H2H1
Network 2 (Ethernet)
Network 1 (Ethernet)
H6
Network 3 (FDDI)
Network 4(point-to-point)
H7 R3 H8
Univ. of Tehran Computer Network 62
Service Model Connectionless (datagram-based) Best-effort delivery (unreliable service)
packets are lost. No recover from lost. packets are delivered out of order duplicate copies of a packet are delivered packets can be delayed for a long time
Datagram formatVersion HLen TOS Length
Ident Flags Offset
TTL Protocol Checksum
SourceAddr
DestinationAddr
Options (variable) Pad(variable)
0 4 8 16 19 31
Data
Contains all information for routing!
Univ. of Tehran Computer Network 63
IP Address Classes (Some are Obsolete)
Network ID Host ID
Network ID Host ID
8 16
Class A32
0
Class B 10
Class C 110
Multicast AddressesClass D 1110
Reserved for experimentsClass E 1111
24
Univ. of Tehran Computer Network 64
Forwarding vs. Routing Forwarding: the process of moving
packets from input to output The forwarding table Lookup. How to populate the lookup table?
Routing: process by which the forwarding table is built and maintained One or more routing protocols Procedures (algorithms) to convert routing
info to forwarding table.
Univ. of Tehran Computer Network 65
Original IP Route Lookup Address classes
A: 0 | 7 bit network | 24 bit host (16M each) B: 10 | 14 bit network | 16 bit host (64K) C: 110 | 21 bit network | 8 bit host (255)
We need to keep only network address, 221entries.
Address would specify prefix for forwarding table Simple lookup
Univ. of Tehran Computer Network 66
CIDR Revisited Supernets
Assign adjacent net addresses to same org
Classless routing (CIDR) How does this help routing table?
Combine routing table entries whenever all nodes with same prefix share same hop
Univ. of Tehran Computer Network 67
What is Routing?R3
A
B
C
R1
R2
R4 D
E
FR5
R5F
R3E
R3D
Next Hop
Destination
D
Univ. of Tehran Computer Network 68
What is Routing?R3
A
B
C
R1
R2
R4 D
E
FR5
R5F
R3E
R3D
Next Hop
Destination
D
16 3241
Data
Options (if any)
Destination Address
Source Address
Header ChecksumProtocolTTL
Fragment OffsetFlags
Fragment ID
Total Packet LengthT.ServiceHLen
Ver
20
byte
s
Univ. of Tehran Computer Network 69
What is Routing?
A
B
C
R1
R2
R3
R4 D
E
FR5
Univ. of Tehran Computer Network 70
How do we set up Routing Tables?
Graph theory to compute “shortest path” Switches = nodes Links = edges Delay, hops = cost
Need to adapt to changes in topology
Univ. of Tehran Computer Network 71
Factors Affecting Routing
4
3
6
21
9
1
1
Routing algorithms view the network as a graph
Problem: find the lowest cost path between two nodes
Factors Static topology Dynamic load Policy
D
A
FE
B
C
Univ. of Tehran Computer Network 72
Internet Routing Internet organized as a two level hierarchy
First level – autonomous systems (AS’s) AS – region of network under a single
administrative domain AS’s run an intra-domain routing protocols
Distance Vector, e.g., Routing Information Protocol (RIP) Link State, e.g., Open Shortest Path First (OSPF)
Transport Layer First end-to-end layer End-to-end state May provide reliability, flow and
congestion control
Univ. of Tehran Computer Network 75
Why End-to-End Protocols?
Underlying best-effort network drop messages re-orders messages delivers duplicate copies of a given message limits messages to some finite size delivers messages after an arbitrarily long delay multiple application processes on each host Different speed of sender and receiver (Flow
control) Congestion in the network (Congestion controls)
Initially, there was no end to end protocol.
Univ. of Tehran Computer Network 76
User Datagram Protocol (UDP)
Minimal Transport Service: Port addressing: for application multiplexing Error detection (Checksum): formerly optional Connectionless end-to-end datagram service
No flow control. No error recovery (no acks) Used by SNMP, DNS, TFTP, RTP, RPC, etc
SourcePort
DestPort
Check-sum
Length
16 16 16 Size in bits16
Univ. of Tehran Computer Network 77
TCP Communication abstraction:
Connection oriented, Point to point Reliable
Error Detection and correction Ordered Byte-stream
For window size n, can send up to n bytes without receiving an acknowledgement
When the data is acknowledged then the window slides forward
Each packet advertises a window size Indicates number of bytes the receiver has
space for Original TCP always sent entire window
Congestion control now limits this
Univ. of Tehran Computer Network 81
TCP Congestion Control Underlying design principle: packet
conservation, Make load udaptable At equilibrium, inject packet into network only
when one is removed Reaching equilibrium
Slow start Eliminates spurious retransmissions
Accurate RTO estimation Fast retransmit
Adapting to resource availability Congestion avoidance
Univ. of Tehran Computer Network 82
TCP Congestion Control Basics Keep a congestion window, cwnd
Denotes how much network is able to absorb
Sender’s maximum window: Min (advertised window, cwnd)
Sender’s actual window: Max window - unacknowledged segments
If we have large actual window, should we send data in one shot? No, use acks to clock sending new data
Univ. of Tehran Computer Network 83
Self-clocking
PrPb
Ar
Ab
ReceiverSender
As
Univ. of Tehran Computer Network 84
Slow Start How do we get this clocking behavior
to start? Initialize cwnd = 1 Upon receipt of every ack, cwnd = cwnd
+ 1 Implications
Window actually increases to W in RTT * log2(W)
Can overshoot window and cause packet loss
Univ. of Tehran Computer Network 85
Slow Start Example
1
One RTT
One pkt time
0R
2
1R
3
4
2R
567
83R
91011
1213
1415
1
2 3
4 5 6 7
Univ. of Tehran Computer Network 86
Congestion Window
Time
CongestionWindow
Slow start with each time out
Univ. of Tehran Computer Network 87
Congestion Avoidance Loss implies congestion – why?
Not necessarily true on all link types If loss occurs when cwnd = W
Network can handle 0.5W ~ W segments Set cwnd to 0.5W (multiplicative
decrease) Upon receiving ACK
Increase cwnd by 1/cwnd Results in additive increase
Univ. of Tehran Computer Network 88
Return to Slow Start If packet is lost we lose our self
clocking as well Need to implement slow-start and
congestion avoidance together When timeout occurs set ssthresh to
0.5w If cwnd < ssthresh, use slow start Else use congestion avoidance
Univ. of Tehran Computer Network 89
Fast Retransmit Don’t wait for window
to drain Resend a segment
after 3 duplicate ACKs remember a duplicate
ACK means that an out-of sequence segment was received
Notes: duplicate ACKs due to
packet reordering why reordering?
window may be too small to get duplicate ACKs
ACK 2
segment 1cwnd = 1
cwnd = 2 segment 2segment 3
ACK 4cwnd = 4 segment 4
segment 5segment 6segment 7
ACK 3
3 duplicateACKs
ACK 4
ACK 4
ACK 4
Univ. of Tehran Computer Network 90
Fast Recovery Each duplicate ack notifies sender that
single packet has cleared network When < cwnd packets are outstanding
Allow new packets out with each new duplicate acknowledgement
Behavior Sender is idle for some time – waiting for ½
cwnd worth of dupacks Transmits at original rate after wait
Ack clocking rate is same as before loss
Univ. of Tehran Computer Network 91
Fast Recovery
Univ. of Tehran Computer Network 92
Fast Recovery
Time
Sequence NoSent for each dupack after
W/2 dupacks arrive
Univ. of Tehran Computer Network 93
Is Layering Harmful? Sometimes..
Layer N may duplicate lower level functionality (e.g., error recovery)
Layers may need same info (timestamp, MTU)
Strict adherence to layering may hurt performance
Univ. of Tehran Computer Network 94
Performance Metrics Bandwidth (throughput)
data transmitted per time unit link versus end-to-end notation
KB = 210 bytes Mbps = 106 bits per second
Latency (delay) time to send message from point A to point B one-way versus round-trip time (RTT) components
Latency = Propagation + Transmit + QueuingQueuing time can be a dominant factor
Univ. of Tehran Computer Network 95
LatencyLatency (Queuing Delay)
Host A
Host B
R1
R2
R3
TRANSP1
TRANSP2
TRANSP3
TRANSP4
PROP1
PROP2
PROP3
PROP4
( )i i ii
TRANSP PROP Q Actual end to end latency
Q2
The egress link might not be free, packets may be queued in a buffer. If the network is busy, packets might have to wait a long time.
How can we determine the queuing delay?
Univ. of Tehran Computer Network 96
Queues and Queuing Delay
Cross traffic causes congestion and
variable queuing delay.
Univ. of Tehran Computer Network 97
A router queue
A(t), D(t)
Model of router queue
Q(t)
( ) : [0, ].
:
( ) : [0, ].
1 :
The arrival process. The number of arrivals in interval
The average rate of new arrivals in packets/ second.
The departure process. The number of departures in interval
Th
A t t
D t t
( )
e average time to service each packet.
: The number of packets in the queue at time . Q t t
Buffer Server
Univ. of Tehran Computer Network 98
A router queue (cont)
A(t), D(t)
Model of router queue
Q(t)
Buffer Server
Usually buffer size is finiteState of the system depends on :1. Packet arrival process, (Poisson, deterministic, etc)2. Packet length distribution3. The service discipline (FCFS, LCFS, priority, etc)4. # of Server, service process
Univ. of Tehran Computer Network 99
A simple deterministic modelbytes or “fluid”
A(t)
D(t)Cumulative number of
departed bits up until time t.
time
Service process
Cumulativenumber of bits
Cumulative number of bits that arrived up until time
t.
A(t)
D(t)
Q(t)
Properties of A(t), D(t): A(t), D(t) are non-decreasing A(t) >= D(t)
Univ. of Tehran Computer Network 100
D(t)
A(t)
time
Q(t)
d(t)
•Queue occupancy: Q(t) = A(t) - D(t).•Queuing delay, d(t), is the time spent in the queue by a bit that arrived at time t, and if the queue is served first-come-first-served (FCFS or FIFO)
Simple deterministic model
Cumulativenumber of bits
Univ. of Tehran Computer Network 101
Time evolution of a queuePackets
A(t), D(t)
Model of FIFO router queue
Q(t)
time
Packet Arrivals:
Departures:
Q(t)
1
Univ. of Tehran Computer Network 102
Little’s Result
Where:
is the average number of customers in the system
(the number in the queue + the number in service),
is the arrival rate, in customers per second, and
is the average time that a
L
L
d
d
customer waits in the
system (time in queue + time in service).
Result holds so long as no customers are lost/ dropped.
Univ. of Tehran Computer Network 103
The Poisson process
( )( )
!.
Poisson process is a simple arrival process in which:
1. Probability of arrivals in an interval of seconds is:
2. The expected number of arrivals in interval is:
3. Successive
kt
k
k t
tP t e
kt t
interarrival times are independent of each other
(i.e. arrivals are not bursty).
Arrival process is PoissonQueuing system is M/M/1, Poisson arrival, Exponential service,with 1 server.• Arrival process is momeryless or arrival of packets are independent of each others •Prob. of one arrival in Δt is λ Δt + o(Δt)
Univ. of Tehran Computer Network 104
The Poisson process (cont) Poisson process is a probability distribution
function.Σp(k) = 1 for all k=0, 1, …
How many arrivals in t second? It is the expected value:Σkp(k) = λt
What is interarrival time, r, between two arrivalf(r) = λe-λr
This is the same the service time.f(r) = μe- μr
Univ. of Tehran Computer Network 105
The Poisson process Why use the Poisson process?
It is the continuous time equivalent of a series of coin tosses. It is known to model well systems in which a large number of
independent events are aggregated together. e.g. Arrival of new phone calls to a telephone switch Decay of nuclear particles “Shot noise” in an electrical circuit
It makes the math easy. Be warned
Network traffic is very bursty! Packet arrivals are not Poisson. But it models quite well the arrival of new flows.
Univ. of Tehran Computer Network 106
An M/M/1 queue
A(t) is a Poisson process with rate , and the time to serve each packet is exponentially distributed with rate , then:
We assume the system is in steady state, or stationary, with none time varying values.
Pn is the probability that there are n customer in the queue including the one in the service.
ρ= ration of load on capacity, is utilization or traffic intensity.
A(t), D(t)
Model of FIFO router queue
Univ. of Tehran Computer Network 107
An M/M/1 queue (cont)
Prob. that the system move from state n-1 to n is with no departure, and probability that it moves from state n to n-1 is In order the system to be in stationary state the probability of departure and moving state should be equal.PnPn-1Pn+1
0 21 n-1 n n+1
….
Univ. of Tehran Computer Network 108
An M/M/1 queue (cont)
Considering the rate of interring and leaving the surface gives us .PnPn+1 => Pn+1= Pn => Pn = nP0
What is the value of P0?
ΣnPn=> P0Σnn==> P0 =–
Pn =(–n
0 21 n-1 n n+1
….
Univ. of Tehran Computer Network 109
An M/M/1 queue
If A(t) is a Poisson process with rate , and the time to serve each packet is exponentially distributed with rate , then:
A(t), D(t)
Model of FIFO router queue
1;Average delay, and so f rom Little's Result: d L d