CSCI-1680 :: Computer Networks - Brown...
Transcript of CSCI-1680 :: Computer Networks - Brown...
![Page 1: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/1.jpg)
CSCI-1680 - Computer Networks
Chen Avin (avin)
Based partly on lecture notes by David Mazières, Phil Levis, John Jannotti, Peterson & Davie, Rodrigo Fonseca
![Page 2: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/2.jpg)
Administrivia
• Sign and hand in Collaboration Policy
• Signup for Snowcast milestone
– Thursday from 8pm to 11pm
– See Piazza for links
• Github
![Page 3: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/3.jpg)
Today
• Switching, Multiplexing
• Layering and Encapsulation
• Intro to IP, TCP, UDP
![Page 4: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/4.jpg)
Building Blocks
• Nodes: Computers (hosts), dedicated
routers, …
• Links: Coax, twisted pair, fiber, radio, …
Host Host
![Page 5: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/5.jpg)
How to connect more nodes?
Multiple wires
Shared medium
![Page 6: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/6.jpg)
From Links to Networks
• To scale to more nodes, use switching
– Nodes can connect to multiple other nodes
– Recursively, one node can connect to multiple
networks
![Page 7: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/7.jpg)
Switching Strategies
• Circuit Switching – virtual link between two nodes – Set up circuit (e.g. dialing, signaling) – may fail: busy
– Transfer data at known rate
– Tear down circuit
• Packet Switching – Forward bounded-size messages.
– Each message can have different senders/receivers
– Focus of this course
• Analogy: circuit switching reserves the highway for a cross-country trip. Packet switching interleaves everyone’s cars.
![Page 8: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/8.jpg)
Multiplexing
• What to do when multiple flows must share a link?
![Page 9: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/9.jpg)
Circuit switching: FDM versus TDM
FDM
frequency
time TDM
frequency
time
4 users
Example:
Slide from: “Computer Networking: A Top Down Approach” - 6th edition
![Page 10: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/10.jpg)
• Synchronous time-division multiplexing – Divide time into equal-sized quanta, round robin
– Illusion of direct link for switched circuit net
– But wastes capacity if not enough flows
– Also doesn’t degrade gracefully when more flows than slots
STDM
![Page 11: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/11.jpg)
FDM
• Frequency-division multiplexing:
allocates a frequency band for each flow
– Same TV channels and radio stations
• Similar drawbacks to STDM
– Wastes bandwidth if someone not sending
– Can run out of spectrum
– Scaling, managing complexity
![Page 12: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/12.jpg)
Packet Switching: Statistical Multiplexing
• Idea: like STDM but with no pre-
determined time slots (or order!)
• Maximizes link utilization
– Link is never idle if there are packets to send
![Page 13: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/13.jpg)
Statistical Multiplexing
• Cons:
– Hard to guarantee fairness
– Unpredictable queuing delays
– Packets may take different paths
• Yet…
– This is the main model used on the Internet
![Page 14: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/14.jpg)
Managing Complexity
• Very large number of computers
• Incredible variety of technologies
– Each with very different constraints
• No single administrative entity
• Evolving demands, protocols, applications
– Each with very different requirements!
• How do we make sense of all this?
![Page 15: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/15.jpg)
Layering: Network Architecture
• Separation of concerns – Break problem into separate parts
– Solve each one independently
– Tie together through common interfaces: abstraction
– Encapsulate data from the layer above inside data from the layer below
– Allow independent evolution
![Page 16: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/16.jpg)
Layers, Services, Protocols
Layer N Protocol: rules for communication within same layer
Layer N-1
Layer N+1
Service: abstraction provided to layer above API: concrete way of using the service
Layer N uses the services provided by N-1 to implement its protocol and provide its own services
![Page 17: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/17.jpg)
Internet: Layers, Services, Protocols
Network
Link
Physical
Transport
Application
Service: move bits to other node across link
Service: move frames to other node across link. May add reliability, medium access control
Service: move packets to any other node in the network IP: Unreliable, best-effort service model
Service: multiplexing applications Reliable byte stream to other node (TCP), Unreliable datagram (UDP)
Service: user-facing application. Application-defined messages
![Page 18: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/18.jpg)
Transport Protocol
Network Protocol
Application Protocol
Link-Layer Protocol
Internet Layering
Link
Physical
Network
Link
Physical
Transport
Application
Network
Link
Physical
Network
Link
Physical
Transport
Application
Host Switch Router host
![Page 19: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/19.jpg)
Internet Architecture
Internet Protocol Graph
Alternative view of the Internet architecture. The “Network” layer shown here is sometimes referred to as the “sub-network” or “link” layer.
![Page 20: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/20.jpg)
Encapsulation source
application
transport
network
link
physical
Ht Hn M
segment Ht
datagram
destination
application
transport
network
link
physical
Ht Hn Hl M
Ht Hn M
Ht M
M
network
link
physical
link
physical
Ht Hn Hl M
Ht Hn M
Ht Hn M
Ht Hn Hl M
router
switch
message M
Ht M
Hn
frame
Slide from: “Computer Networking: A Top Down Approach” - 6th edition
![Page 21: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/21.jpg)
OSI Reference Model
Application Protocol
Transport Protocol
Network Protocol
Link-Layer Protocol
![Page 22: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/22.jpg)
Description of Layers
• Physical Layer
– Handles the transmission of raw bits over a communication link
• Data Link Layer
– 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
– Unit of data exchanged between nodes in this layer is called a
packet
The lower three layers are implemented on all network nodes
![Page 23: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/23.jpg)
Description of Layers
• Transport Layer – Implements a process-to-process channel
– Unit of data exchanges in this layer is called a message
• Session Layer – Provides a name space that is used to tie together the
potentially different transport streams that are part of a single application
• Presentation Layer – Concerned about the format of data exchanged between peers
• Application Layer – Standardize common type of exchanges
The transport layer and the higher layers typically run only on end-hosts and not on the intermediate switches and routers
![Page 24: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/24.jpg)
Protocols
• What do you need to communicate?
– Definition of message formats
– Definition of the semantics of messages
– Definition of valid sequences of messages
• Including valid timings
![Page 25: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/25.jpg)
Addressing
• Each node typically has a unique* name – When that name also tells you how to get to the node, it
is called an address
• Each layer can have its own naming/addressing
• Routing is the process of finding a path to the destination – In packet switched networks, each packet must have a
destination address
– For circuit switched, use address to set up circuit
• Special addresses can exist for broadcast/multicast/anycast
* or thinks it does, in case there is a shortage
![Page 26: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/26.jpg)
Network Layer: Internet Protocol (IP)
• Used by most computer networks today – Runs over a variety of physical networks, can connect
Ethernet, wireless, modem lines, etc.
• Every host has a unique 4-byte IP address (IPv4) – E.g., www.cs.brown.edu 128.148.32.110
– The network knows how to route a packet to any address
• Need more to build something like the Web – Need naming (DNS)
– Interface for browser and server software (next lecture)
– Need demultiplexing within a host: which packets are for web browser, Skype, or the mail program?
![Page 27: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/27.jpg)
Inter-process Communication
• Talking from host to host is great, but we want abstraction of inter-process communication
• Solution: encapsulate another protocol within IP
![Page 28: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/28.jpg)
Transport: UDP and TCP
• UDP and TCP most popular protocols on IP
– Both use 16-bit port number & 32-bit IP address
– Applications bind a port & receive traffic on that port
• UDP – User (unreliable) Datagram Protocol
– Exposes packet-switched nature of Internet
– Sent packets may be dropped, reordered, even
duplicated (but there is corruption protection)
• TCP – Transmission Control Protocol
– Provides illusion of reliable ‘pipe’ or ‘stream’ between
two processes anywhere on the network
– Handles congestion and flow control
![Page 29: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/29.jpg)
Uses of TCP
• Most applications use TCP
– Easier to program (reliability is convenient)
– Automatically avoids congestion (don’t need to
worry about taking down the network
• Servers typically listen on well-know
ports:
– SSH: 22
– SMTP (email): 25
– Finger: 79
– HTTP (web): 80
![Page 30: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/30.jpg)
Using TCP/IP
• How can applications use the network?
• Sockets API.
– Originally from BSD, widely implemented (*BSD,
Linux, Mac OS X, Windows, …)
– Important do know and do once
– Higher-level APIs build on them
• After basic setup, much like files
![Page 31: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/31.jpg)
Sockets: Communication Between
Machines
• Network sockets are file descriptors too
• Datagram sockets: unreliable message delivery – With IP, gives you UDP
– Send atomic messages, which may be reordered or lost
– Special system calls to read/write: send/recv
• Stream sockets: bi-directional pipes – With IP, gives you TCP
– Bytes written on one end read on another
– Reads may not return full amount requested, must re-read
![Page 32: CSCI-1680 :: Computer Networks - Brown Universitycs.brown.edu/courses/csci1680/f13/lectures/02-layers.pdf · Internet: Layers, Services, Protocols Network Link Physical Transport](https://reader034.fdocuments.net/reader034/viewer/2022052101/603ba34e59f18f5c8a6abd6f/html5/thumbnails/32.jpg)
Coming Up
• Next class: Physical Layer
• Thu 13th: Snowcast milestones