Computer Networks Introduction Paolo Costa costa@cs.vu.nl http://www.cs.vu.nl/ costa Vrije Universiteit Amsterdam Paolo Costa Introduction 1 / 71 (Version April 3, 2008) Information Instructor Paolo Costa Email: costa@cs.vu.nl Office: P-456 (by appointment) Website: http://www.cs.vu.nl/~costa/cn calendar (check) slides (available few days before the class) additional material (not for credit) Blackboard (Only for announcements) http://bb.vu.nl you are responsible for reading the announcements page Paolo Costa Introduction Course Information 2 / 71 Book Andrew S. Tanenbaum Computer Networks (4 th Edition), 2003 Prentice Hall You are not expected to learn all minor details You can find a detailed specification here http://www.cs.vu.nl/ ~costa/cn/topics.html Paolo Costa Introduction Course Information 3 / 71 Exam Written test available also in Dutch :) no midterm exams Schedule (tentative) last week of June (just after the end of the course) end of August The exam is scheduled in the week following the last class little time to study study the material as we go Previous exams are available on the course website most including solutions Paolo Costa Introduction Course Information 4 / 71
Why Computer Networks? Computer networks are becoming pervasive Virtually all software is networked every developer must know the basis of networking Internet is used daily by milions (if not billions of people) Web Email Chat Skype Movies / MP3s... and it is getting bigger and bigger Question How old is Internet? Paolo Costa Introduction Motivation 5 / 71 Internet Evolution September 1969 Paolo Costa Introduction Motivation 6 / 71 Internet Evolution December 1969 Paolo Costa Introduction Motivation 7 / 71 Internet Evolution 1971 Paolo Costa Introduction Motivation 8 / 71
Internet Evolution 1980 Paolo Costa Introduction Motivation 9 / 71 Internet Evolution 1986 Paolo Costa Introduction Motivation 10 / 71 Internet Evolution 2005 Paolo Costa Introduction Motivation 11 / 71 Internet Evolution 1969-2006 Paolo Costa Introduction Motivation 12 / 71
Beyond Internet Mobile (smart-)phones Wi-fi Home Internet Public Hotspots Radio / TV Broadcast Cable TV Satellite Personal Networks Bluetooth Healthcare / Fitness Home Networks Mediacenter Paolo Costa Introduction Motivation 13 / 71 The Future (?) Wireless Sensor Networks Sensor devices can: measure compute communicate act Applications Embedded computing Environmental monitoring Ambient intelligence Paolo Costa Introduction Motivation 14 / 71 The Future (?) Vehicular Networks All vehicles are likely to be equipped with a navigation system in the near future (virtually) unlimited power (virtually) unlimited storage wireless antenna Multi-hop communication to detect: traffic jams car accidents fuel prices parking slots dots Paolo Costa Introduction Motivation 15 / 71 Example Accessing a Web Server GET / costa/cn/cn_01.pdf GET / costa/ HTTP/1.1 HTTP/1.1 Host: Host: www.cs.vu.nl www.cs.vu.nl...... web browser web server HTTP/1.1 200 OK HTTP/1.1 200 OK...... <html><head>... </head><body>...... Application Protocol Paolo Costa Introduction Motivation 16 / 71
Example Streams or Packets? web browser web server Transport Protocol Paolo Costa Introduction Motivation 17 / 71 Example Interconnections and Paths web browser web server Network Protocol Paolo Costa Introduction Motivation 18 / 71 Example Communication Links Various types and forms of medium: Fiber-optic cable Twisted-pair copper wire Coaxial cable Wireless local-area links (e.g., 802.11, Bluetooth) Satellite channel... Physical& Data Link Protocol Paolo Costa Introduction Motivation 19 / 71 Example Communication Security Communication model: Alice sends a message m to Bob m Alice Bob Eve Passive adversary can read the message Active adversary can modify the message Paolo Costa Introduction Motivation 20 / 71
Program (1) Introduction [3 hours] the course in one lecture: a tour of all the topics of the course through an end-to-end scenario the layered architecture what is a protocol basic network services: connection-oriented and connectionless service; packet switching vs. circuit switching a bit of an historical perspective Physical Layer [3 hours] Transmitting signals Nyquist & Shannon Copper wires Optical fibers Wireless transmission Satellite ADSL GSM Paolo Costa Introduction Program 21 / 71 Program (2) Data Link Layer [6 hours] Error control PPP ALOHA Ethernet Wi-fi (IEEE 802.11) WiMax Bluetooth Network layer [4 hours] forwarding and routing for datagram and virtual-circuit services general router architecture: interfaces, switching fabric, queues IP: header formats (IPv4 and IPv6), addressing, extensions, fragmentation, IP forwarding Routing algorithms and principles: link-state and distance vector routing, hierarchical routing IP Routing: OSPF, RIP, BGP IP multicast Paolo Costa Introduction Program 22 / 71 Program (3) Transport layer [4 hours] multiplexing/demultiplexing UDP: connectionless transport protocols principles of reliable data transfer principles of congestion control TCP: header format, reliability features, congestion-control features. Application layer [2 hours] the application interface: OS primitives a simple client/server program the Web: HTTP; web caching e-mail: transfer protocol (SMTP); access protocols (POP and IMAP); message format (MIME) DNS Paolo Costa Introduction Program 23 / 71 Program (4) Network Security [2 hours] Cryptography Digital Signatures Public Key IPSec Firewall VPN SSL Peer-to-peer protocols [2 hours] Napster Gnutella BitTorrent Freenet Kademlia Skype Paolo Costa Introduction Program 24 / 71
Schedule Calendar Date Room Topic Friday, 4 th April Friday, 11 th April Wednesday, 23 rd April Friday, 25 th April Wednesday, 7 th May Friday, 9 th May Wednesday, 14 th May Friday, 16 th May Wednesday, 4 th June Friday, 6 th June Wednesday, 11 th June Friday, 13 th June Wednesday, 18 th June Friday, 20 th June Introduction Physical Layer Physical Layer Data Link Layer Data Link Layer MAC Sub-Layer Network Layer Network Layer Transport Layer Transport Layer Application Layer Network Security Peer-to-peer Questions & Answers Attention Periodically check the website for up-to-date information Paolo Costa Introduction Program 25 / 71 Overview Hardware Talk just a bit about how you can configure a bunch of computers into a network Local Area Networks (LAN) Metropolitan Area Networks (MAN) Wide Area Networks (WAN) Internetworks Software This is what actually makes computer networks not the hardware! Protocols: describe how two communicating parties exchange information. Services: describe what a network offers to parties that want to communicate. Interfaces: describe how a client can make use of network services, i.e. how the services can be accessed. Reference models Describe how the OSI and Internet networks are organized. Paolo Costa Introduction Overview 26 / 71 Hardware Broadcast network: a single communication channel is shared by all computers sending a packet implies that all others receive it. Point-to-point network: Computers are connected in pairs sending a packet goes strictly from the sender to the receiver, possibly having to visit intermediate machines (routing). Paolo Costa Introduction Hardware 27 / 71 Local Area Networks Bus-based Apart from scale, LANs distinguish themselves from other networks by (generally) using broadcast technology, and having simple topologies: Type (a) - Bus-based All computers are connected to the same wire. When one of them starts sending, the signal is propagated to all others. If two of them start sending at the same time, packets collide and rubbish is the result. Paolo Costa Introduction Hardware 28 / 71
Local Area Networks Token-based Type (b) - Token-based a token (which is just a small packet) continuously circulates along the ring. A sending computer 1 waits until the token passes and removes it 2 sends its packet along the ring, 3 waits until the packet returns 4 reinserts the token. Paolo Costa Introduction Hardware 29 / 71 Metropolitan Area Networks (MAN) A MAN is intended to cover an entire city. A well-known example of a MAN is the cable television network: In essence, the original network was used only for broadcasting radio and TV, but it soon became clear that the infrastructure could be used for two-way data communication as well. Paolo Costa Introduction Hardware 30 / 71 Wide Area Networks (WAN) LANs and MANs (traditionally) didn t have any switching elements: the wire did all the work. This makes them extremely efficient, although harder to scale. Here s where WANs come in. In a WAN, hosts are connected to a subnet, which in turn consists of routers (switching elements) and transmission lines. Routers generally adhere to a store-and-forward principle: incoming packets are first buffered (stored) the router takes a decision on where the packet has to go and forwards the packet across the selected output line. Paolo Costa Introduction Hardware 31 / 71 Wireless Networks In wireless networks, the transmission occurs through unguided media. Distinguish four different categories: System interconnection: Basically for replacing the traditional cables that connect local devices to each other (monitor keyboard mouse..., cordless telephone, stereo components). Wireless LANs: Computers communicate through a (wired) base station that is placed at the ceiling, or directly in a peer-to-peer fashion (e.g., home networks). Wireless MANs: Often in the form of access networks: parts of a city offer a wireless mesh through which routing to a Internet access points take place. Wireless WANs: The digital cellular phone networks fall into this category. New technology is now pushing bandwidth to 50 Mbps over several kilometers. Paolo Costa Introduction Hardware 32 / 71
Home Networks Many devices in the same home will be connected to a single network and communicate with each other: Computers Entertainment (audio equipment, game centers) Telecommunications (mobile phones, fax devices, intercom) Appliances (refrigerator, microwave, central heating, lights) Telemetry (alarms, cameras, thermostat) We re heading towards centralized solutions (MS media center). Note the specific requirements: 100% robust very easy to use self-managing high bandwidth Paolo Costa Introduction Hardware 33 / 71 Internetworks The assumption so far is that a network is homogeneous: there is hardly any variation in hardware and software. In practice, large networks can only be constructed by interconnecting different kinds of networks internet(work) Internet is just an instance of internetwork (note the capital / lower cases) Examples: Connecting a collection of different kinds of LANs within a department (combine wired/wireless). Connecting LANs to each other through a WAN (think of enterprise networks for multinationals). The WAN acts as a subnet. Connecting WANs to each other (the Internet). Paolo Costa Introduction Hardware 34 / 71 Basic Concepts The Internet uses packet switching Packet switch: a link-layer switch or a router Communication link: a connection between packet switches and/or end systems Route: sequence of switches that a packet goes through (a.k.a. path) Protocol: control the sending and receiving of information to and from end systems and packet switches Paolo Costa Introduction Hardware 35 / 71 Packet Switching Paolo Costa Introduction Hardware 36 / 71
Packet Switching The Internet is a packet-switched network Information is transmitted in packets Switches operate on an individual packet A switch (router) receives packets and forwards them along to other switches or to end systems Every forwarding decision is taken on the basis of the information contained in the packet Paolo Costa Introduction Hardware 37 / 71 Circuit Switching Paolo Costa Introduction Hardware 38 / 71 Circuit Switching The telephone network is a typical circuit-switched network Communication requires a connection setup phase in which the network reserves all the necessary resources for that connection (links, buffers, switches, etc.) After a successful setup, the communicating systems are connected by a set of links that are dedicated to their connection for the entire duration of their conversation When the conversation ends, the network tears down the connection, freeing the corresponding resources (links, buffers, etc.) for other connections Paolo Costa Introduction Hardware 39 / 71 Circuit vs. Packet Switching Circuit switching requires an expensive setup phase however, once the connection is established, little or no processing is required Packet switching does not incur any setup cost. however, it always incurs a significant processing and space overhead, on a per-packet basis processing cost for forwarding space overhead because every packet must be self-contained Paolo Costa Introduction Hardware 40 / 71
Circuit vs. Packet Switching (2) Circuit switching admits a straightforward implementation of quality-of-service guarantees network resources are reserved at connection setup time Guaranteeing any quality of service with packet switching is very difficult no concept of a connection and again, processing, space overhead, etc. Paolo Costa Introduction Hardware 41 / 71 Circuit vs. Packet Switching (3) Circuit switching allows only a limited sharing of communication resources once a connection is established, the resources are blocked even though there might be long silence periods i.e., circuit switching is an inefficient way to use the network Packet switching achieves a much better utilization of network resources it is designed specifically to share links Paolo Costa Introduction Hardware 42 / 71 Communication Protocols A protocol is an agreement between the communicating parties on how communication is to proceed. E.g., let s consider a phone call: Alice calls Bob Alice hello Bob hello, this is Alice Alice, what s up? bla, bla... okay, bye bye Paolo Costa Introduction Software 43 / 71 Communication Protocols (2) Phases of the protocol handshake: establishes the identities and/or the context conversation: free-form exchange closing: terminates the conversation This protocol assumes a connection-oriented medium The protocol involves two parties (Alice and Bob)... Paolo Costa Introduction Software 44 / 71
Communication Protocols (3) Let s revisit the phone-call protocol Alice hello Bob hello, this is Alice Alice who? sorry, wrong number Paolo Costa Introduction Software 45 / 71 Communication Protocols (4) Another run of the phone-call protocol Alice hello Bob hello? anybody there? Paolo Costa Introduction Software 46 / 71 Communication Protocols: Principles A protocol is a lot like a program in fact, it is a distributed program, where different processes can send messages to each other It is an executable specification It must be unambiguous It must be complete i.e., it must include actions and/or responses for all possible situations and all possible messages A network protocol must also define all the necessary message formats Paolo Costa Introduction Software 47 / 71 Protocol Layering Alice and Bob Alice calls Bob to decide where to go for dinner Alice hello Bob hello, this is Alice Alice, what s up? let s go out to dinner where for dinner protocol... okay, bye bye Paolo Costa Introduction Software 48 / 71
Protocol Layering Alice and Bob Alice calls Bob to decide where to go for dinner where for dinner protocol phone call protocol call setup voice over IP... Paolo Costa Introduction Software 49 / 71 Protocol Layering Philosophers Fundamental to all software that makes a computer network run, is the notion of protocol hierarchies: structuring the services that a network must offer in terms of layers. Paolo Costa Introduction Software 50 / 71 Protocol Layering The Concepts Two parties at different sites, but at the same level, always agree on how they will exchange information Example: we all agree to speak English. In order for one party to send and receive information, it can only make use of the communication services offered by the layer directly underneath it. Example: The use of interpreters in negotiations between countries. Services offered by a layer are always fully specified in terms of an interface that makes those services accessible. Example: phones have buttons that allow you to dial a number Example: cars have pedals to control the engine. Paolo Costa Introduction Software 51 / 71 Protocol Layering Example (1) In a protocol stack, Layer k puts its entire packet as data into a Layer k 1 packet; the latter may add a header and/or a trailer. It may occur that Layer k data has to be split across several Layer k 1 packets fragmentation Paolo Costa Introduction Software 52 / 71
Protocol Layering Example (2) Paolo Costa Introduction Software 53 / 71 Protocol Layering Design Issues Addressing how to denote the intended recipient Error Control how to detect (and possibly fix) transmission errors Flow Control how to prevent a fast sender from swamping a slow receiver Multiplexing / Demultiplexing how to support multiple communications in parallel Routing how to route packets to the destination Paolo Costa Introduction Software 54 / 71 Services Connections or Not (1/2) (Most) Network layers offer one or both of the following types of services: Connection-oriented This is the telephone model: you first establish a connection, then do a lot communication, and finally release the connection. circuit-switch is a form of connection-oriented protocols Connectionless The postal model: your data is put into some kind of envelope on which the destination address has been written. The envelope + contents is sent to the destination, and that s it. packet-switch is a form of connection-oriented protocols Paolo Costa Introduction Software 55 / 71 Services Connection-oriented protocol Let s consider go back to Alice calls Bob Alice hello Bob hello, this is Alice Alice, what s up? bla, bla... okay, bye bye Paolo Costa Introduction Software 56 / 71
Services Connectionless protocol Another example: air traffic control... United 971, turn left heading 2-7-0 left to 2-7-0, United 971... Alitalia 631, contact Malpensa approach at 119.20...... Alitalia 631, contact Malpensa approach at 119.20 1-1-9 point 2-0, Alitalia 631, ciao... Center, request, Delta 800... United 971, climb and maintain flight level 3-7-0 flight level 3-7-0, United 971... Delta 800, go ahead requesting flight level 3-5-0, Delta 800 Delta 800, unable at the moment Paolo Costa Introduction Software 57 / 71 Services Connections or Not (2/2) Each service can provide some quality: Is data delivered in the order it was sent? With connections, this is generally the case. Is data transmission reliable? Generally offered with connections, but not always with connectionless services. Reliability requires sending acknowledgments performance may degrade. Paolo Costa Introduction Software 58 / 71 Service Primitives (1/2) A service is specified by means of a set of primitives, also called operations, available to clients. Example of primitives for a simple connection-oriented service: Paolo Costa Introduction Software 59 / 71 Service Primitives (2/2) Server LISTEN RECEIVE SEND DISCONNECT Client CONNECT SEND RECEIVE DISCONNECT Paolo Costa Introduction Software 60 / 71
Services vs. Protocols Service: set of primitives that a layer provides to the layer above it. Protocol: set of rules that prescribe the layout and meaning of packets, and often the order in which specific packets should be sent. Note: The same service can be realized by different protocols; each protocol can be implemented differently (using different data structures, programming languages, etc.) Paolo Costa Introduction Software 61 / 71 The OSI Model Note: Knowing the layering by heart is important Paolo Costa Introduction Reference Models 62 / 71 OSI Physical Layer Essence: Describes the transmission of raw bits in terms of mechanical and electrical issues: Example: Connect two computers by means of a wire: Setting -3V on the wire corresponds to a binary 1; +4V is a binary 0 The wire is not to be longer than 15 meters You may change the voltage at most 20,000 times per second Question what s the transfer rate? Paolo Costa Introduction Reference Models 63 / 71 OSI Data Link Layer (1/2) Observation: We need to at least detect bit transmission errors send bits in frames that add redundancy to detect something went wrong Examples: Add a parity bit to every 7 transmitted bits: 1 says there were odd number of 1 s; 0 says there were an even number of 1 s Add a checksum (cyclic redundancy check) that should match the bits before it Also: Provide the mechanisms so that fast senders don t overwhelm slow receivers (flow control) Paolo Costa Introduction Reference Models 64 / 71
OSI Data Link Layer (2/2) Observation: We also need to specify how a number of computers can share a common channel (i.e., wire) medium access control sublayer (MAC): Specifies how one out of several competing senders, is eventually allowed exclusive access to the wire Common approach 1: listen to each other; retreat when you hear someone else, and try again later Common approach 2: wait your turn by passing a token between all stations Well-known protocols: Ethernet, token ring, token bus, FDDI Paolo Costa Introduction Reference Models 65 / 71 OSI Network Layer Essence: Describes how routing (and congestion) is to be done. Mostly needed in subnets. How do we find out which computers/routers are in the network? How do we calculate the best route from A to B? What happens when a computer/router goes down? Should multicasting/broadcasting be supported? What happens if a router becomes overloaded and starts dropping packets (congestion)? Can we detect and avoid hot spots? Paolo Costa Introduction Reference Models 66 / 71 OSI Transport Layer Observation: Generally offers connection-oriented as well as connectionless services, and varying degrees of reliability. This layer provides the actual network interface to applications Often provides network interface through sockets (UNIX, Windows) Allows to set up a connection to another application, and subsequently deliver data reliably, and in the order that it was sent Often also support for secure connections Also support for datagrams: unreliable message passing on a per-message basis Paolo Costa Introduction Reference Models 67 / 71 OSI Session and Presentation Layers Session Tells how applications can set up long-lasting communications, for example, allowing a connection to be re-established when suddenly broken (think of downloading large files). Presentation Describes everything that is needed to exchange data in a platform-independent way. Example: think of byte ordering in different computers, or passing binary data through e-mail Paolo Costa Introduction Reference Models 68 / 71
OSI Application Layer Contains the rest Traditional: Name services (DNS), security, e-mail (SMTP), News (NNTP), Web (HTTP) Modern: All types of middleware protocols to support distributed systems: New transfer protocols for object systems like Java (RMI), CORBA (IIOP), DCOM (propriety) Special protocols to handle replication, fault tolerance, caching, data persistence, etc. High-level protocols: Special application-level protocols for e-commerce, banking, EDI, etc. Peer-to-peer protocols: BitTorrent, EMule, Skype,... Paolo Costa Introduction Reference Models 69 / 71 The TCP/IP Model The bad thing is that TCP/IP did not make a clear distinction between services, interfaces, and protocols. That makes it much harder to re-implement certain layers. TCP/IP protocol suite is successful because 1 it was there when needed (OSI implementations were terrible) 2 freely distributed with the UNIX operating system Paolo Costa Introduction Reference Models 70 / 71 Example: The Internet ISP POP NAP Internet Service Provider Point Of Presence interface between telephone system and ISP s network Network Access Point connection point to different backbones Paolo Costa Introduction Reference Models 71 / 71