Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob.

29
Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob

description

Transport vs. network layer  network layer: logical communication between hosts  transport layer: logical communication between processes  relies on, enhances, network layer services Mateen Yaqoob Department of Computer Science

Transcript of Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob.

Page 1: Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob.

Advance Computer NetworksLecture#03

Instructor:Engr. Muhammad Mateen Yaqoob

Page 2: Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob.

Transport services and protocols provide logical

communication between app processes running on different hosts

transport protocols run in end systems send side: breaks

app messages into segments, passes to network layer

rcv side: reassembles segments into messages, passes to app layer

more than one transport protocol available to apps Internet: TCP and

UDP

applicationtransportnetworkdata linkphysical

logical end-end transport

applicationtransportnetworkdata linkphysical

Mateen Yaqoob

Department of Computer Science

Page 3: Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob.

Transport vs. network layer network layer: logical communication between hosts transport layer: logical communication between processes

relies on, enhances, network layer services

Mateen Yaqoob

Department of Computer Science

Page 4: Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob.

Internet transport-layer protocols reliable, in-order

delivery (TCP) congestion control flow control connection setup

unreliable, unordered delivery: UDP no-frills extension

of “best-effort” IP services not

available: delay guarantees bandwidth

guarantees

applicationtransportnetworkdata linkphysical

applicationtransportnetworkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysicalnetwork

data linkphysical network

data linkphysical

logical end-end transport

Mateen Yaqoob

Department of Computer Science

Page 5: Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob.

UDP: User Datagram Protocol [RFC 768] “no frills,” “bare

bones” Internet transport protocol

“best effort” service, UDP segments may be: lost delivered out-of-

order to app connectionless:

no handshaking between UDP sender, receiver

each UDP segment handled independently of others

UDP use: streaming

multimedia apps (loss tolerant, rate sensitive)

DNS SNMP

reliable transfer over UDP: add reliability at

application layer application-specific

error recovery!

Mateen Yaqoob

Department of Computer Science

Page 6: Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob.

UDP: segment header

source port # dest port #32 bits

applicationdata (payload)

UDP segment format

length checksum

length, in bytes of UDP segment,

including header

no connection establishment (which can add delay)

simple: no connection state at sender, receiver

small header size no congestion

control: UDP can blast away as fast as desired

why is there a UDP?

Mateen Yaqoob

Department of Computer Science

Page 7: Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob.

TCP: Overview RFCs: 793,1122,1323, 2018, 2581

full duplex data: bi-directional data

flow in same connection

MSS: maximum segment size

connection-oriented: handshaking

(exchange of control msgs) inits sender, receiver state before data exchange

flow controlled: sender will not

overwhelm receiver

point-to-point: one sender, one

receiver reliable, in-order

byte steam: no “message

boundaries” pipelined:

TCP congestion and flow control set window size

Mateen Yaqoob

Department of Computer Science

Page 8: Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob.

TCP segment structure

source port # dest port #

32 bits

applicationdata (variable length)

sequence numberacknowledgement number

receive window

Urg data pointerchecksum

FSRPAUheadlen

notused

options (variable length)

URG: urgent data (generally not used)

ACK: ACK #valid

PSH: push data now(generally not used)

RST, SYN, FIN:connection estab(setup, teardown

commands)

# bytes rcvr willingto accept

countingby bytes of data(not segments!)

Internetchecksum

(as in UDP)

Mateen Yaqoob

Department of Computer Science

Page 9: Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob.

TCP seq. numbers, ACKs

Usertypes

‘C’

host ACKsreceipt

of echoed‘C’

host ACKsreceipt of‘C’, echoesback ‘C’

simple telnet scenario

Host BHost A

Seq=42, ACK=79, data = ‘C’

Seq=79, ACK=43, data = ‘C’

Seq=43, ACK=80

Mateen Yaqoob

Department of Computer Science

Page 10: Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob.

TCP round trip time, timeoutQ: how to set

TCP timeout value?

longer than RTT but RTT varies

too short: premature timeout, unnecessary retransmissions

too long: slow reaction to segment loss

Q: how to estimate RTT?

