univ. of tehranwireless ad hoc/sensor networks1 special topics on wireless ad-hoc networks...

109
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

Upload: allison-marsh

Post on 17-Dec-2015

239 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 2: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 2

A tour of networking Goal and objective

needs design requirement

Whirlwind tour of networking

Page 3: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 4: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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.

Page 5: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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.

Page 6: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 6

What is a Network?

What is computer Network? Different views. Differences from other networks, Its

generality. What is requirements? Different

perspective: Network provider Network designer Application programmer

Page 7: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 7

Design goals

Connectivity Scalability Simplicity

For designers. Most importantly for users.

Efficiency cost performance

Support for common user services.

Page 8: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 8

Levels of Networking Communicating across a link, LANs.

Connecting together multiple links (Bridges)

Finding and routing data to nodes on Internet.

Communicating on the application level, matching application requirements

Page 9: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 9

A First Step Creating a link between nodes Link: path followed by bits

Wired or wireless Broadcast or point-to-point (or both)

Node: any device connected to a link

Page 10: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 10

Types of Links

Point-to-Point Multiple Access

Page 11: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 11

Packet Transmission Modes

Unicast Transmission to single specific receiver

Broadcast Transmission to all network nodes

Multicast Transmission to specific subset of nodes

Anycast Transmission to one of a specific subset

of nodes

Page 12: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 12

Switched Network

What are Switched Networks?

Switch: moves bits between links Packet switching Circuit switching

Page 13: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 13

Back in the Old Days…

Page 14: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 14

Then Came TDM…

Multiplex (mux) Demultiplex (demux)

• Synchronous time division multiplexing

Page 15: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 15

TDM Logical Network View

Page 16: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 16

Packet Switching (Internet)

Packets

Page 17: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 17

Packet Switching Interleave packets from different

sources Efficient: resources used on demand

Statistical multiplexing General

Multiple types of applications Accommodates bursty traffic

Addition of queues

Page 18: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 18

Statistical Multiplexing Gain

1 Mbps link; users require 0.1 Mbps when transmitting; users active only 10% of the time

Circuit switching: can support 10 users

Packet switching: with 35 users, probability that >=10 are transmitting at the same time < 0.0017

Page 19: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 19

Characteristics of Packet Switching

Store and forward Packets are self contained units Can use alternate paths - reordering

Contention Congestion Delay

Page 20: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 20

Internet[work]

Second Step: Internet[work]

A collection of interconnected networks

Host: network endpoints (computer, PDA, light switch, …)

Router: node that connects networks

Internet vs. internet

Page 21: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 21

Challenge Many differences between networks

Address formats Performance – bandwidth/latency Packet size Loss rate/pattern handling Routing

How to translate between various network technologies

Page 22: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 22

Third Step: How To Find Nodes?

internet

Computer 1 Computer 2

Page 23: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 23

Naming Humans use readable host names

E.g. www.cmu.edu Globally unique (can correspond to

multiple hosts) Naming system translates to

physical address E.g. DNS translates name to IP Address

(e.g. 128.2.11.43) Address reflects location in network

Page 24: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 24

Domain Name System

What’s the IP address for www.cmu.edu?

It is 128.2.11.43

DNS server address manually configured into OS

Local DNS ServerComputer 1

Page 25: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 25

Packet Routing/Delivery Each network technology has different

local delivery methods Address resolution provides delivery

information within network E.g., ARP maps IP addresses to Ethernet

addresses Local, works only on a particular network

Routing protocol provides path through an internetwork

Page 26: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 26

Network:Address Resolution Protocol

Ethernet

Broadcast: who knows the Ethernet address for 128.2.11.43?

Ethernet

Broadcast: Yes, it is08-00-2c-19-dc-45

Page 27: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 27

Internetwork: Datagram Routing

R

R

R

RRH

H

H

H

R

RH

R

Routers send packet to next closest point

H: Hosts

R: Routers

Page 28: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 28

Routing Forwarding tables at each router

populated by routing protocols. Original Internet: manually updated Routing protocols update tables

based on “cost” Exchange tables with neighbors or

everyone Use neighbor leading to shortest path

Page 29: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 29

Fourth Step: Application Demands

Reliability Corruption Lost packets

Flow and congestion control Fragmentation In-order delivery Etc…

Page 30: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 30

What if the Data gets Corrupted?

InternetGET windex.htmlGET index.html

Solution: Add a checksum

Problem: Data Corruption

0,9 9 6,7,8 21 4,5 7 1,2,3 6X

Page 31: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 31

What if the Data gets Lost?

InternetGET index.html

Problem: Lost Data

InternetGET index.html

Solution: Timeout and Retransmit

GET index.htmlGET index.html

Page 32: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 32

What if Network is Overloaded?

Problem: Network Overload

Short bursts: buffer What if buffer overflows?

Packets dropped and retransmitted Sender adjusts rate until load = resources

Called “Congestion control”

Solution: Buffering and Congestion Control

Page 33: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 33

Problem: Packet size

Solution: Fragment data across packets

What if the Data Doesn’t Fit?

On Ethernet, max IP packet is 1.5kbytes Typical web page is 10kbytes

GETindex.html

GET index.html

Page 34: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 34

Solution: Add Sequence Numbers

Problem: Out of Order

What if the Data is Out of Order?

GETx.thindeml

GET x.thindeml

GET index.html

ml 4 inde 2 x.th 3 GET 1

Page 35: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 35

Network Functionality Summary

