1 / 41

Lecture 2

Lecture 2. Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012. CS3516: These slides are generated from those made available by the authors of our text. Lecture 2: outline. 1.5 protocol layers, service models

chavi
Télécharger la présentation

Lecture 2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 2 Computer Networking: A Top Down Approach 6th edition Jim Kurose, Keith RossAddison-WesleyMarch 2012 CS3516: These slides are generated from those made available by the authors of our text. Introduction

  2. Lecture 2: outline 1.5 protocol layers, service models 2.7 socket programming with UDP and TCP. 1.3 network core packet switching, circuit switching, network structure Introduction

  3. Protocol “layers” Networks are complex, with many “pieces”: hosts routers links of various media applications protocols hardware, software Question: is there any hope of organizing structure of network? …. or at least our discussion of networks? Introduction

  4. Organization of air travel a series of steps ticket (complain) baggage (claim) gates (unload) runway landing airplane routing ticket (purchase) baggage (check) gates (load) runway takeoff airplane routing airplane routing Introduction

  5. Layering of airline functionality layers:each layer implements a service via its own internal-layer actions relying on services provided by layer below ticket ticket (purchase) baggage (check) gates (load) runway (takeoff) airplane routing ticket (complain) baggage (claim gates (unload) runway (land) airplane routing baggage gate airplane routing airplane routing takeoff/landing airplane routing departure airport intermediate air-traffic control centers arrival airport Introduction

  6. Why layering? dealing with complex systems: explicit structure allows identification, relationship of complex system’s pieces layered reference model for discussion modularization eases maintenance, updating of system change of implementation of layer’s service transparent to rest of system e.g., change in gate procedure doesn’t affect rest of system layering considered harmful? Introduction

  7. Internet protocol stack application: supporting network applications FTP, SMTP, HTTP transport: process-process data transfer TCP, UDP network: routing of datagrams from source to destination IP, routing protocols link: data transfer between neighboring network elements Ethernet, 802.111 (WiFi), PPP physical: bits “on the wire” application transport network link physical Introduction

  8. ISO/OSI reference model presentation: allow applications to interpret meaning of data, e.g., encryption, compression, machine-specific conventions session: synchronization, checkpointing, recovery of data exchange Internet stack “missing” these layers! these services, if needed, must be implemented in application needed? application presentation session transport network link physical Introduction

  9. Encapsulation network link physical link physical M M M Ht M Hn Hn Hn Hn Ht Ht Ht Ht M M M M Ht Hn Ht Hl Hl Hl Hn Hn Hn Ht Ht Ht M M M source message application transport network link physical segment datagram frame switch destination application transport network link physical router Introduction

  10. Lecture 2: outline 1.5 protocol layers, service models 2.7 socket programming with UDP and TCP. How does this relate to Project 1? 1.3 network core packet switching, circuit switching, network structure Application Layer

  11. Socket programming goal: learn how to build client/server applications that communicate using sockets socket: door between application process and end-end-transport protocol application application socket controlled by app developer process process transport transport controlled by OS network network link Internet link physical physical Application Layer

  12. Socket programming Two socket types for two transport services: • UDP:unreliable datagram • TCP: reliable, byte stream-oriented Application Example: • Client reads a line of characters (data) from its keyboard and sends the data to the server. • The server receives the data and converts characters to uppercase. • The server sends the modified data to the client. • The client receives the modified data and displays the line on its screen. Application Layer

  13. UDP: no “connection” between client & server no handshaking before sending data sender explicitly attaches IP destination address and port # to each packet rcvr extracts sender IP address and port# from received packet UDP: transmitted data may be lost or received out-of-order Application viewpoint: UDP provides unreliable transfer of groups of bytes (“datagrams”) between client and server Socket programming with UDP Application Layer

  14. create socket: clientSocket = socket(AF_INET,SOCK_DGRAM) Create datagram with server IP and port=x; send datagram viaclientSocket read datagram from serverSocket write reply to serverSocket specifying client address, port number read datagram from clientSocket close clientSocket Client/server socket interaction: UDP client server (running on serverIP) create socket, port= x: serverSocket = socket(AF_INET,SOCK_DGRAM) Application 2-14

  15. Example app: UDP client Python UDPClient include Python’s socket library from socket import * serverName = ‘hostname’ serverPort = 12000 clientSocket = socket(socket.AF_INET, socket.SOCK_DGRAM) message = raw_input(’Input lowercase sentence:’) clientSocket.sendto(message,(serverName, serverPort)) modifiedMessage, serverAddress = clientSocket.recvfrom(2048) print modifiedMessage clientSocket.close() create UDP socket for server get user keyboard input Attach server name, port to message; send into socket read reply characters from socket into string print out received string and close socket Application Layer

  16. Example app: UDP server Python UDPServer from socket import * serverPort = 12000 serverSocket = socket(AF_INET, SOCK_DGRAM) serverSocket.bind(('', serverPort)) print “The server is ready to receive” while 1: message, clientAddress = serverSocket.recvfrom(2048) modifiedMessage = message.upper() serverSocket.sendto(modifiedMessage, clientAddress) create UDP socket bind socket to local port number 12000 loop forever Read from UDP socket into message, getting client’s address (client IP and port) send upper case string back to this client Application Layer

  17. client must contact server server process must first be running server must have created socket (door) that welcomes client’s contact client contacts server by: Creating TCP socket, specifying IP address, port number of server process when client creates socket: client TCP establishes connection to server TCP when contacted by client, server TCP creates new socket for server process to communicate with that particular client allows server to talk with multiple clients source port numbers used to distinguish clients (more in Chap 3) application viewpoint: Socket programming with TCP TCP provides reliable, in-order byte-stream transfer (“pipe”) between client and server Application Layer

  18. TCP connection setup create socket, connect to hostid, port=x create socket, port=x, for incoming request: clientSocket = socket() serverSocket = socket() wait for incoming connection request connectionSocket = serverSocket.accept() send request using clientSocket read request from connectionSocket write reply to connectionSocket read reply from clientSocket close connectionSocket close clientSocket Client/server socket interaction: TCP client server (running onhostid) Application Layer

  19. Example app: TCP client Python TCPClient from socket import * serverName = ’servername’ serverPort = 12000 clientSocket = socket(AF_INET, SOCK_STREAM) clientSocket.connect((serverName,serverPort)) sentence = raw_input(‘Input lowercase sentence:’) clientSocket.send(sentence) modifiedSentence = clientSocket.recv(1024) print ‘From Server:’, modifiedSentence clientSocket.close() create TCP socket for server, remote port 12000 No need to attach server name, port Application Layer

  20. Example app: TCP server Python TCPServer from socket import * serverPort = 12000 serverSocket = socket(AF_INET,SOCK_STREAM) serverSocket.bind((‘’,serverPort)) serverSocket.listen(1) print ‘The server is ready to receive’ while 1: connectionSocket, addr = serverSocket.accept() sentence = connectionSocket.recv(1024) capitalizedSentence = sentence.upper() connectionSocket.send(capitalizedSentence) connectionSocket.close() create TCP welcoming socket server begins listening for incoming TCP requests loop forever server waits on accept() for incoming requests, new socket created on return read bytes from socket (but not address as in UDP) close connection to this client (but not welcoming socket) Application Layer

  21. Socket programming Two socket types for two transport services: • UDP:unreliable datagram • Connectionless • Best effort • No checking to see if send was successful • TCP: reliable, byte stream-oriented • Connection established before data transfer can begin • The network can still garble, lose, or put packets out of order. It’s up to TCP to make it right. • Guaranteed successful delivery. Application Layer

  22. Project 1 Use this code for your server. Your starter code for Project 1 • Project1_thread_example.c • Project1_Starter_Client.c • AddressTranslation.c • Gettysburg.html • Mickey.jpg Use this code for your client. Support files. Application Layer

  23. 1.5 protocol layers, service models 2.7 socket programming with UDP and TCP 1.3 network core packet switching, circuit switching, network structure Lecture 2: roadmap Introduction

  24. mesh of interconnected routers packet-switching: hosts break application-layer messages into packets forward packetsfrom one router to the next, across links on path from source to destination each packet transmitted at full link capacity The network core Introduction

  25. Packet-switching: store-and-forward takes L/R seconds to transmit (push out) L-bit packet into link at R bps store and forward:entire packet must arrive at router before it can be transmitted on next link one-hop numerical example: L = 7.5 Mbits R = 1.5 Mbps one-hop transmission delay = 5 sec L bits per packet 1 3 2 source destination R bps R bps • end-end delay = 2L/R (assuming zero propagation delay) more on delay shortly … Introduction

  26. Packet Switching: queueing delay, loss C R = 100 Mb/s A D R = 1.5 Mb/s B E queue of packets waiting for output link queuing and loss: • If arrival rate (in bits) to link exceeds transmission rate of link for a period of time: • packets will queue, wait to be transmitted on link • packets can be dropped (lost) if memory (buffer) fills up Introduction

  27. Two key network-core functions routing:determines source-destination route taken by packets • routing algorithms forwarding:move packets from router’s input to appropriate router output routing algorithm local forwarding table header value output link 0100 0101 0111 1001 3 2 2 1 1 0111 2 3 dest address in arriving packet’s header Network Layer

  28. Alternative core: circuit switching end-end resources allocated to, reserved for “call” between source & dest: In diagram, each link has four circuits. call gets 2nd circuit in top link and 1st circuit in right link. dedicated resources: no sharing circuit-like (guaranteed) performance circuit segment idle if not used by call (no sharing) Commonly used in traditional telephone networks Introduction

  29. Circuit switching: FDM versus TDM Example: 4 users FDM frequency time TDM frequency time Introduction

  30. Packet switching versus circuit switching example: 1 Mb/s link each user: 100 kb/s when “active” active 10% of time circuit-switching: 10 users packet switching: with 35 users, probability > 10 active at same time is less than .0004 * packet switching allows more users to use network! N users ….. 1 Mbps link Q: what happens if > 35 users ? http://media.pearsoncmg.com/aw/aw_kurose_network_2/applets/transmission/delay.html * Check out the online interactive exercises for more examples Introduction

  31. great for bursty data resource sharing simpler, no call setup excessive congestion possible: packet delay and loss protocols needed for reliable data transfer, congestion control Q: How to provide circuit-like behavior? bandwidth guarantees needed for audio/video apps still an unsolved problem (chapter 7) is packet switching a “slam dunk winner?” Packet switching versus circuit switching Q: human analogies of reserved resources (circuit switching) versus on-demand allocation (packet-switching)? Introduction

  32. Internet structure: network of networks • End systems connect to Internet via access ISPs (Internet Service Providers) • Residential, company and university ISPs • Access ISPs in turn must be interconnected. • So that any two hosts can send packets to each other • Resulting network of networks is very complex • Evolution was driven by economics and national policies • Let’s take a stepwise approach to describe current Internet structure

  33. Internet structure: network of networks Question: given millions of access ISPs, how to connect them together? … … … … access net access net access net access net access net access net access net access net access net access net access net access net access net access net access net access net … …

  34. Internet structure: network of networks Option: connect each access ISP to every other access ISP? … … … … connecting each access ISP to each other directly doesn’t scale: O(N2) connections. … … … … access net access net access net access net access net access net access net access net access net access net access net access net access net access net access net access net … … …

  35. Internet structure: network of networks Option: connect each access ISP to a global transit ISP? Customer and provider ISPs have economic agreement. … … … … globalISP access net access net access net access net access net access net access net access net access net access net access net access net access net access net access net access net … …

  36. Internet structure: network of networks But if one global ISP is viable business, there will be competitors …. … … ISP B ISP A ISP C … … access net access net access net access net access net access net access net access net access net access net access net access net access net access net access net access net … …

  37. Internet structure: network of networks But if one global ISP is viable business, there will be competitors …. which must be interconnected Internet exchange point … … ISP B ISP C ISP A IXP IXP … … access net access net access net access net access net access net access net access net access net access net access net access net access net access net access net access net peering link … …

  38. Internet structure: network of networks … and regional networks may arise to connect access nets to ISPS … … ISP B ISP C ISP A IXP IXP … … access net access net access net access net access net access net access net access net access net access net access net access net access net access net access net access net regional net … …

  39. Internet structure: network of networks … and content provider networks (e.g., Google, Microsoft, Akamai ) may run their own network, to bring services, content close to end users … … ISP B ISP B ISP A IXP IXP … … Content provider network access net access net access net access net access net access net access net access net access net access net access net access net access net access net access net access net regional net … …

  40. Internet structure: network of networks at center: small # of well-connected large networks “tier-1” commercial ISPs(e.g., Level 3, Sprint, AT&T, NTT), national & international coverage content provider network (e.g, Google): private network that connects it data centers to Internet, often bypassing tier-1, regional ISPs Tier 1 ISP Tier 1 ISP Google IXP IXP IXP Regional ISP Regional ISP access ISP access ISP access ISP access ISP access ISP access ISP access ISP access ISP Introduction

  41. Tier-1 ISP: e.g., Sprint POP: point-of-presence to/from backbone peering … … … … … to/from customers Introduction

More Related