SampleRTT: measured time from segment transmission until ACK receipt ignore

retransmissions SampleRTT will vary,

want estimated RTT “smoother” average several

recent measurements, not just current SampleRTTMateen Yaqoob

Department of Computer Science

Page 11: Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob.

RTT: gaia.cs.umass.edu to fantasia.eurecom.fr

100

150

200

250

300

350

1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106time (seconnds)

RTT

(mill

isec

onds

)

SampleRTT Estimated RTT

EstimatedRTT = (1- )*EstimatedRTT + *SampleRTT exponential weighted moving average influence of past sample decreases

exponentially fast typical value: = 0.125

TCP round trip time, timeout

RTT

(milli

seco

nds) RTT: gaia.cs.umass.edu to fantasia.eurecom.fr

sampleRTTEstimatedRTT

time (seconds)

Mateen Yaqoob

Department of Computer Science

Page 12: Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob.

timeout interval: EstimatedRTT plus “safety margin” large variation in EstimatedRTT -> larger safety

margin estimate SampleRTT deviation from

EstimatedRTT: DevRTT = (1-)*DevRTT + *|SampleRTT-EstimatedRTT|

TCP round trip time, timeout

(typically, = 0.25)

TimeoutInterval = EstimatedRTT + 4*DevRTT

estimated RTT “safety margin”

Mateen Yaqoob

Department of Computer Science

Page 13: Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob.

TCP reliable data transfer TCP creates rdt

service on top of IP’s unreliable service pipelined segments cumulative acks single

retransmission timer

retransmissions triggered by: timeout events duplicate acks

let’s initially consider simplified TCP sender: ignore duplicate

acks ignore flow control,

congestion control

Mateen Yaqoob

Department of Computer Science

Page 14: Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob.

TCP sender events:data rcvd from app: create segment

with seq # seq # is byte-

stream number of first data byte in segment

start timer if not already running think of timer as

for oldest unacked segment

expiration interval: TimeOutInterval

timeout: retransmit

segment that caused timeout

restart timer ack rcvd: if ack

acknowledges previously unacked segments update what is

known to be ACKed

start timer if there are still unacked segments

Mateen Yaqoob

Department of Computer Science

Page 15: Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob.

TCP: retransmission scenarios

lost ACK scenario

Host BHost A

Seq=92, 8 bytes of data

ACK=100

Seq=92, 8 bytes of data

Xtimeo

ut

ACK=100

premature timeout

Host BHost A

Seq=92, 8 bytes of data

ACK=100

Seq=92, 8bytes of data

timeo

ut

ACK=120

Seq=100, 20 bytes of data

ACK=120

SendBase=100SendBase=120

SendBase=120

SendBase=92

Mateen Yaqoob

Department of Computer Science

Page 16: Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob.

TCP: retransmission scenarios

X

cumulative ACK

Host BHost A

Seq=92, 8 bytes of data

ACK=100

Seq=120, 15 bytes of data

timeo

ut

Seq=100, 20 bytes of data

ACK=120

Mateen Yaqoob

Department of Computer Science

Page 17: Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob.

TCP ACK generation [RFC 1122, RFC 2581]

event at receiver

arrival of in-order segment withexpected seq #. All data up toexpected seq # already ACKed

arrival of in-order segment withexpected seq #. One other segment has ACK pending

arrival of out-of-order segmenthigher-than-expect seq. # .Gap detected

arrival of segment that partially or completely fills gap

TCP receiver action

delayed ACK. Wait up to 500msfor next segment. If no next segment,send ACK

immediately send single cumulative ACK, ACKing both in-order segments

immediately send duplicate ACK, indicating seq. # of next expected byte

immediate send ACK, provided thatsegment starts at lower end of gap

Mateen Yaqoob

Department of Computer Science

Page 18: Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob.

TCP flow controlapplicationprocess

TCP socketreceiver buffers

TCPcode

IPcode

applicationOS

receiver protocol stack

application may remove data from

TCP socket buffers ….

… slower than TCP receiver is delivering(sender is sending)

from sender