Link Multiplexing Routing Addressing/naming (locating peers) Reliability Flow control Fragmentation Etc….

Page 36: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 36

What is Layering? Modular approach to network

functionality The idea of divide and conquer Use abstraction to hide complexity. Example:

Link hardware

Host-to-host connectivity

Application-to-application channels

Application

Page 37: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 37

Protocols Module in layered structure Set of rules governing communication

between network elements (applications, hosts, routers)

Protocols define: Interface to higher layers (API) Interface to peer

Format and order of messages Actions taken on receipt of a message

Page 38: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 38

Protocols Building blocks of a network architecture Each protocol object has two different

interfaces service interface: operations on this protocol peer-to-peer interface: messages exchanged

with peer Term “protocol” is overloaded

specification of peer-to-peer interface module that implements this interface

Page 39: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 39

Layering Characteristics Each layer relies on services from

layer below and exports services to layer above

Interface defines interaction Hides implementation - layers can

change without disturbing other layers (black box)

Page 40: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 40

Layering

Host Host

Application

Transport

Network

Link

User A User B

Layering: technique to simplify complex systems

Page 41: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 41

Layer Encapsulation

Get index.html

Connection ID

Source/Destination

Link Address

User A User B

Page 42: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 42

Protocol Demultiplexing Multiple choices at each layer

FTP HTTP TFTPNV

TCP UDP

IP

NET1 NET2 NETn…

TCP/UDPIPIPX

Port Number

Network

Protocol Field

Type Field

Page 43: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 43

E.g.: OSI Model: 7 Protocol Layers

Physical: how to transmit bits Data link: how to transmit frames Network: how to route packets Transport: how to send packets

end2end Session: how to tie flows together Presentation: byte ordering, security Application: everything else

Page 44: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 44

OSI Layers and Locations

Switch RouterHost Host

Application

Transport

Network

Data Link

Presentation

Session

Physical

Page 45: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 45

Physical Layer Dealing with Transmission/Receiving bits. Encoding digital data, 0 & 1, on the signal

NRZ, Manchester coding Framing Error Detection

CRC, checksum Error Correction- Reliable data Transmission

FEC- Forward Error Correction ARQ- Automatic Repeat Request, Stop & wait, ..

Page 46: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 46

Stop and Wait

Time

Packet

ACKTim

eout

Simplest ARQ protocol

Send a packet, stop and wait until acknowledgement arrives

Use sequence number to recognize repeat

Sender Receiver

Page 47: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 48: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 49: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 50: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 51: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 52: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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.

Page 53: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 54: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 55: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 56: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 56

IP Layering (Principle 8) Relatively simple

Router RouterHost Host

Application

Transport

Network

Link

Page 57: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 58: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 58

Common View of the Telco Network

Brick

Page 59: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 59

Common View of the IP Network

Page 60: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 60

Needs some intelligence!

routing

Page 61: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 62: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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!

Page 63: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 64: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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.

Page 65: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 66: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 67: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 68: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 69: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 69

What is Routing?

A

B

C

R1

R2

R3

R4 D

E

FR5

Page 70: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 71: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 72: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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)

Between AS’s runs inter-domain routing protocols, e.g., Border Gateway Routing (BGP)

De facto standard today, BGP-4

Page 73: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 73

Example

AS-1

AS-2

AS-3

Interior router

BGP router

Page 74: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 74

Transport Layer First end-to-end layer End-to-end state May provide reliability, flow and

congestion control

Page 75: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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.

Page 76: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 77: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 77

TCP Communication abstraction:

Connection oriented, Point to point Reliable

Error Detection and correction Ordered Byte-stream

Application writes bytes TCP sends segments Application reads bytes

Full duplex, two way connection Flow and congestion controlled

Protocol implemented entirely at the ends Fate sharing

Page 78: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 78

What’s Different From Link Layers?

Logical link vs. physical link Must establish connection

Variable RTT May vary within a connection

Reordering packets How long can packets live max segment

lifetime Can’t expect endpoints to exactly match link

Buffer space availability Packets in transmission, delay X bandwidth

Transmission rate Don’t directly know transmission rate

Page 79: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 79

TCP Header

Source port Destination port

Sequence number

Acknowledgement

Advertised windowHdrLen Flags0

Checksum Urgent pointer

Options (variable)

Data

Flags: SYNFINRESETPUSHURGACK

Page 80: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 80

TCP Flow Control TCP is a sliding window protocol

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

Page 81: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 82: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 83: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 83

Self-clocking

PrPb

Ar

Ab

ReceiverSender

As

Page 84: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 85: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 86: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 86

Congestion Window

Time

CongestionWindow

Slow start with each time out

Page 87: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 88: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 89: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 90: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 91: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 91

Fast Recovery

Page 92: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 92

Fast Recovery

Time

Sequence NoSent for each dupack after

W/2 dupacks arrive

Page 93: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 94: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 95: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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?

Page 96: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

Univ. of Tehran Computer Network 96

Queues and Queuing Delay

Cross traffic causes congestion and

variable queuing delay.

Page 97: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 98: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 99: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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)

Page 100: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 101: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 102: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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.

Page 103: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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)

Page 104: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 105: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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.

Page 106: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

Page 107: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

….

Page 108: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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

….

Page 109: Univ. of TehranWireless Ad Hoc/Sensor Networks1 Special Topics on Wireless Ad-hoc Networks University of Tehran Dept. of EE and Computer Engineering By:

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