1 / 34

School of Computing Science Simon Fraser University CMPT 471: Computer Networking II Introduction

School of Computing Science Simon Fraser University CMPT 471: Computer Networking II Introduction Instructor: Dr. Mohamed Hefeeda. Course Objectives . Understand principles of designing and operating computer networks structure and protocols of the Internet

betts
Télécharger la présentation

School of Computing Science Simon Fraser University CMPT 471: Computer Networking II Introduction

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. School of Computing Science Simon Fraser University CMPT 471: Computer Networking II Introduction Instructor: Dr. Mohamed Hefeeda

  2. Course Objectives • Understand • principles of designing and operating computer networks • structure and protocols of the Internet • services that can/cannot be offered by the Internet • Know how to • implement network protocols and applications • Be informed about • recent/hot topics in networking research and industry • top technical conferences/journals in networking research and technology

  3. Course Info: Textbooks and References • Textbook • Kurose and Rose, Computer Networking:  A top-down Approach, latest edition • References • Posted on the course web page • Course web page http://nsl.cs.sfu.ca/teaching/14/471/ Access it from my web page: http://www.cs.sfu.ca/~mhefeeda

  4. Course Info: Grading (Tentative) • Assignments, Projects, Class Participation: 50% • Several programming projects mostly in C and Java • Assignments include problems sets, researching topics, conducting experiments, presentations, … • Must read Assignment Policy • Midterm Exams and Quizzes: 50% • No final

  5. Course Info: Topics • Review of Networking Basics: • Internet Architecture and TCP/IP Stack • Multimedia Networking • Wireless Networks • Network Management • Selected topics from • Virtual Networks and Overlays • Network Security • Software Defined Networks • Cloud Computing • Data Center Networking

  6. Quick Survey: did you cover … • Socket programming? • Wireshark experiments? • C programming? • Unix? • IP Multicast? • Multimedia Networking? • Wireless Networks? • Network Management? • Network Security?

  7. Basic Networking Concepts

  8. Review of Basic Networking Concepts • Internet structure • Protocol layering and encapsulation • Socket programming • Transport layer • Reliability and congestion control • Performance modeling of TCP • Network Layer • Addressing, Forwarding, Routing • IP Multicast

  9. Internet: “network of networks” Interconnected ISPs protocolscontrol sending, receiving of messages e.g., TCP, IP, HTTP, Skype, 802.11 Internet standards RFC: Request for comments IETF: Internet Engineering Task Force The Internet: Network of Networks mobile network global ISP home network regional ISP institutional network Introduction

  10. roughly hierarchical at center: “tier-1” ISPs (e.g., MCI, Sprint, and AT&T), national/international coverage treat each other as equals IXP Tier-1 providers also interconnect at public Internet Exchange Points (IXPs) Tier-1 providers interconnect (peer) privately Internet structure: network of networks Tier 1 ISP Tier 1 ISP Tier 1 ISP

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

  12. “Tier-2” ISPs: smaller (often regional) ISPs Connect to one or more tier-1 ISPs, possibly other tier-2 ISPs IXP Tier-2 ISPs also peer privately with each other, interconnect at NAP Tier-2 ISP pays tier-1 ISP for connectivity to rest of Internet Tier-2 ISP is customer of tier-1 provider Tier-2 ISP Tier-2 ISP Tier-2 ISP Tier-2 ISP Tier-2 ISP Internet structure: Tier-2 ISPs Tier 1 ISP Tier 1 ISP Tier 1 ISP

  13. “Tier-3” ISPs and local ISPs last hop (“access”) network (closest to end systems) Tier 3 ISP local ISP local ISP local ISP local ISP local ISP local ISP local ISP local ISP IXP Local and tier- 3 ISPs are customers of higher tier ISPs connecting them to rest of Internet Tier-2 ISP Tier-2 ISP Tier-2 ISP Tier-2 ISP Tier-2 ISP Internet structure: Tier-3 ISPs Tier 1 ISP Tier 1 ISP Tier 1 ISP

  14. a packet passes through many networks! Tier 3 ISP local ISP local ISP local ISP local ISP local ISP local ISP local ISP local ISP NAP Tier-2 ISP Tier-2 ISP Tier-2 ISP Tier-2 ISP Tier-2 ISP Internet structure: packet journey Tier 1 ISP Tier 1 ISP Tier 1 ISP

  15. 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 PPP, Ethernet physical: bits “on the wire” application transport network link physical Internet protocol stack

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

  17. Why layering? Dealing with complex systems: • explicit structure allows identifying complex relationships among system’s pieces • modularization eases maintenance, updating of system • change of implementation of layer’s service transparent to rest of system • e.g., change in gate procedure does not affect rest of system • What is the downside of layering?

  18. Internet Services • View the Internet as a communication infrastructure that provides services to apps • Web, email, games, e-commerce, file sharing, … • Two communication services • Connectionless unreliable • Connection-oriented reliable

  19. Connection-oriented Prepare for data transfer ahead of time establish connection  setupstate in the two communicating hosts Usually comes with reliability, flow and congestion control TCP: Transmission Control Protocol Connectionless No connection set up, simply send Faster, less overhead No reliability, flow control, or congestion control UDP: User Datagram Protocol Internet Services How can we access these services?

  20. host or server host or server process process socket socket TCP with buffers, variables TCP with buffers, variables Network (Socket) Programming • Process sends/receives messages to/from its socket • Socket is the interface (API) between application and transport layer • Process is identified by: • IP address, • Transport protocol, and • Port number controlled by app developer Internet controlled by OS

  21. Socket Programming • Socket API • introduced in BSD 4.1 UNIX, 1981 • explicitly created, used, released by apps • client/server paradigm • provides two services • reliable, byte stream-oriented • unreliable datagram

  22. process process TCP with buffers, variables TCP with buffers, variables socket socket Socket Programming using TCP • TCP service: reliable transfer of bytesfrom one process to another • virtual pipe between sender and receiver controlled by application developer controlled by application developer controlled by operating system controlled by operating system internet host or server host or server

  23. create socket, connect to hostid, port=x create socket, port=x, for incoming request: clientSocket = Socket() welcomeSocket = ServerSocket() TCP connection setup wait for incoming connection request connectionSocket = welcomeSocket.accept() send request using clientSocket read request from connectionSocket write reply to connectionSocket Socket Programming using TCP Server (running on hostid) Client read reply from clientSocket close connectionSocket close clientSocket

  24. Server process must be running first, and creates a socket (door) that accepts client’s contact, then wait Client contacts server by creating local TCP socket using IP address, port number of server process When client creates socket client TCP (in OS kernel) 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 and IPs used to distinguish clients Socket Programming using TCP

  25. create socket, port=x, for incoming request: serverSocket = DatagramSocket() create socket, clientSocket = DatagramSocket() Create datagram (hostid,port=x,data) send datagram request using clientSocket read request from serverSocket write reply to serverSocket specifying client host address, port number read reply from clientSocket close clientSocket Socket Programming using UDP Server (running on hostid) Client

  26. UDP Service: unreliable transfer of datagrams between client and server no connection between client and server no handshaking sender explicitly attaches IP address and port of destination to each packet server must extract IP address, port of sender from received packet transmitted data may be received out of order, or lost Socket programming using UDP

  27. Examples in C

  28. TCP Daytime Server • int main (int argc, char **argv) { • int listenfd, connfd; • struct sockaddr_in servaddr; • char buff[MAXLINE]; • time_t ticks; • listenfd = socket(AF_INET, SOCK_STREAM, 0); • bzero(&servaddr, sizeof(servaddr)); • servaddr.sin_family = AF_INET; • servaddr.sin_addr.s_addr = htonl(INADDR_ANY); • servaddr.sin_port = htons(DAYTIME_PORT); /* daytime server */ • bind(listenfd, (struct sockaddr *) &servaddr, sizeof(servaddr)); • listen(listenfd, LISTENQ); • for ( ; ; ) { • connfd = accept(listenfd, (struct sockaddr *) NULL, NULL); • ticks = time(NULL); • snprintf(buff, sizeof(buff), "%.24s\r\n", ctime(&ticks)); • write(connfd, buff, strlen(buff)); • printf("Sending response: %s", buff); • close(connfd); • }}

  29. htonX and ntohX macros: Important • Some machine use “big endian” and others use “little endian” to store numbers • Whenever sending numbers to network use htonX • Whenever receiving numbers from network use ntohX

  30. TCP Daytime Client • int main(int argc, char **argv) { • … • if ( (sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { • printf("socket error\n"); exit(1); } • bzero(&servaddr, sizeof(servaddr)); • servaddr.sin_family = AF_INET; • servaddr.sin_port = htons(DAYTIME_PORT); /* daytime server */ • if (inet_pton(AF_INET, argv[1], &servaddr.sin_addr) <= 0) { • printf("inet_pton error for %s\n", argv[1]); exit(1); } • if (connect(sockfd, (struct sockaddr *) &servaddr, sizeof(servaddr)) < 0) { • printf("connect error\n"); exit(1); } • while ( (n = read(sockfd, recvline, MAXLINE)) > 0) { • recvline[n] = 0; /* null terminate */ • if (fputs(recvline, stdout) == EOF) { • printf("fputs error\n"); exit(1); } • } • }

  31. Daytime server accepts one connection at a time Not good for other servers, e.g., Web servers How would you make it handle multiple connections concurrently? We need some parallelism! But where? Concurrent TCP Servers

  32. TCP Daytime Server • int main (int argc, char **argv) { • int listenfd, connfd; • struct sockaddr_in servaddr; • char buff[MAXLINE]; • time_t ticks; • listenfd = socket(AF_INET, SOCK_STREAM, 0); • bzero(&servaddr, sizeof(servaddr)); • servaddr.sin_family = AF_INET; • servaddr.sin_addr.s_addr = htonl(INADDR_ANY); • servaddr.sin_port = htons(DAYTIME_PORT); /* daytime server */ • bind(listenfd, (struct sockaddr *) &servaddr, sizeof(servaddr)); • listen(listenfd, LISTENQ); • for ( ; ; ) { • connfd = accept(listenfd, (struct sockaddr *) NULL, NULL); • ticks = time(NULL); • snprintf(buff, sizeof(buff), "%.24s\r\n", ctime(&ticks)); • write(connfd, buff, strlen(buff)); • printf("Sending response: %s", buff); • close(connfd); • }}

  33. Concurrent Server • for ( ; ; ) { • connfd = accept(listenfd, …); • if ( (pid = fork()) == 0) { • close(listenfd); /*child closes listening socket */ • doit(connfd); /*process the request */ • close(connfd); /*done with this client */ • exit(0); /*child terminates */ • } • close(connfd); /*parent closes connected socket */ • } • Fork: duplicates the entire process that called it • Fork returns twice! • One to the child process, return value = 0 • Second to parent with non zero (pid of the created child)

  34. Summary • Quick review to Internet structure • Protocol layering • Socket programming using TCP and UDP

More Related