receiver controls sender, so sender won’t overflow receiver’s buffer by transmitting too much, too fast

flow control

Mateen Yaqoob

Department of Computer Science

Page 19: Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob.

TCP flow control

buffered data

free buffer spacerwnd

RcvBuffer

TCP segment payloads

to application process receiver “advertises”

free buffer space by including rwnd value in TCP header of receiver-to-sender segments RcvBuffer size set via

socket options (typical default is 4096 bytes)

many operating systems autoadjust RcvBuffer

sender limits amount of unacked (“in-flight”) data to receiver’s rwnd value

guarantees receive buffer will not overflow

receiver-side buffering

Mateen Yaqoob

Department of Computer Science

Page 20: Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob.

Introduction to Network Simulation Tools In the network research area, it is very costly to deploy

a complete test bed containing multiple networked computers, routers and data links to validate and verify a certain network protocol or a specific network algorithm.

The network simulators in these circumstances save a lot of money and time in accomplishing this task.

Network simulators are also particularly useful in allowing the network designers to test new networking protocols or to change the existing protocols in a controlled and reproducible manner.

Mateen Yaqoob

Department of Computer Science

Page 21: Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob.

Types of Network Simulators Commercial

OPNET, QualNet Open Source

NS2, NS3, OMNET++, J-Sim

Mateen Yaqoob

Department of Computer Science

Page 22: Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob.

OPNET Optimized Network Engineering Tools (OPNET) It is one of the most famous and popular commercial

network simulators by the end of 2008 OPNET ' s software environment is called Modeler,

which is specialized for network research and development

It can be flexibly used to study communication networks, devices, protocols, and applications

Because of the fact of being a commercial software provider, OPNET offers relatively much powerful visual or graphical support for the users

Mateen Yaqoob

Department of Computer Science

Page 23: Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob.

OPNET We can see all the topology configuration and

simulation results can be presented very intuitively and visually.

The parameters can also be adjusted and the experiments can be repeated easily through easy operation through the GUI.

OPNET is based on a mechanism called discrete event system which means that the system behavior can simulate by modeling the events in the system in the order of the scenarios the user has set up.

Mateen Yaqoob

Department of Computer Science

Page 24: Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob.

Features of OPNET1. Fast discrete event simulation engine 2. Lot of component library with source code3. Object-oriented modeling 4. Hierarchical modeling environment 5. Scalable wireless simulations support 6. 32-bit and 64-bit graphical user interface7. Customizable wireless modeling 8. Discrete Event, Hybrid, and Analytical simulation 9. 32-bit and 64-bit parallel simulation kernel10. Grid computing support 11. Integrated, GUI-based debugging and analysis 12. Open interface for integrating external component libraries

Mateen Yaqoob

Department of Computer Science

Page 25: Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob.

OPNET GUI

Mateen Yaqoob

Department of Computer Science

Page 26: Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob.

NS-2 NS2 is one of the most popular open source network

simulators. The original NS is a discrete event simulator targeted at

networking research. NS is originally based on REAL network simulator. First and foremost, NS2 is an object-oriented, discrete

event driven network simulator which was originally developed at University of California-Berkely.

The programming it uses is C++ and OTcl (Tcl script language with Object-oriented extensions developed at MIT).

The usage of these two programming language has its reason.

The biggest reason is due to the internal characteristics of these two languages.

Mateen Yaqoob

Department of Computer Science

Page 27: Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob.

NS2

Mateen Yaqoob

Department of Computer Science

Page 28: Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob.

OMNET++ Similar with NS2 and NS3, OMNeT++ is also a public-

source, component-based network simulator with GUI support.

Its primary application area is communication networks.

OMNeT++ has generic and flexible architecture which makes it successful also in other areas like the IT systems, queuing networks, hardware architectures, or even business processes as well.

Like NS2 and NS3, OMNeT++ is also a discrete event simulator.

It is a component-based architectureMateen Yaqoob

Department of Computer Science

Page 29: Advance Computer Networks Lecture#03 Instructor: Engr. Muhammad Mateen Yaqoob.

OMNET++

Mateen Yaqoob

Department of Computer Science