1 / 33

CS360 Special Topics: Computer Networking

CS360 Special Topics: Computer Networking. Chadd Williams Office Hours: chadd@pacificu.edu Mon 11:00 - Noon 202 Strain Tues  3:00 – 4:00 PM Fri  10:00 – Noon and by appointment http://zeus.cs.pacificu.edu/chadd/cs360s07/.

uzuri
Download Presentation

CS360 Special Topics: Computer Networking

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. CS360 Special Topics:Computer Networking Chadd Williams Office Hours: chadd@pacificu.edu Mon 11:00 - Noon 202 Strain Tues  3:00 – 4:00 PM Fri  10:00 – Noon and by appointment http://zeus.cs.pacificu.edu/chadd/cs360s07/

  2. Syllabushttp://zeus.cs.pacificu.edu/chadd/cs360s07/syllabus.htmlSyllabushttp://zeus.cs.pacificu.edu/chadd/cs360s07/syllabus.html • Computer Networks, Andrew S. Tanenbaum (4th edition) • I may assign problems out of this book • I will expect you to read the book Grades: • Homework/Quizzes: 10% • 2 Midterms: 20% each • 1 Final 20% (Comprehensive) • Programming Projects 30% Dates: • Midterm 1, Tues Mar 8 • Midterm 2, Tues Apr 17 • Final, Mon May 14 (3:00 – 5:30 PM) Policies: • Assignments are due at the beginning of class. Late assignments will not be accepted. • The cheating policy is defined in the Catalog but read the syllabus! • Silence all electronic devices • Class starts promptly at 1pm!

  3. Programming Projects • 30% of the final grade • Fairly intense programming problems • Network programming is always tricky – things happen asynchronously! • Start the day the project is assigned • You’ll be using lots of new libraries and tools • I’ll expect you to look at the man pages to learn the details of the socket library • Projects (through Project 4) build on code written for earlier projects • Project 5: Routing project with donated CISCO hardware! • All assignments are individual projects

  4. Programming Projects • You must program on Linux • I will not accept Visual Studio projects • Eclipse • Integrated Development Environment • 3.2.1 • subclient plugin • CDT plugin • may use gcc from the command line • Subversion • source code control • you are required to use this • Machines to use • zeus: Linux: Intel ♦ • ada: Linux: Intel • lab machines: Linux: Intel • circe: OpenBSD: SPARC ♦ • g3ubuntu: Linux: PowerPC

  5. Coding on Linux/Unix • Wednesday, 8 – 10 pm in Strain 222 • Linux programming basics with Doug and Chadd • if you cannot make this, let me know ASAP • one class later in the semester will be cancelled • submit script • allows you to submit your project electronically • I still need a hardcopy! • You can do this exactly once for each assignment! • must be run from zeus zeus$ ~chadd/submit cs360s07filename.tar.gz

  6. Overview • How do we send data from here to there on the Internet? • we will talk about non-Internet networks (Bluetooth) • Internetworking • implement the protocol • join the network • Computer Networks are complex things • we will use a model of the network to guide us through • Open Systems Interconnection Basic Reference Model • TCP/IP reference model • breaks down the functionality of the network into layers • from Mozilla Firefox to radio waves in the air • How to write networking code • network socket libraries

  7. It’s a joke, laugh. • Will I learn to set up my wireless router in my house? • Will I learn how my wireless router assigns my laptop an IP address? NO I don’t know, read the owner’s manual YES this is a well defined standard that all routers use But, it’s funny because it’s true.

  8. Terms • Read Chapter 1 (1.1 – 1.5) • 1.4 is especially important • describes models of the network • 1.6 is interesting and we may return to it later • Network Application: a piece of software that interacts with the network • Network Protocol: “an agreement between the communicating parties on how communication is to proceed” – Tanenbaum, pg 27 • very strict, to the bit, description of how to do things Hello?

  9. Terms • Protocol Stack: all the protocols an application uses, in order of abstraction • ~1 per layer of the model • Packet: (small) chunk of data sent across the network

  10. Network Models (quick preview) Computer Networks, 4th edition, Tanenbaum, page 43.

  11. Applications and Protocols • Network Applications (protocol) • Lower level protocols: • IEEE 802.11[a|b|g] is a wireless networking standard • differences in letters are speed and security • what does a 1 and 0 look like? • TCP (Reliable transport) • IP (Internet protocol) • Bluetooth (wireless keyboard/mice) High level protocols

  12. Protocols • Open/standardized protocols allow anyone to write code that uses the protocol • all web- servers/browsers understand HTTP • anyone can write a web browser! • two independently developed network applications can communicate • Protocols specify a by the bit communication scheme • packet layout • error checking

  13. Proprietary protocols • Proprietary protocols are not released to the public • OSCAR (AOL IM) is not actually an open protocol • however it has been reverse engineered • therefore, other chat clients can implement it • AOL used to change the protocol very often to frustrate the efforts of those trying to build an AIM chat client • Microsoft never fully disclosed the protocol for MSN Messenger • Why would a company do this?

  14. Example HTTP • The client (web browser) can send a set of predefined, specifically formatted requests to the server (web server) • The server (web server) responds with a status code and possibly some data

  15. Example: HTTP • The HTTP protocol defines a way to request data across the network • client (web browser) http://zeus.cs.pacificu.edu/index.html • server (web server) GET /index.html HTTP/1.1 Host: zeus.cs.pacificu.edu HTTP/1.1 200 OKDate: Tue, 16 Jan 2007 19:58:22 GMTServer: Apache-AdvancedExtranetServer/2.0.53 (Mandriva·Linux/PREF Last-Modified: Mon, 05 Sep 2005 23:13:58 GMTETag: "4f8-9a2-4000e774e3980"Accept-Ranges: bytesContent-Length: 2466Connection: closeContent-Type: text/html <html> …. Website that allows you to view the HTTP traffic for your request: http://web-sniffer.net/

  16. Network Models (1.4) Computer Networks, 4th edition, Tanenbaum, page 43.

  17. Why layers? • Each layer performs a different function • called service primitives • upper layers rely on the lower layers working • Layering allows information hiding • remember this from OO programming? • upper layers don’t care how the lower layers operate • Lower layers can change and the upper layers won’t notice (waves hands quickly) • wired Ethernet, 802.11 wireless, carrier pigeon (RFC 1149)

  18. Application • User level code • Standardize data exchanges • High level protocols • HTTP • FTP • DHCP • Where the actual real, end-user important data gets transferred • everything else is really just supporting code

  19. Presentation • Syntax and semantics of data • Translate data representations between machines • big or little endian • which character encoding? • which image encoding? • Often not used (not in the TCP/IP model) • this is usually left to the Application level

  20. Session • Share/combine data from two independent connections between machines • Dialog control • whose turn is it to transmit • Token management • who has the mutex? • Synchronization • check point long transmissions so the can restart • Often not used (not in the TCP/IP model) • Canonical example: Multimedia • make sure the audio and video streams match up

  21. Transport • Key interface: where the application accesses the net • end to end principle: put all the smarts above the network layer • Transmission Control Protocol (the TCP in TCP/IP) • reliable transport • track acknowledgement of data and retransmit as necessary • breaks data into packets • reassemble packets at destination in order • flow control: don’t swamp the receiver • connection based • User Datagram Protocol (UDP) • unreliable, connectionless • fire and forget: maybe it gets there, maybe not

  22. Network • Routing data around the network • congestion control • allow heterogeneous networks to interact (internetworking) • negotiate packet size • negotiate addressing • Internet Protocol (the IP in TCP/IP) • uses packets, stateless/connectionless (dumb), unreliable • best effort delivery • though the IP header is error free • Internet layer in the TCP/IP reference model • QoS: area of recent research! • delay/transit time/jitter • Other examples: IPX, ICMP

  23. Data link • Take data from physical layer and pass it up to the network layer • uses data frames • chunks of data of a 100-1000s of bytes • may provide reliable service • acknowledge data frames and request retransmissions of missing data frames • provides some error checking • don’t pass data up that is full of static from the line • Flow control (rate control) • prevent the sender from overwhelming the receiver • how big is your buffer? • Regulate access to a shared medium (not always necessary) • Ethernet is one shared bus (or tube!) • collisions cause each sender to back off exponentially • medium access control sub-layer

  24. Physical • Transmitting raw bits over the wire • real computer engineering stuff • mechanical, electrical and timing issues • what does the wire look like? • how many strands of copper? • how many volts at how long for a 1? 0? • We will not deal too much with this layer

  25. Circuit vs Packet switched • What’s a packet? • a chunk of data sent across the network • Circuit switched • like the (old) telephone network • build, and maintain, a complete circuit to transmit data on • dedicate resources throughout the network to a connection • “All lines are busy, please call again later” • easy to guarantee QoS • Packet switched • each packet is routed independently from end to end • no overhead • no wasted resources • hard to guarantee QoS • one packet may run into a bottle neck • Canonical example: Snail mail!

  26. Internet Addresses • IPv4 addresses: 64.59.233.197 • each number is 0-255 (why?) • more specific left to right • Connection between machines • IP address and socket number • socket: numbered interfaces to a single machine • allows a machine to be connected to multiple machines • 0 – 65535 (why?) • 0 - 1023 are reserved for well known services • Servers listen on a specific port then create a new socket to continue communication • 80: webserver • 25: smtp • 22: ssh • 127.0.0.1 is always the localhost 64.59.233.197:8012 64.59.233.197:80 64.59.233.200:2030

  27. Socket Libraries (Unix/Linux) #include <sys/types.h> // data types #include <sys/socket.h> // socket interface #include <netinet/in.h> // Internet interface • The socket is the common Unix interface to the network • a socket represents an end point for network communication • Berkeley Software Distribution socket API • 4.2 BSD Unix • most OSes now provide a BSD socket interface for networking • Microsoft Windows almost provides it • defacto standard • a socket is represented by an int

  28. API Usage: Call Sequences • UDP over IP (connectionless): • TCP over IP (connection-based): socket() sendto() close() client socket() bind() recvfrom() close() server socket() connect() send()/recv() close() client socket() bind() listen() accept() recv()/send() close() server

  29. Socket library functions • UDP over IP • domain (protocol family): PF_INET • type: SOCK_DGRAM • protocol: 0 (IP) • see /etc/protocols for a list • address family: AF_INET int socket(int domain, int type, int protocol) int bind(int sockfd, const struct sockaddr *my_addr, socklen_t addrlen) • actually use struct sockaddr_in for IP networking

  30. Socket library functions ssize_t recvfrom(int sockfd, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen) • again, use struct sockaddr_in for IP connections • this struct is filled with address information specifying the source of the data • this can be used to send a message back to the source. • flags tells the function how to behave • OR together zero or more options: • MSG_WAITALL – wait until the full request is satisfied • MSG_PEEK – retrieve data but don’t remove it from the receive queue • subsequent calls to recvfrom return the same data sendto() is the complement of recvfrom • man sendto close(int sockfd) • just like closing a file

  31. Network Byte Order • Intel machines use little-endian encoding • 32-bit int: 0x01000000 is what? • PowerPCs (Macs), SPARC (Sun), use big-endian encoding • 32-bit int: 0x00000001 is what? • On the network, everything is transferred as big-endian • says the protocol • API to help us: • htonl – transform 32 bits from host- to network- byte order • on Intel this goes from little to big endian • on SPARC this has no effect • htons • ntohl/ntohs – transform 16 bits • Bit fields int version:4; int priority:8;

  32. Programming Assignment • DUE Feb 13, 2007, 1 pm • electronic copy • submit script • paper copy • use the color printer for source code only • UDP over IP • client and server • calculation server: perform simple math tasks • The packet format is specified • size of data is specified in bits • this size may be different than the native data type • Test on big- and little-endian machines • I have a reference implementation server running on • 64.59.233.204:9999 (circe.cs.pacificu.edu, big endian) • 64.59.233.197:9999 (zeus.cs.pacificu.edu, little endian)

  33. Programming Assignment • Server: ./server 9891 • Client ./client 127.0.0.1 9891 a 4 5 Result: 9 • Extra Credit • accept either a DNS name or IP address at the command line • ./client zeus.cs.pacificu.edu 9891 a 4 5 • hint: man inet_addr • Be prepared to demo your code in class!

More Related