fall 2012: fcm 708 bridge foundation i
TRANSCRIPT
Fall 2012: FCM 708 Bridge Foundation I
Prof. Shamik Sengupta
Instructor’s Website: http://jjcweb.jjay.cuny.edu/ssengupta/ Blackboard Website: https://bbhosted.cuny.edu/
Intro to Computer Networking
What is network: “nuts and bolts” view
1. Numerous connected computing devices: hosts = end systems – running network apps
Home network
Institutional network
Mobile network
Global ISP
Regional ISP
router
PC
server
wireless laptop cellular handheld
wired links
access points
2. communication links fiber, copper, radio,
satellite transmission rate =
bandwidth
3. routers: forward packets (chunks of data)
1-3
Categorization of networks by Application type
• Business Networks • Home Networks • Wireless Networks • Mobile Networks
1-4
Example Network Applications (1)
A network with two clients and one server (typical client-server connection)
1-5
Example Network Applications (2)
The client-server model involves requests and replies over the public/private network
1-6
Example Network Applications (3)
Peer-to-peer networking: no fixed clients and servers
1-7
6-8
Example wireless network (4)
network infrastructure
wireless hosts laptop, PDA, IP phone run applications may be stationary (non-
mobile) or mobile wireless does not always
mean mobility
Mobile Users
Combinations of wireless networks and mobile computing
Remember, there’s a difference in terminology between mobile users and wireless users
1-9
Categorization of networks by coverage scale
• Personal area networks (PAN) • Local area networks (LAN) • Metropolitan area networks (MAN) • Wide are networks (WAN) • The Internet (Global network)
1-10
Personal Area Network (PAN)
Bluetooth PAN configuration
1-11
Local Area Networks (LAN)
Wireless and wired LANs. (a) 802.11. (b) Switched Ethernet.
1-12
Metropolitan Area Networks (MAN)
A metropolitan area network 1-13
Wide Area Networks (WAN)
WAN that connects three branch offices in Australia 1-14
Coverage scale (contd.) Classification of interconnected processors by scale
1-15
A different categorization of networks
In terms of communication technology
• Unicasting • Broadcasting • Multicasting
1-16
Lecture 3
The Network Core
• Internet: mesh of interconnected routers
• How is data transferred through networks?
• Two methodologies
– Circuit switching – Packet switching
Lecture 3
Network Core: Circuit Switching
• End-end resources reserved for “call”
– dedicated circuit per call: like
telephone net
– dedicated bandwidth resources: no sharing
– Guaranteed performance
– Overhead: call setup required
Lecture 3
Network Core: Circuit Switching
• Total network resources (e.g., bandwidth) divided into “pieces” – pieces allocated to each call – resource piece idle if not used by owning call (no
sharing)
• dividing link bandwidth into “pieces”…HOW?
– frequency division multiplexing (FDM) • Users use different frequency channels
– time division multiplexing (TDM) • Users use different time slots
Lecture 3
Circuit Switching: FDM and TDM FDM
frequency
time
TDM
frequency
time
4 users
Example:
Lecture 3
Network Core: Packet Switching
each end-end data stream divided into packets
• user A, B packets share network resources
• each packet uses full link bandwidth
• resources used as needed
Circuit switching Bandwidth division into “pieces”
Dedicated allocation Resource reservation
No flexibility
Lecture 3
Packet Switching
A
B
C 100 Mb/s Ethernet
1.5 Mb/s
D E
queue of packets waiting for output
link
Lecture 3
Packet switching versus circuit switching
• Adv.: Packet switching allows users to use the network dynamically! – Lot of flexibility, dynamic sharing – No idle resource wastage – simpler, no call setup
• Disadv.: – No dedicated resources for each user – With excessive users: Excessive congestion – packet delay and loss: performance degrade
How do delay and loss occur in Internet/network?
Course Overview 1-24
How do loss and delay occur? packets queue in router buffers • packet arrival rate to link exceeds output link capacity • packets queue, wait for turn
A
B
packet being transmitted (delay)
packets queueing (delay) free (available) buffers: arriving packets dropped (loss) if no free buffers
Course Overview 1-25
Four sources of packet delay
• 1. nodal processing: – check bit errors – determine output link
A
B
propagation
transmission
nodal processing queueing
2. queueing time waiting at output
link for transmission depends on congestion
level of router
Course Overview 1-26
Delay in packet-switched networks 3. Transmission delay: • R=link bandwidth (bps) • L=packet length (bits) • time to send bits into link
= L/R
4. Propagation delay: • d = length of physical link • s = propagation speed in
medium (~2x108 m/sec) • propagation delay = d/s
A
B
propagation
transmission
nodal processing queueing
Note: s and R are very different quantities!
Course Overview 1-27
Total delay
• dproc = processing delay – typically a few microsecs or less
• dqueue = queuing delay – depends on congestion
• dtrans = transmission delay – = L/R, significant for low-speed links
• dprop = propagation delay – a few microsecs to hundreds of msecs
proptransqueueproctotal ddddd +++=
Lecture 3
Packet loss
• queue (aka buffer) preceding link in buffer has finite capacity
• packet arriving to full queue dropped (aka lost) • lost packet may be retransmitted by previous
node, by source end system, or not at all A
B
packet being transmitted
packet arriving to full buffer is lost
buffer (waiting area)
human protocols:
… specific msgs sent … specific actions taken
when msgs received, or other events
network protocols: • machines rather than
humans • all communication activity
governed by protocols
protocols define format, order of msgs sent and received among network entities, and actions
taken on msg transmission, receipt
What is computer networking: an operational view
1-29
Computer networking: an operational view
Any communication is all about protocol
networking protocol
Hi
Hi Got the time? 2:00
Connection req.
Connection reply.
Get http://jjcweb.jjay.cuny.edu/ssengupta/slide.ppt
<file> time
human protocol
1-30
1-31
Protocol “Layers” Networks are complex! It is not just two machines communicating!
• Millions of components:
– hosts – routers – Access networks – Physical links
• Numerous functionalities
Question: How to manage such vast
amount of components?
Soln: Divide functionalities among multiple layers.
1-32
ticket (purchase)
baggage (check)
gates (load)
runway (takeoff)
airplane routing
departure airport
arrival airport
intermediate air-traffic control centers
airplane routing airplane routing
ticket (complain)
baggage (claim
gates (unload)
runway (land)
airplane routing
ticket
baggage
gate
takeoff/landing
airplane routing
Layering of airline functionality
Layers: each layer implements a service – via its own internal-layer actions – relying on services provided by layer below and above
• Another example: Postal Service!
1-33
What are the adv. of layering?
Network is a huge complex system.
• Reduce the design complexity • Ease of updating the system
– change of implementation of layer’s service transparent to rest of system
– e.g., Postal service (overnight flight or overnight ground)
1-34
Internet protocol stack
application
transport
network
link
physical
• application – support host/network applications – Email, FTP, HTTP
• transport – process-process data transfer – TCP, UDP
• network – routing of datagrams from src. to destn. – IP address, routing protocols
• link – data transfer between neighboring network elements – Ethernet
• physical – bits “on the wire”
(Compare with the Postal System!)
Layering: logical communication
application transport network
link physical
application transport network
link physical application
transport network
link physical
application transport network
link physical
network link
physical
data
data Each layer: • Only talks with its
peer layer; • performs actions,
exchange messages with peers
• Relying on services provided by layer below
data
transport
transport
ack
35
1-36
source application transport network
link physical
Ht Hn M
segment Ht
datagram
destination application transport network
link physical
Ht Hn Hl M
Ht Hn M
Ht M
M
network link
physical
link physical
Ht Hn Hl M
Ht Hn M
Ht Hn M
Ht Hn Hl M
router
switch
Layering: physical communication
message M
Ht M
Hn frame
Encapsulation
message
1-37
A closer look at network: Access networks and physical media
Q: How to connect end
systems to edge router? • residential access nets • institutional access
networks (school, company) • Wireless access networks
telephone network Internet
home dial-up modem
ISP modem (e.g., AOL)
home PC
central office
Uses existing telephony infrastructure
Home is connected to central office up to 56Kbps direct access to router (often less) Can’t surf and phone at same time: not “always on”
Dial-up Modem
38
telephone network
DSL modem
home PC
home phone
Internet Existing phone line: 0-4KHz phone; 4-50KHz upstream data; 50KHz-1MHz downstream data
splitter
central office
Digital Subscriber Line (DSL)
Also uses existing telephone infrastruture up to 1 Mbps upstream (today typically < 256 kbps) up to 8 Mbps downstream (today typically < 1 Mbps) dedicated physical line to telephone central office
39
1-40
Residential access: cable modems
• Does not use telephone infrastructure – Instead uses cable TV infrastructure
• network of cable attaches homes to ISP router
– homes share access to router – unlike DSL, which has dedicated access
100 Mbps
100 Mbps
100 Mbps 1 Gbps
server
Ethernet switch
Institutional router
To Institution’s ISP
Institutional access: local area networks
Typically used in companies, universities, etc 10 Mbs, 100Mbps, 1Gbps, 10Gbps Ethernet Today, end systems typically connect into Ethernet
switch 41
1-42
Wireless access networks: unguided media
• shared wireless access network connects end system to router – via base station aka “access point”
• wireless LANs: – 802.11b/g (WiFi): 11 or 54 Mbps
• wider-area wireless access
– WiMAX (10’s Mbps) over wide area – wireless access to ISP router via
cellular network
base station
mobile hosts
router
Overview of The Layer Mechanisms
43
Application Layer • Application layer sits on top of all the other layers • Resides in the host machines • Manages various network apps
– Web – e-mail – File transfer – remote login – P2P file sharing – Multi-user network games – streaming video clips – Etc.
application transport network data link physical
application transport network data link physical
application transport network data link physical
1-44 44
45
App-layer protocol defines
• Types of messages exchanged, – e.g., request, response
• Message syntax: – “what” fields in messages &
“how” fields are delineated
• Message semantics – meaning of information in fields
• Rules for how processes send & respond to messages
Public-domain protocols: • defined in RFCs • allows for interoperability • e.g., HTTP, SMTP Proprietary protocols: • e.g., Skype
Application-layer protocols (cont).
Q: how does a process “identify” the other process with which it wants to communicate?
– IP address of host running other process
– “port number” - allows receiving host to determine to which
local process the message should be delivered
46
47
What transport service does an app need? Data loss • some apps (e.g., audio) can tolerate some loss • other apps (e.g., file transfer, telnet) require 100% reliable data
transfer
Timing • some apps (e.g., Internet telephony, interactive games)
require low delay to be “effective”
48
Transport service requirements of common apps
Application
file transfer e-mail
Web documents real-time audio/video
stored audio/video interactive games
Data loss no loss no loss no loss loss-tolerant loss-tolerant loss-tolerant
Throughput elastic elastic elastic audio: 5kbps-1Mbps video:10kbps-5Mbps same as above few kbps up
Time Sensitive no no no yes, 100’s msec yes, few secs yes, 100’s msec
What are the major transport layer service “provider” protocols?
49
Internet apps: application, transport protocols
Application
e-mail remote terminal access
Web file transfer
streaming multimedia
Internet telephony
Application layer protocol SMTP [RFC 2821] Telnet [RFC 854] HTTP [RFC 2616] FTP [RFC 959] HTTP (eg Youtube), RTP [RFC 1889] SIP, RTP, proprietary (e.g., Skype)
Underlying transport protocol TCP TCP TCP TCP TCP or UDP typically UDP
The HTTP protocol
HTTP: HyperText Transfer Protocol
• Web’s application layer protocol • client/server model
– client: browser that requests, receives, “displays” Web objects
– server: Web server sends objects in response to requests
• http1.0: RFC 1945 • http1.1: RFC 2068
PC running Explorer
Server running
Web server
Mac running Navigator
50
The HTTP protocol continued
HTTP: TCP transport service: • client initiates TCP connection to
server, port 80 • server accepts TCP connection
from client • http messages (application-layer
protocol messages) exchanged between browser (http client) and Web server (http server)
• TCP connection closed
HTTP is “stateless” • server maintains no
information about past client requests
51
HTTP connections
Nonpersistent HTTP • At most one object is sent
over a TCP connection.
Persistent HTTP • Multiple objects can be
sent over single TCP connection between client and server.
1-52 1-52
Nonpersistent HTTP Suppose user enters URL www.someSchool.edu/someDepartment/home.index
1a. HTTP client initiates TCP connection to HTTP server (process) at www.someSchool.edu on port 80
2. HTTP client sends HTTP request message (containing URL) into TCP connection socket. Message indicates that client wants object someDepartment/home.index
1b. HTTP server at host www.someSchool.edu waiting for TCP connection at port 80. “accepts” connection, notifying client
3. HTTP server receives request message, forms response message containing requested object, and sends message into its socket
time
(contains text, references to 10
jpeg images)
1-53 1-53
Nonpersistent HTTP (cont.)
5. HTTP client receives response message containing html file, displays html. Parsing html file, finds 10 referenced jpeg objects
6. Steps 1-5 repeated for each of 10 jpeg objects
4. HTTP server closes TCP connection.
time
1-54 1-54
Persistent HTTP
Nonpersistent HTTP issues: • requires connection for each
object • Too much time overhead
Persistent HTTP • server leaves connection open
after sending response • subsequent HTTP messages
between same client/server sent over open connection
• client sends requests as soon as it encounters a referenced object
1-55 1-55
56
HTTP Message Format
• two types of HTTP messages: request, response • HTTP request message:
– ASCII (human-readable format)
GET /somedir/page.html HTTP/1.1 Host: www.someschool.edu User-agent: Mozilla/4.0 Connection: close Accept-language:fr (extra carriage return, line feed)
request line (GET, POST,
HEAD commands)
header lines
Carriage return, line feed
indicates end of message
57
HTTP request message: general format
58
Other Method Types
HTTP/1.0 • GET • POST • HEAD
– asks server to leave requested object out of response
HTTP/1.1 • GET, POST, HEAD • PUT
– uploads file in entity body to path specified in URL field
• DELETE – deletes file specified in the
URL field
59
HTTP response message
HTTP/1.1 200 OK Connection close Date: Thu, 06 Aug 1998 12:00:15 GMT Server: Apache/1.3.0 (Unix) Last-Modified: Mon, 22 Jun 1998 …... Content-Length: 6821 Content-Type: text/html data data data data data ...
status line (protocol
status code status phrase)
header lines
data, e.g., requested HTML file
60
HTTP response status codes
200 OK – request succeeded, requested object later in this message
301 Moved Permanently – requested object moved, new location specified later in this
message (Location:)
400 Bad Request – request message not understood by server
404 Not Found – requested document not found on this server
505 HTTP Version Not Supported
In first line in server->client response message. A few sample codes:
FTP: the file transfer protocol
• transfer file to/from remote host • client/server model
– client: side that initiates transfer (either to/from remote) – server: remote host
• ftp server: port 21
file transfer FTP server
FTP user
interface
FTP client
local file system
remote file system
user at host
Lecture 5
FTP: separate control, data connections
1. FTP client contacts FTP server at port 21
2. client authorized over control connection
3. client browses remote directory by sending commands over control connection.
4. when server receives file transfer command, server opens 2nd TCP connection (for file) to client
5. after transferring one file, server closes data connection.
FTP client
FTP server
TCP control connection port 21
TCP data connection port 20
Lecture 5
Application layer
• Email and SMTP (Simple Mail Transfer Protocol)
Lecture 5
Electronic Mail
Three major components: • user agents • mail servers • simple mail transfer protocol:
SMTP
User Agent • a.k.a. “mail reader” • composing, editing, reading mail
messages • e.g., Outlook, Mozilla
Thunderbird • outgoing, incoming messages
stored on server
user mailbox
outgoing message queue
mail server
user agent
user agent
user agent
mail server
user agent
user agent
mail server
user agent
SMTP
SMTP
SMTP
Lecture 5
Electronic Mail: mail servers
Mail Servers • mailbox contains incoming
messages for user • message queue of outgoing (to
be sent) mail messages • SMTP protocol between mail
servers to send email messages – client: sending mail server – “server”: receiving mail
server
mail server
user agent
user agent
user agent
mail server
user agent
user agent
mail server
user agent
SMTP
SMTP
SMTP
Lecture 5
Scenario: Alice sends message to Bob 1) Alice uses UA to compose
message and “to” [email protected]
2) Alice’s UA sends message to her mail server;
3) Message placed in message queue
4) Client side of SMTP opens TCP connection with Bob’s mail server and sends Alice’s message
5) Bob’s mail server places the message in Bob’s mailbox
6) Bob invokes his user agent to read message
user agent
mail server
mail server user
agent
1
2 3 4 5 6
Lecture 5
SMTP: comparison with HTTP
• SMTP uses persistent connections
Comparison with HTTP: • HTTP: pull • SMTP: push
• HTTP: port 80 • SMTP: port 25
• Both require guarantee • Both use TCP connection
Lecture 5
Mail access protocols user
agent
sender’s mail server
user agent
SMTP SMTP access protocol
receiver’s mail server
• Post Office Protocol (POP3)
• Internet Message Access Protocol (IMAP)
Lecture 5
POP3 and IMAP: Comparison POP3 • Uses “download and
delete” mode. • Bob cannot re-read e-mail
if he changes client • POP3 is “stateless” across
sessions
IMAP • Keep all messages in one
place: the server • Allows user to organize
messages in folders • IMAP keeps user state
across sessions: – names of folders and
mappings between message IDs and folder name
Lecture 5
Transport Layer
70
Transport services and protocols
• provide logical communication between app’ processes running on different hosts
• transport protocols run in end systems
• transport vs network layer services:
• network layer: data transfer between end systems
• transport layer: data transfer between processes – relies on network layer
services
application transport network data link physical
application transport network data link physical
network data link physical
network data link physical
network data link physical
network data link physical
network data link physical
71
Transport-layer protocols
Internet transport services: • reliable, in-order unicast delivery
(TCP) – congestion – flow control – connection setup
• unreliable (“best-effort”),
unordered unicast or multicast delivery (UDP)
application transport network data link physical
application transport network data link physical
network data link physical
network data link physical
network data link physical
network data link physical
network data link physical
72
Principles of Reliable data transfer
Sender sends one packet, then waits for receiver response
stop and wait
Sender needs to know whether receiver has received the packets
Simplest implementation:
73
Stop & Wait protocol
74
World is not ideal
Practical scenario: underlying channel can lose packets (data or ACKs) because of many reasons – What if data packet gets lost? – What if Ack packet gets lost?
75
World is not ideal
Practical scenario: underlying channel can lose packets (data or ACKs) because of many reasons
– What if data packet gets lost? – What if Ack packet gets lost?
Approach: sender waits “reasonable” amount of time for ACK
• retransmits if no ACK received in this time
76
Stop & wait protocol with loss
77
New constraint: Stop & wait protocol with delay
Practical scenario: • What if Ack packet lost or
just delayed (not lost)
Approach: sender waits “reasonable” amount of time for ACK
• retransmits if no ACK received in this time
• if pkt (or ACK) just delayed (not lost): – retransmission will be
duplicate
• Sender, receiver need to specify seq # of pkt being handled
78
Stop & wait protocol with delay
79
Performance of stop-and-wait
first packet bit transmitted, t = 0
sender receiver
RTT
last packet bit transmitted, t = L / R
first packet bit arrives last packet bit arrives, send ACK
ACK arrives, send next packet, t = RTT + L / R
U sender =
.008 30+.008
= 0.00027
L / R RTT + L / R
=
Packet size = 8 Kb Transmission rate = 1 Mbps
= 30 sec.
80
Pipelined protocols Pipelining: sender allows multiple, “in-flight”, yet-to-be-
acknowledged pkts – range of sequence numbers must be increased – buffering at sender and/or receiver
81
Pipelining: increased utilization
first packet bit transmitted, t = 0
sender receiver
RTT
last bit transmitted, t = L / R
first packet bit arrives last packet bit arrives, send ACK
ACK arrives, send next packet, t = RTT + L / R
last bit of 2nd packet arrives, send ACK last bit of 3rd packet arrives, send ACK
U sender =
.024 30.008
= 0.0008
3 * L / R RTT + L / R
=
Increase utilization by a factor of 3!
Two generic forms of pipelined protocols: go-Back-N, selective repeat 82
Go-Back-N
Sender: • k-bit seq # in pkt header • “window” of up to N, consecutive unack’ed pkts allowed
ACK(n): ACKs all pkts up to, including seq # n - “cumulative ACK” timer for each in-flight pkt timeout(n): retransmit pkt n and all higher seq # pkts in window
83
GBN in action
84
Selective Repeat
• receiver individually acknowledges all correctly received pkts – buffers pkts, as needed, for eventual in-order delivery to upper
layer
• sender only resends pkts for which ACK not received – sender timer for each unACKed pkt
• sender window – N consecutive seq #’s – again limits seq #s of sent, unACKed pkts
85
Selective repeat in action
86