* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Chapter 1: Foundation
Asynchronous Transfer Mode wikipedia , lookup
Distributed firewall wikipedia , lookup
Wake-on-LAN wikipedia , lookup
Piggybacking (Internet access) wikipedia , lookup
Computer network wikipedia , lookup
Network tap wikipedia , lookup
Deep packet inspection wikipedia , lookup
Zero-configuration networking wikipedia , lookup
Cracking of wireless networks wikipedia , lookup
Airborne Networking wikipedia , lookup
Internet protocol suite wikipedia , lookup
UniPro protocol stack wikipedia , lookup
Recursive InterNetwork Architecture (RINA) wikipedia , lookup
Computer Networks: A Systems Approach, 5e Larry L. Peterson and Bruce S. Davie Chapter 1 Foundation Copyright © 2010, Elsevier Inc. All rights Reserved 1 Chapter 1 Problems What is a computer network? How to build a scalable network that will support different applications? How is a computer network different from other types of networks? What is a computer network architecture? 2 Chapter 1 Chapter Outline Applications Requirements Network Architecture Implementing Network Software Performance 3 Chapter 1 Chapter Goal Exploring the requirements that different applications and different communities place on the computer network Introducing the idea of network architecture Introducing some key elements in implementing Network Software Define key metrics that will be used to evaluate the performance of computer network 4 Chapter 1 Applications Most people know about the Internet (a computer network) through applications World Wide Web Just a single application of the Internet Email Online Social Network Streaming Audio Video File Sharing Instant Messaging … 5 URL Uniform resource locater http://www.just.edu.jo/~misaleh/Teaching/cs342spring2011/main page.html www.just.edu.jo is the name of the machine that serves the page Chapter 1 Application Protocol (WWW) IP: 87.236.232.169 nslookup whois /~misaleh/Teaching/cs342/mainpage.html uniquely identifies the required page 6 HTTP Hyper Text Transfer Protocol TCP Chapter 1 Application Protocol (Cont.) Transmission Control Protocol 17 messages for one URL request 6 to find the IP (Internet Protocol) address 3 for connection establishment of TCP 4 for HTTP (GET) request and acknowledgement (Response) Request: I got your request and I will send the data Reply: Here is the data you requested; I got the data 4 messages for tearing down TCP connection 7 Chapter 1 Example of an application A multimedia application including video-conferencing 8 HTML requests: A couple of seconds delay is acceptable Pages are complete Images can be delivered out of order Etc… Emails: Chapter 1 Expectations!! No missing parts (i.e., the email is identical to what you sent) A minute or two delay is acceptable Etc… Video conferencing: Video and sound MUST be continuous and on a timely matter Some missing parts are acceptable 9 Application Programmer List the services that his application needs: delay bounded delivery of data Network Designer Chapter 1 Requirements Design a cost-effective network with sharable resources Network Provider (usually called Service Provider, for the Inernet, it ISP) List the characteristics of a system that is easy to administer and manage. Add new clients and remove/isolate faulty nodes 10 Chapter 1 Requirements Connectivity Cost-Effective Resource Sharing Support for Common Services Reliability Manageability 11 Chapter 1 Connectivity Need to understand the following terminologies Scale: A system that is designed to support growth to an arbitrarily large size Link: Physical medium that connects nodes Node: a device (could be a computer, switch, etc) on the network Point-to-point: direct link between two nodes Multiple access: multiple nodes share the same link (a) (b) Point-to-point Multiple access 12 Switched Network: a network that uses switches for forwarding Circuit Switched Telephone companies Dedicated/reserved when connection is established Less utilization of the resources Packet Switched Chapter 1 Connectivity Overwhelming majority of computer networks Messages are divided into pieces (discrete blocks) called packets No dedication is required More sharing, thus more utilization Store-and-forward: a switch stores the incoming traffic (packets) in its own buffers then forwards them. 13 Chapter 1 Connectivity Cloud: used to represent any kind of network technology Point-to-point, multiple-access, or switched network Hosts: nodes outside the cloud (usually computer or end users devices and use the network) Switches: nodes inside the cloud and implement the network (store and forward packets) Internetwork (or internet with small “i”): a set of independent interconnected networks (clouds) Internet (with big “I”): is the globally known network 14 Router/gateway: connects two or more networks (plays much the same role as a switch—stores and forwards) Host-to-host connectivity: hosts can talk to hosts Address: the way to find nodes. It is a byte string that identifies a node. Routing: the process of determining systematically how to forward messages toward the destination node based on its address Unicast: send to single destination Broadcast: send to all nodes on the network Multicast: send to subset of nodes Chapter 1 Connectivity 15 Chapter 1 Connectivity (a) (a) (b) (b) A switched network Interconnection of networks 16 Resource: links and nodes How to share a link? Multiplexing Multiplexing multiple logical flows over a single physical link Chapter 1 Cost-Effective Resource Sharing Analogy to a timesharing computer system De-multiplexing Synchronous Time-division Multiplexing (STDM) Equal-sized quanta Round-robin fashion Time slots/data transmitted in predetermined slots 17 FDM: Frequency Division Multiplexing Diff. TV stations with diff. frequencies. Both STDM and FDM waste resources and hard to accommodate changes (fixed time slots and frequencies) Statistical Multiplexing Chapter 1 Cost-Effective Resource Sharing Like STDM: sharing over time but data is transmitted based on demand rather than during a predetermined time slot 18 Chapter 1 Statistical Multiplexing Packets vs. Messages Fair decision: FIFO, Round-Robin, Priorities (Quality-of-Service (QoS) allocate bandwidth for a particular flows) A switch might run out of buffers because it receives data much faster than it can send on the shared link Congestion A switch multiplexing packets from multiple sources onto one shared link Start to drop packets 19 Chapter 1 LAN, MAN, WAN, and SAN Characterize networks according to their size (they usually use diff. technologies): LAN: Local Area Network, typically less than 1km WAN: Wide Area Network, worldwide MAN: Metropolitan Area Network, tens of kilometers SAN: Systems/Storage Area Network, single room that has high-performance components (like leading-edge storage devices) connected together 20 Chapter 1 Support for Common Services Overly simplistic to think about network as simple delivering packets among a collection of computers But rather a means for application processes to communicate 21 Chapter 1 Support for Common Services One option would be for the app designers to build all that complicated functionality into each application. However, since many applications need common services, it is much more logical to build those common services once and let the app designers to use the services. 22 Chapter 1 Support for Common Services Process communicating over an abstract/logical channel 23 The challenge then is recognize what functionality the channel should provide to application programs: Chapter 1 Support for Common Services Reliable delivery?! Same order?! Eavesdropping parties?! In general, a network provides a variety of different types of channels An applications can choose the best that meets its needs 24 Chapter 1 Common Communication Patterns Designing abstract channels involve Understanding representative collection of apps Extract the common needs Client/Server FTP (file transfer protocol), NFS (network file system), digital libraries like ACM Video conferencing Two-way traffic (or one-way with video on demand) No need to guarantee the delivery of ALL messages. Same order is required Might need multicast 25 Two types of common communication channels Request/Reply Channels Message Stream Channels It is dangerous to have too much abstractions Chapter 1 Common Communication Patterns Every application has to choose between the provided channels If you have a hammer then you might see everything looks like a nail, Independent of exactly what functionality a given channel should provide is where this functionality should be implemented. On switches => dump hosts, like the telephone handsets On hosts => keep switches as simple as possible 26 Chapter 1 Reliability Network should hide the errors Bits are lost Bit errors (1 to a 0, and vice versa) Burst errors – several consecutive errors Outside forces like: lightning strikes, microwave ovens, etc. Packets are lost (Congestion) Links and Node failures (crashes and misconfig.) Messages are delayed Messages are delivered out-of-order Third parties eavesdrop 27 Chapter 1 Manageability Last requirement that is usually neglected Making changes as the network grows to carry more traffic or reach more users Troubleshooting when something goes wrong or performance is not as desired Related to scalability Configuring new devices/routers is always problematic Needs more automation Great if it becomes plug-and-play (like home routers) 28 Chapter 1 Requirements Summary A computer network must provide general, cost-effective, fair and robust connectivity among large number of computers. The network must be manageable by number of varying levels of skills 29 Chapter 1 Network Architecture Example of a layered network system 30 Chapter 1 Network Architecture Layered system with alternative abstractions available at a given layer 31 Abstraction Capture important aspects of the system Abstractions naturally leads to layering The general idea The hiding of details behind a well-defined interface Define a model Chapter 1 Abstraction and Layering Start from services offered by the underlying hardware Add a sequence of layers, each providing a higher (i.e., more abstract) level of service. Manageability and Mudularity 32 Chapter 1 Protocoals The abstract objects the make up the layers of a network system are called 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 (indirect communication, except for the hardware) 33 Chapter 1 Interfaces Service and Peer Interfaces 34 Protocol Specification: Chapter 1 Protocols Written description (prose) pseudo-code state transition diagram Packet format RFCs: Request For Comments IETF: Internet Engineering Task Force Standardization body Ex. RFC 2616 for HTTP protocol Interoperable: when two or more protocols that implement the specification accurately 35 Chapter 1 Protocol Graph Example of a protocol graph nodes are the protocols and links the “depends-on” relation 36 Chapter 1 Encapsulation High-level messages are encapsulated inside of low-level messages 37 Header Payload Chapter 1 Packets General Format Trailer Peers talk to each other through Headers and Trailers 38 Chapter 1 OSI Architecture The OSI 7-layer Model OSI – Open Systems Interconnection 39 Physical Layer Handles the transmission of raw bits over a communication link Data Link Layer Chapter 1 Description of Layers Collects a stream of bits into a larger aggregate called a frame Network adaptor along with device driver in OS implement the protocol in this layer Frames are actually delivered to hosts Network Layer Handles routing among nodes within a packet-switched network Provides Host-to-Host connectivity Unit of data exchanged between nodes in this layer is called a packet The lower three layers are implemented on all network nodes 40 Chapter 1 Description of Layers Transport Layer Implements a process-to-process channel Unit of data exchanges in this layer is called a message There is a disagreement on the top three Session, Presentation, and Application Mainly because the are not always present 41 Chapter 1 Description of Layers Session Layer Presentation Layer Provides a name space that is used to tie together the potentially different transport streams that are part of a single application Ex., tie the audio and video together in videoconference Concerned about the format of data exchanged between peers Ex., integer formats, audio/video format, most/least significant Application Layer Include things like the Hypertext Transfer Protocol Basis the world wide web Used by web browsers The transport layer and the higher layers typically run only on endhosts and not on the intermediate switches and routers 42 Chapter 1 Internet Architecture Sometimes called TCP/IP Evolved from an earlier packet-switched network called ARPANET Internet and ARPANET were funded by ARPA (Advanced Research Projects Agency) Both existed before the OSI architecture Both affected the OSI model 43 Internet Protocol Graph Chapter 1 Internet Architecture Alternative view of the Internet architecture. The “Network” layer shown here is sometimes referred to as the “sub-network” or “link” layer. 44 Chapter 1 Internet Architecture Defined by IETF Three main features Does not imply strict layering. The application is free to bypass the defined transport layers and to directly use IP or other underlying networks An hour-glass shape – wide at the top, narrow in the middle and wide at the bottom. IP serves as the focal point for the architecture (host-to-host connectivity is separate from all channel types) In order for a new protocol to be officially included in the architecture, there needs to be both a protocol specification and at least one (and preferably two) representative implementations of the specification 45 Chapter 1 Internet Architecture NET1, NET2, … Could be Ethernet, Wireless, etc. Encapsulate both hardware and data link layers from OSI model IP (Internet Protocol) Supports the interconnection of multiple networking technologies into a single logical internetwork Analogy to the network layer in the OSI The routing protocol 46 Chapter 1 Internet Architecture TCP provides reliable, byte-stream channel (connection oriented protocol) UDP provides unreliable, datagram (message) delivery channel. TCP and UDP are called (besides Transport) end-to-end protocols 47 Chapter 1 Internet Architecture Application Protocols HTTP, FTP, Telnet (remote login), Simple Mail Transfer Protocol (SMTP), and much more Enables the interoperation of popular applications Many different web browsers interoperate with web servers because they all conform/use the HTTP protocol 48 1.8 billion Internet users Much of its functionality is provided by software running in general-purpose computers Chapter 1 The Success of the Internet Small matter of programming Massive increase in computing power 49 Chapter 1 Application Programming Interface Interface exported by the network Since most network protocols are implemented (those in the high protocol stack) in software and nearly all computer systems implement their network protocols as part of the operating system, when we refer to the interface “exported by the network”, we are generally referring to the interface that the OS provides to its networking subsystem The interface is called the network Application Programming Interface (API) 50 Socket Interface was originally provided by the Berkeley distribution of Unix - Now supported in virtually all operating systems Each protocol provides a certain set of services, and the API provides a syntax by which those services can be invoked in this particular OS Chapter 1 Application Programming Interface (Sockets) 51 What is a socket? Chapter 1 Socket The point where a local application process attaches to the network An interface between an application and the network An application creates the socket The interface defines operations for Creating a socket Attaching a socket to the network Sending and receiving messages through the socket Closing the socket 52 Chapter 1 Socket int sockfd = socket(protocol_family, type, protocol); Protocol Family PF_INET denotes the Internet family PF_PACKET denotes direct access to the network interface (i.e., it bypasses the TCP/IP protocol stack) The socket number returned is the socket descriptor for the newly created socket 53 Chapter 1 Creating a Socket int sockfd = socket(protocol_family, type, protocol); Socket Type SOCK_STREAM is used to denote a byte stream (TCP) SOCK_DGRAM is an alternative that denotes a message oriented service, such as that provided by UDP int sockfd = socket (PF_INET, SOCK_STREAM, 0); int sockfd = socket (PF_INET, SOCK_DGRAM, 0); The combination of PF_INET and SOCK_STREAM implies TCP 54 Chapter 1 Client-Serve Model with TCP Server Passive open Prepares to accept connection, does not actually establish a connection Server invokes int bind (int socket, struct sockaddr *address, int addr_len) int listen (int socket, int backlog) int accept (int socket, struct sockaddr *address, int *addr_len) 55 Chapter 1 Client-Serve Model with TCP Bind Binds the newly created socket to the specified address i.e. the network address of the local participant (the server) Address is a data structure which combines IP and port Listen Defines how many connections can be pending on the specified socket 56 Chapter 1 Client-Serve Model with TCP Accept Carries out the passive open Blocking operation Does not return until a remote participant has established a connection When it does, it returns a new socket that corresponds to the new established connection and the address argument contains the remote participant’s address 57 Chapter 1 Client-Serve Model with TCP Client Application performs active open It says who it wants to communicate with Client invokes int connect (int socket, struct sockaddr *address, int addr_len) Connect Does not return until TCP has successfully established a connection at which application is free to begin sending data Address contains remote machine’s address 58 Chapter 1 Client-Serve Model with TCP In practice The client usually specifies only remote participant’s address and let’s the system fill in the local information Whereas a server usually listens for messages on a well-known port A client does not care which port it uses for itself, the OS simply selects an unused one 59 Chapter 1 Client-Serve Model with TCP Once a connection is established, the application process invokes two operation int send (int socket, char *msg, int msg_len, int flags) int recv (int socket, char *buff, int buff_len, int flags) 60 #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> Chapter 1 Example Application: Client #define SERVER_PORT 5432 #define MAX_LINE 256 int main(int argc, char * argv[]) { FILE *fp; struct hostent *hp; struct sockaddr_in sin; char *host; char buf[MAX_LINE]; int s; int len; if (argc==2) { host = argv[1]; } else { fprintf(stderr, "usage: simplex-talk host\n"); exit(1); } 61 /* translate host name into peer’s IP address */ hp = gethostbyname(host); if (!hp) { fprintf(stderr, "simplex-talk: unknown host: %s\n", host); exit(1); } /* build address data structure */ bzero((char *)&sin, sizeof(sin)); sin.sin_family = AF_INET; bcopy(hp->h_addr, (char *)&sin.sin_addr, hp->h_length); sin.sin_port = htons(SERVER_PORT); /* active open */ if ((s = socket(PF_INET, SOCK_STREAM, 0)) < 0) { perror("simplex-talk: socket"); exit(1); } if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) { perror("simplex-talk: connect"); close(s); exit(1); } /* main loop: get and send lines of text */ while (fgets(buf, sizeof(buf), stdin)) { buf[MAX_LINE-1] = ’\0’; len = strlen(buf) + 1; send(s, buf, len, 0); } Chapter 1 Example Application: Client } 62 #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #define SERVER_PORT 5432 #define MAX_PENDING 5 #define MAX_LINE 256 Chapter 1 Example Application: Server int main() { struct sockaddr_in sin; char buf[MAX_LINE]; int len; int s, new_s; /* build address data structure */ bzero((char *)&sin, sizeof(sin)); sin.sin_family = AF_INET; sin.sin_addr.s_addr = INADDR_ANY; sin.sin_port = htons(SERVER_PORT); /* setup passive open */ if ((s = socket(PF_INET, SOCK_STREAM, 0)) < 0) { perror("simplex-talk: socket"); exit(1); } 63 if ((bind(s, (struct sockaddr *)&sin, sizeof(sin))) < 0) { perror("simplex-talk: bind"); exit(1); } listen(s, MAX_PENDING); /* wait for connection, then receive and print text */ while(1) { if ((new_s = accept(s, (struct sockaddr *)&sin, &len)) < 0) { perror("simplex-talk: accept"); exit(1); } while (len = recv(new_s, buf, sizeof(buf), 0)) fputs(buf, stdout); close(new_s); } Chapter 1 Example Application: Server } 64 Old programming adage: “first get it right and then make it fast”. Chapter 1 Performance In networking: necessary to “design for performance” Two fundamental ways to measure the performance Bandwidth Latency 65 Chapter 1 Bandwidth Frequency band (measured in Hertz): we don’t mean that Number of bits per second that can be transmitted over a communication link Throughput vs. bandwidth (from the most confusing terms in computer networks. Bandwidth: the maximum data rate (bits per second) Throughput: number of bits per second that we actually transmit over the link in practice 1 Mbps: 1 x 106 bits/second = 1x220 bits/sec 1 x 10-6 seconds to transmit each bit or imagine that a timeline, now each bit occupies 1 micro second space. On a 2 Mbps link the width is 0.5 micro second. Smaller the width more will be transmission per unit time. 66 Chapter 1 Bandwidth Bits transmitted at a particular bandwidth can be regarded as having some width: (a) bits transmitted at 1Mbps (each bit 1 μs wide); (b) bits transmitted at 2Mbps (each bit 0.5 μs wide). 67 MB, Mbps, KB, Kbps Mbps is always 106. Kbps is always 103 MB you can use 220 or 106 KB you can use 210 or 103 Chapter 1 Units Confusion 5% error Bits and bytes b (small letter) for bits B (capital letter) for bytes (each byte is 8 bits, you can use 10 sometimes, but with 20% errors) 68 Chapter 1 Latency How long it takes a message to travel from one end of a network to the other. Measured in time 69 Chapter 1 Latency Three components Speed-of-light propagation delay Different media at different speeds 3.0 × 108 m/s in a vacuum 2.3 × 108 m/s in copper cable 2.0 × 108 m/s in optical fiber Amount of time to transmit a unit of data Queuing delays (switches store packets) 70 Latency = Propagation + transmit + queue Propagation = distance/speed of light Distance: the length of the wire Transmit = size/bandwidth Chapter 1 Performance Size: the size of the packet One bit transmission => propagation is important Large bytes transmission => bandwidth is important 71 Chapter 1 Performance (ex1) A client sends1-byte message to a server and receives a 1-byte message Suppose RTT = 100ms Case 1: bandwidth 1 Mbps => Transmit = 8 bits / 1Mbps = 8 micro seconds Case 2: bandwidth 100 Mbps RTT = propagation delay X 2 => Transmit = 8 bits / 100Mbps = 0.08 micro seconds Insignificant difference between Case 1 and 2 72 Chapter 1 Performance (ex2) A client wants to download a 25MB image Bandwidth 10Mbps =>Transmit = 25 × 106 × 8 bits / 10 × 106 bits/sec = 20 seconds Case 1: RTT = 100ms Case 2: RTT = 1ms Latency = 20.1 sec Latency = 20.001 sec Propagation delay is insignificant in this case 73 Copyright © 2012, Elsevier Inc. All rights Reserved Chapter 1 FIGURE 1.17 Perceived latency (response time) versus round-trip time for various object sizes and link speeds. 74 Chapter 1 Delay X Bandwidth We think the channel between a pair of processes as a hollow pipe Latency is the length of the pipe and bandwidth is the width of the pipe Delay of 50 ms and bandwidth of 45 Mbps 50 x 10-3 seconds x 45 x 106 bits/second 2.25 x 106 bits ≈ 280 KB data. Network as a pipe 75 Chapter 1 Delay X Bandwidth Relative importance of bandwidth and latency depends on application For large file transfer, bandwidth is critical For small messages (HTTP, NFS, etc.), latency is critical 76 Chapter 1 Delay X Bandwidth The max number of bits that could be in transit through the pipe at any given instant How many bits the sender must transmit before the first bit arrives at the receiver if the sender keeps the pipe full Takes another one-way latency to receive a response from the receiver If the sender does not fill the pipe (i.e., send a whole delay × bandwidth product’s worth of data before it stops to wait for a signal), then the sender will not fully utilize the network 77 Chapter 1 Delay X Bandwidth One-way latency of 50ms and a bandwidth of 45 Mbps is able to hold This number is doubled if we consider the RTT time instead of the one-way 50 × 10-3s × 45 × 106 bits/s = 2.25 × 106 bits Until the send hears the first bit from the receiver to stop sending or something Most of the time, we will be interested in the RTT × Bandwidth 78 Bandwidths are increasing dramatically What is the impact network design of having infinite bandwidth available??!! Chapter 1 High-Speed Networks RTT dominates What does not change as bandwidth increases: the speed of light You can not change the laws of physics 79 Chapter 1 Relationship between bandwidth and latency A 1-MB file would fill the 1-Mbps link 80 times, but only fill the 1-Gbps link 1/12 of one time 80 Chapter 1 High-Speed Networks Delay is 100 x 10-3 sec File is 1MB Bandwidth1 = 1Mbps Bandwidth2 = 1Gbps Delay x Bandwidth1 = 100 x 10-3 sec x 106 bits/sec = 105 bits 1MB / 105bits = 8 x 106 / 105 = 80 => the file is 80 times larger than the channel Delay x Bandwidth2 = 100 x 10-3 sec x 109 bits/sec = 108 bits 1MB / 108 bits = 8 x 106 / 108 = 1 / 12.5 => the channel is 12.5 times larger than the file 81 The effective end-to-end throughput Throughput = TransferSize / Latency Latency= RTT + Size / Bandwidth Chapter 1 Throughput and TransferTime Insert the two-way, RTT to the formula instead of Prop. Delay Ex., a user wants to fetch 1MB file across 1Gbps network with a round-trip time of 100ms. Transmit time = 1MB / 1Gbps = 8ms Latency = RTT + transmit = 108ms Effective throughput = 1MB/108ms = 74.1 Mbps Much less than the available bandwidth Transferring a larger amount of data will help improve the effective throughput large transfer size => throughput approaches the bandwidth 82 Chapter 1 Summary We have identified what we expect from a computer network We have defined a layered architecture for computer network that will serve as a blueprint for our design We have discussed the socket interface which will be used by applications for invoking the services of the network subsystem We have discussed two performance metrics using which we can analyze the performance of computer networks 83