DOC PREVIEW
Rutgers University CS 417 - Networking

This preview shows page 1-2 out of 5 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CS 417: Distributed Systems 9/30/2011 © 2011 Paul Krzyzanowski 1 Distributed Systems 2a. Networking – Part 2 Paul Krzyzanowski [email protected] Networks • Packet versus Circuit switching • Baseband versus Broadband – Ethernet CSMA/CD • Layers of protocols – Data Link (2) versus Network (3) versus Transport (4) • Communication protocols – Connection-oriented (virtual circuit) – Connectionless (datagram) IP Networking • IP addressing – Network-Host partitioning – Class-based addressing – Classless Inter-Domain Routing (CIDR) • Transport layer protocols: TCP & UDP – Port numbers • Packet encapsulation – Ethernet – IP – TCP/UDP • Why would you ever use UDP? Routing • Packets take a series of hops to get to their destination – Figure out the path • Generate/receive packet at machine – check destination • If destination = local address, deliver locally – else • Increment hop count (discard if hop # = TTL) • Use destination address to search routing table • Each entry has address and netmask. Match returns interface • Transmit to destination interface • Static routing Routing • Dynamic routing – Class of protocols by which machines can adjust routing tables to benefit from load changes and failures – E.g., RIP (routed), OSPF • Router – Switching element that connects two or more network interfaces – Operates at layer 3 (network) – does not extend a LAN Transport-layer protocols over IP • IP sends packets to machine – No mechanism for identifying sending or receiving application • Transport layer uses port number to identify application • TCP – Transmission Control Protocol • UDP – User Datagram ProtocolCS 417: Distributed Systems 9/30/2011 © 2011 Paul Krzyzanowski 2 TCP – Transmission Control Protocol • Virtual circuit service (connection-oriented) • Send acknowledgement for each received packet • Checksum to validate data • Data may be transmitted simultaneously in both directions UDP – User Datagram Protocol • Datagram service (connectionless) • Data may be lost • Data may arrive out of sequence • Checksum for data but no retransmission – Bad packets dropped Programming Interfaces Sockets • IP lets us send data between machines • TCP & UDP are transport layer protocols – Contain port number to identify transport endpoint (application) • The most popular abstraction for transport layer connectivity: sockets – Developed at UC Berkeley Sockets • Attempt at generalized IPC model • Goals: – communication between processes should not depend on whether they are on the same machine – efficiency – compatibility – support different protocols and naming conventions Socket Abstract object from which messages are sent and received – Looks like a file descriptor – Application can select particular style of communication • Virtual circuit, datagram, message-based, in-order delivery – Unrelated processes should be able to locate communication endpoints • Sockets can have a name • Name should be meaningful in the communications domainCS 417: Distributed Systems 9/30/2011 © 2011 Paul Krzyzanowski 3 The OS Interface to Sockets Step 1 Create a socket int s = socket(domain, type, protocol) AF_INET SOCK_STREAM SOCK_DGRAM useful if some families have more than one protocol to support a given service Conceptually similar to open BUT - open creates a new reference to a possibly existing object - socket creates a new instance of an object Step 2 Name the socket (assign address, port) int error = bind(s, addr, addrlen) socket Address structure st r uc t s ockaddr * length of address structure Step 3a (server) Set socket to be able to accept connections int error = listen(s, backlog) socket queue length for pending connections Step 3b (server) Wait for a connection from client int snew = accept(s, clntaddr, &clntalen) socket pointer to address structure length of address structure new socket for this session s is only used for managing the queue of connection requests Step 3 (client) Connect to server int error = connect(s, svraddr, svraddrlen) socket address structure st r uc t s ockaddr * length of address structureCS 417: Distributed Systems 9/30/2011 © 2011 Paul Krzyzanowski 4 Step 4 Exchange data Connection-oriented read/write recv/send (extra flags) Connectionless sendto/recvfrom sendmsg/recvmsg Step 5 Close connection shutdown(s, how) how: 0: can send but not receive 1: cannot send more data 2: cannot send or receive (=0+1) Programming: sockets Connection-oriented • socket • bind • listen • accept • connect • read/write • shutdown/close Connectionless • socket • bind • sendmsg/recvmsg • close Data Flow Between the Wire & App to wire from wire System call Interface Generic network interface IP driver Abstract Device Interface Network Device Driver TCP driver UDP driver to socket from socket IP driver responsibilities • Get operating parameters from device driver – Maximum packet size (MTU) – Functions to initialize HW headers – Length of HW header • Routing packets – From one physical network to another • Fragmenting packets • Send operations from higher-layers • Receiving data from device driver • Dropping bad/expired data Device driver (e.g., ethernet) responsibilities • Controls network interface card – Comparable to character driver • Processes interrupts from network interface – Receive packets – Send them to IP driver • Get packets from IP driver – Send them to hardware – Ensure packet goes out without collision • Follow the rules of Ethernet’s CSMA/CDCS 417: Distributed Systems 9/30/2011 © 2011 Paul Krzyzanowski 5 Device header (Ethernet II) device header IP header IP data TCP/UDP header dest addr src addr frame type 6 bytes 6 bytes 2 data CRC 4 46-1500 bytes 18 bytes + data data IP header device header data IP header IP data TCP/UDP header total length options and pad svc type (TOS) vers hlen fragment identification flags fragment offset TTL protocol header checksum source IP address destination IP address 20 bytes Headers: TCP & UDP src port dest port seq number ack number hdr len flags checksum urgent ptr options and pad - window src port dest port seg length checksum TCP header UDP header 20 bytes 8 bytes Network device • Network card examines packets on wire – Compares destination addresses • Before packet is


View Full Document

Rutgers University CS 417 - Networking

Download Networking
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Networking and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Networking 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?