eecs 489: computer networks required textbooksprotocols – rules governing communication between...
TRANSCRIPT
EECS 489: Computer Networks
Lecture
•Time: MW 12:00-1:30
•Room:1690 CSE
Discussion session:
•Time: Wed 1:30-2:30 (no discussion today)
•Room: 1690 CSE
Instructor: Sugih Jamin
Office: 4737 CSE
Office hours: Mon 1:30-2:30, Tue 2:30-3:30, and by appt.! (but never right before lecture)
Tel: +1 734 763 1583
GSI: Ajay Gopalakrishnan (ajgopala)
Office: 4817 CSE
Office hours: Thu 4-5, Fri 10-11, and by appt.
Required Textbooks
Web Site and Forum
Course Web site: http://www.eecs.umich.edu/~sugih/courses/eecs489/
• Course grade composition
• Policy on collaboration and cheating
• Regrade and late days
Lecture slides will be posted on web site after lecture
Web site and forum are “required readings”
Prerequisites:
• EECS 482
• C
Grading Policy
• 1 Final Exam: 15%
• 1 Midterm Exam: 15%
• 4 Homeworks: 12%
• 4 Programming Assignments: 56%
• Class Participation: 2%
Collaboration:
• All work must be done individually
• Cheating and plagiarizing are not tolerated
Regrade:
• Within 5 working days (except Final Exam and PA4, same day)
• Written request
• Whole work regraded
Late days:
• 4 free late days for the whole term
• 4% per 24 hours or fraction thereof thereafter
What this Course is NOT about
We do NOT cover:
•Homepage design, CSS, PGP, MySQL
•Photoshop, Flash, Silverlight, whatever
•Web site administration
•Web hosting and data center setup and maintenance
•DSL or cable modem setup
•LAN setup and administration
•How to connect to the Internet
•How to become an ISP
•How to run an ISP
What this Course Covers
Network Protocols and Architectures:
• Internet: a network of networks
• Application layer, naming
• Network layer: addressing and routing
• Link layer and wireless
• Transport layer and queue management
• Multimedia networking
• Security in networks
• Focus on the fundamental concepts, not merely the technology
• There will always be new protocols, but how do people design them?
• What are architectural principles?
• Provide high-level overview of computer networks
• Wired, wireless, cellular
• How they are interconnected
What is a Communication Networks
Communication network offers one basic service: move information• bird, fire, messenger, truck, telegraph, telephone, Internet …
Another example, transportation network: move objects• horse, train, truck, airplane ...
• a car carrying a trunk load of tapes can also move information . . . .
What distinguish different types of networks?• the services they provide
What distinguish the services?• Latency
• Bandwidth
• a car carrying a trunk load of tapes has high bandwidth but low latency
• Loss rate
• Number of end systems supported
• Service interface (how to invoke the service?)
• Others
• Reliability, unicast vs. multicast, real-time...
Communication Networks Taxonomy
Communication
networks
Circuit-switched
networks
Packet-switched
networks
POTS Network:• parses number dialed
• sets up a circuit between caller and callee
• sends signal to ring callee’s phone
! a circuit is set up between the two ends
Strengths:
•no end-point intelligence
•excellent voice performance
Weaknesses:
•difficult to add new services
• achieves performance and reliability by over-allocating resources (expensive)
The Internet:• data parceled into packets
• each packet carries a destination address
• each packet is routed independently
• packets can arrive out of order
• packets may not arrive at all
Strengths:
• intelligence at end points
• decentralized control
• operates over heterogeneous access techs
Weaknesses:
• variable performance, no quality of service
• no trusted infrastructure
What’s the Internet
regional ISP
router workstation
server mobile
company
network
local ISP
Internet: “network of networks”
• loosely hierarchical
• public Internet versus private intranet
Network components:
• hosts – communication endpoints: workstations, PDAs, cell phones, toasters, millions of them, running network applications
• Applications: Web browser, Email clients, Chat clients, etc....
• links – carry bits from one place to another: fiber, copper, satellite, …
• routers/switches – interconnect links: store and forward packets
History of the Internet
! 68-70’s: started as a research project, 56 kbps, initially 4 nodes (UCLA, UCSB, SRI, Utah) then < 100 computers
! 80-83: TCP/IP, DNS; ARPANET and MILNET split
! 85-86: NSF builds NSFNET as backbone, links 6 Supercomputer centers, 1.5 Mbps, 10,000 computers
! 87-90: link regional networks, NSI (NASA), ESNet (DOE), DARTnet, TWBNet (DARPA), 100,000 computers
! 90-92: NSFNET moves to 45 Mbps, 16 mid-level networks
! 94: NSF backbone dismantled, multiple private backbones; Introduction of Commercial Internet
! Today: backbones run at 10 Gbps, close to 200 millions computers in 150 countries
The ARPANet
Paul Baran
• RAND Corp, early 1960s
• Communications networks that would survive a major enemy attack
ARPANet: Research vehicle for “Resource Sharing Computer Networks”
• 2 September 1969: UCLA first node on the ARPANet
• December 1969: 4 nodes connected by phone lines
SRI940
UCLASigma 7
UCSBIBM 360
UtahPDP 10
IMPs
BBN team that implementedthe interface message processor
ARPANet Evolves into Internet
Web HostingMultiple ISPs
Internet2 BackboneInternet Exchanges
Application Hosting, Data Center
ARPANetSATNetPRNet
TCP/IP NSFNet Deregulation &Commercialization
1965 1975 1985 1995 2005
WWW
ISPData Center
15 16
Parallel Backbones
Qwest IP Backbone (Late 1999) Digex Backbone
GTE Internetworking Backbone
28
Parallel Backbones
30
What’s the Internet
Earlier we said . . . .
• data parceled into packets
• each packet carries a destination address
• each packet is routed independently
• packets can arrive out of order
• packets may not arrive at all
However, the Internet provides two types of delivery services:
1. connectionless (datagram, UDP, e.g., streaming media app, games)
2. connection oriented (byte stream, TCP, e.g., web, email)
Connection oriented service provides:
1. end-to-end reliability (sender retransmit lost packets)
2. in-sequence delivery (receiver buffers incoming packets until it can deliver them in order)
How does a router know which router to forward a packet to?
How does a receiver know the correct ordering of packets?
How does a sender know which packet is lost and must be retransmitted?
Protocols – rules governing communication between nodes, e.g., TCP/IP
• a “node” is one of sender, router, or receiver
protocols define the format, order of msgs sent and received among network entities, and actions taken on msg transmission, receipt
Internet Protocol Stack
application: supporting network applications
•HTTP, SMTP, FTP, etc.
transport: endhost-endhost data transfer
•TCP, UDP
network: routing of datagrams from source to destination
•IP, routing protocols
link: data transfer between neighboring network elements
•Ethernet, WiFi
physical: bits “on the wire”
application
transport
network
link
physical
Layering in the IP Protocols
Internet Protocol
Transmission ControlProtocol (TCP)
User Datagram Protocol (UDP)
TelnetHTTP
SONET ATMEthernet
RTPDNSFTP
Application-Layer Protocols
• Messages exchanged between applications
• Syntax and semantics of the messages between end-hosts
• Tailored to the specific application (e.g., Web, e-mail)
• Messages transferred over transport connection (e.g., TCP)
• Popular application-layer protocols
• HTTP, SMTP, FTP, SSH, …
Client Server
GET /index.html HTTP/1.1
HTTP/1.1 200 OK
sourceapplication
transport
network
link
physical
destination
application
transport
network
link
physical
network
link
physical
link
physical
router
switch
Not all Network Elements “Speak” All Layers
Why Layering?
Networks are complex! Many “pieces”:
• applications
• hosts
• routers
• links of various media
Dealing with complex systems:
• explicit structure allows identification of well-defined, specific parts of a large and complex system
• modularization eases maintenance, updating of system
• change of implementation of layer’s service transparent to rest of system
• note that change of implementation is different from change of service definition!
How Do You “Use” the Internet?
You want to send email to [email protected]
At your end, your mailer
• translates cs.usc.edu to its IP address (128.125.1.45)
• decides to use TCP as the transport protocol (Why?)
• creates a socket
• connects to 128.125.1.45 at the well-known SMTP
port # (25)
• parcels out your email into packets
• sends the packets out
On the Internet, your packets got:
• transmitted
• routed
• buffered
• forwarded, or
• dropped
At the receiver, smtpd
• must make a “receiver” ahead of time:
• creates a socket
• decides on TCP
• binds the socket to smtp’s well-
known port #
• listens on the socket
• accepts your smtp connection requests
• recves your email packets
Client-Server Computing
Email (SMTP) uses the client-server paradigm
What is a client?
What is a server?
Process vs. machine
Alternative(s) to client-server?
Sockets API Programming
What is a socket?
Review of sockets (assume familiarity from EECS 482)
(learn how to read man pages!)
Applications need Application Programming Interface (API) to use the network
API: set of function types, data structures, and constants
• allows programmer to learn once, write anywhere
• greatly simplifies job of application programmer
physical
data-link
network
transport
application
socket API
Socket-programming using TCP
Socket: a “door” between application process and end-end transport protocol (UDP or TCP)
process
TCP with
buffers,
variables
socket
controlled by
application
developer
controlled by
operating
system
host or
server
process
TCP with
buffers,
variables
socket
controlled by
application
developer
controlled by
operating
system
host or
server
internet
Sockets
What exactly are sockets?
• an endpoint of a connection
• similar to UNIX file I/O API (provides a file descriptor)
• associated with each end-point (end-host) of a connection
• identified by the IP address and port number of both the sender and receiver
Berkeley sockets is the most popular network API
• runs on Linux, FreeBSD, OS X, Windows
• fed/fed off the popularity of TCP/IP
• can build higher-level interfaces on top of sockets
• e.g., Remote Procedure Call (RPC)
Based on C, single threaded model
• does not require multiple threads
Useful sample code available at
• http://www.kohala.com/start/unpv12e.html
Types of Sockets
Different types of sockets implement different service models
• Stream v.s. datagram
Stream socket (aka TCP)
• connection-oriented
• reliable, in order delivery
• at-most-once delivery, no duplicates
• used by e.g., ssh, http
Datagram socket (aka UDP)
• connectionless (just data-transfer)
• “best-effort” delivery, possibly lower variance in delay
• used by e.g., IP telephony, streaming audio, streaming video, Internet gaming, etc.
Stream/TCP Sockets
socket ()
bind ()
listen ()
accept ()
recv ()
close ()
socket ()
connect ()
send ()
send ()recv ()
close ()time
initialize
establish
dataxfer
terminate
Client Server
Stream/TCP Socket
Server:
! server process must first be running
! server must have created socket (door) that welcomes client’s contact
Client:
! creates client-local TCP socket
! specifies IP address, port number of server process
! When client contacts server: client TCP establishes connection to server TCP
! When contacted by client, server TCP creates new socket for server process to communicate with client
- allows server to talk with multiple clients
- source port numbers used to distinguish clients
Initialize (Client)
int sd;
if ((sd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {
perror("socket");
printf("Failed to create socket\n");
abort();
}
socket creates a socket data structure and attaches it to the process’s file descriptor table
Handling errors that occur rarely usually consumes most of systems code
Establish (Client)
struct sockaddr_in sin;
struct hostent *host = gethostbyname(argv[1]);unsigned int server_addr = *(unsigned long *) host->h_addr_list[0];unsigned short server_port = atoi(argv[2]);
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;sin.sin_addr.s_addr = server_addr;sin.sin_port = htons(server_port);
if (connect(sd, (struct sockaddr *) &sin, sizeof (sin)) < 0) { perror("connect"); printf("Cannot connect to server\n"); abort();}
connect initiates connection (for TCP)
Sending Data Stream (Client)
int send_packets(char *buffer, int buffer_len) { sent_bytes = send(sd, buffer, buffer_len, 0);
if (send_bytes < 0) perror(“send”);
return 0;}
send
• returns how many bytes are actually sent
• must loop to make sure that all is sent(except for blocking I/O, see UNP Section 6.2)
What is blocking and non-blocking I/O?
Why do you want to use non-blocking I/O?