Lecture 04
Lecture 04
Lecture 04
Distributed Networking
Lecture 4– Part 1
Application Layer
FTP: THE FILE TRANSFER PROTOCOL
handshaking (greeting)
transfer of messages
closure
command/response interaction
1 mail
mail
server user
user server
2 agent
agent 3 6
4 5
SAMPLE SMTP INTERACTION
S: 220 hamburger.edu
C: HELO crepes.fr
S: 250 Hello crepes.fr, pleased to meet you
C: MAIL FROM: <alice@crepes.fr>
S: 250 alice@crepes.fr... Sender ok
C: RCPT TO: <bob@hamburger.edu>
S: 250 bob@hamburger.edu ... Recipient ok
C: DATA
S: 354 Enter mail, end with "." on a line by itself
C: Do you like ketchup?
C: How about pickles?
C: .
S: 250 Message accepted for delivery
C: QUIT
S: 221 hamburger.edu closing connection
SMTP: FINAL WORDS
SMTP uses persistent connections Comparison with HTTP:
SMTP requires message (header &
HTTP: pull
body) to be in 7-bit ASCII
SMTP: push
SMTP server uses CRLF.CRLF to
determine end of message both have ASCII command/response
interaction, status codes
From: alice@crepes.fr
MIME version To: bob@hamburger.edu
Subject: Picture of yummy crepe.
method used MIME-Version: 1.0
to encode data Content-Transfer-Encoding: base64
Content-Type: image/jpeg
multimedia data
type, subtype, base64 encoded data .....
parameter declaration .........................
......base64 encoded data
encoded data
MAIL ACCESS PROTOCOLS
obtain list
of peers
trading
chunks
peer
BITTORRENT (1)
Transport Layer
TRANSPORT VS. NETWORK LAYER
network layer: logical communication
between hosts
transport layer: logical communication
between processes
relies on, enhances, network layer services
MULTIPLEXING/DEMULTIPLEXING
P1 P4 application
application P3 P1 application P2
host 2 host 3
host 1
INTERNET TRANSPORT-LAYER PROTOCOLS
reliable, in-order delivery
application
transport
network
(TCP) data link
physical
network
congestion control data link
physical
network
data link
flow control physical
connection setup
unreliable, unordered
network
data link
physicalnetwork
delivery: UDP data link
physical
no-frills extension of “best- network
data link
application
effort” IP physical network transport
data link network
delay guarantees
bandwidth guarantees
TCP VS. UDP
TCP VS. UDP
Features TCP (Yes/No) UDP (Yes/No)
(1) Ordered packets
(2) Connectionless
(3) Reliable data delivery
(no packet loss)
(4) Flow control
(5) Congestion control
(6) delay guarantees
(7) bandwidth
guarantees
TCP VS. UDP
Features TCP (Yes/No) UDP (Yes/No)
(1) Ordered packets Y N
(2) Connectionless N Y
(3) Reliable data delivery Y N
(no packet loss)
(4) Flow control Y N
(5) Congestion control Y N
(6) delay guarantees N N
(7) bandwidth N N
guarantees
UDP: USER DATAGRAM PROTOCOL [RFC 768]
“no frills,” “bare bones”
Internet transport protocol Why is there a UDP?
“best effort” service, UDP no connection establishment
segments may be: (which can add delay)
lost
simple: no connection state
delivered out of order to at sender, receiver
app small segment header
connectionless: no congestion control: UDP
no handshaking between can blast away as fast as
UDP sender, receiver desired
each UDP segment
handled independently of
others
UDP: MORE
often used for streaming
32 bits
multimedia apps
loss tolerant Length, in source port # dest port #
rate sensitive bytes of UDP length checksum
segment,
other UDP uses including
DNS header
SNMP
reliable transfer over UDP: Application
add reliability at application data
layer (message)
application-specific error
recovery!
UDP segment format
PRINCIPLES OF RELIABLE DATA TRANSFER
important in app., transport, link layers
top-10 list of important networking topics!
Sender:
k-bit seq # in pkt header
“window” of up to N, consecutive unACKed pkts allowed
time
simple telnet scenario
TCP RELIABLE DATA TRANSFER
TCP creates rdt service on top retransmissions are
of IP’s unreliable service triggered by:
pipelined segments timeout events
duplicate ACKs
cumulative ACKs
IP
(currently)
TCP data application speed-matching service:
unused buffer
datagrams space (in buffer) process matching send rate to
receiving application’s
drain rate
app process may be
slow at reading from
buffer
Lecture 4– Part 3
Network Layer
TWO KEY NETWORK-LAYER FUNCTIONS
forwarding: move packets analogy:
from router’s input to
appropriate router output routing: process of
routing algorithm
value in arriving
packet’s header
0111 1
3 2
NETWORK LAYER CONNECTION AND CONNECTION-
LESS SERVICE
1 3
2
1 12 3 22
2 63 1 18
3 7 2 17
1 97 3 87
… … … …
application
6. Receive data application
transport 5. Data flow begins
network 4. Call connected 3. Accept call transport
data link 1. Initiate call 2. incoming call network
data link
physical
physical
DATAGRAM NETWORKS
no call setup at network layer
routers: no state about end-to-end connections
no network-level concept of “connection”
packets forwarded using destination host address
packets between same source-dest pair may take different
paths
application
application
transport
transport
network
data link 1. Send data 2. Receive data network
data link
physical
physical
ROUTER ARCHITECTURE OVERVIEW
Two key router functions:
run routing algorithms/protocol (RIP, OSPF, BGP)
forwarding datagrams from incoming to outgoing link
THE INTERNET NETWORK LAYER
Host, router network layer functions:
Link layer
physical layer
IP DATAGRAM FORMAT
IP protocol version 32 bits
number total datagram
header length type of length (bytes)
ver head. length
(bytes) len service for
“type” of data fragment fragmentation/
16-bit identifier flgs
offset reassembly
max number time to upper header
remaining hops live layer checksum
(decremented at
32 bit source IP address
each router)
32 bit destination IP address
upper layer protocol
to deliver payload to Options (if any)
data
(variable length,
typically a TCP
or UDP segment)
IP FRAGMENTATION & REASSEMBLY
network links have MTU
(max.transfer size)
largest possible link-level fragmentation:
frame. in: one large datagram
out: 3 smaller datagrams
large IP datagram divided
(“fragmented”) within net
one datagram becomes
reassembly
several datagrams
“reassembled” only at final
destination
IP header bits used to
identify, order related
fragments
IP ADDRESSING: INTRODUCTION
IP address: 223.1.1.1
10.0.0.4
10.0.0.2
138.76.29.7
10.0.0.3