Docsity

Computer Networking : Principles, Protocols and Practice, Study notes of Computer Networks

Partial preview of the text

Download Computer Networking : Principles, Protocols and Practice and more Study notes Computer Networks in PDF only on Docsity!

Computer Networking : Principles,

Protocols and Practice

Release 0.

Olivier Bonaventure

June 23, 2010

Bibliography 237

Index 245

ii

CHAPTER

ONE

PREFACE

As most textbooks, this textbook came from a frustation of its main author. Many authors chose to write a text- book because there are no textbooks in their field or because they are not satistified with the existing textbooks. This frustration has produced several excellent textbooks in the networking community. At a time when networking text- books were mainly theoretical, Douglas Comer chose to wrote a textbook entirely focused on the TCP/IP protocol suite [Comer1988], a difficult choice at that time. He later extended his textbook by describing a complete TCP/IP implementation, adding practical considerations to the theoretical descriptions in [Comer1988]. Richard Stevens ap- proached the Internet like an explorator and explained the operation of protocols by looking at all the packets that were exchanged on the wire [Stevens1994]. Jim Kurose and Keith Ross reinvented the networking textbooks by starting from the applications that the students use and later explained the Internet protocols by removing one layer after the other [KuroseRoss09].

The frustations that motivated this book are different. When I started to teach networking in the late 1990s, students were already Internet users, but they usage was limited. They were still using reference textbooks and spent time in the library. Today’s students are completely different. They are avide and experimented web users who find lots of information on the web. This is a positive attitude since they are probably more curious thant their predecessors. Thanks to the information that is available on the Internet, they can check or obtain additional information about the topics explained by their teachers. This abudant information creates several challenges for a teacher. Until the end of the nineteenth century, a teacher was by defintion more knowledgeable than his students and it was very difficult for the students to verify the lessons given by their teachers. Today, given the amount of information that is available at the fingertips of each student through the Internet, verifying a lesson or getting more information about a given topic is sometimes only a few clicks away. Websites such as http://wikipedia.org provide lots of information on various topics and students often consult them. Unfortunately, the organisation of the information on these websites is not well suited to allow a students to learn from them. Furthermore, there are huge differences in the quality and the depth of the information that is available for different topics.

The second reason is that that the computer networking community is a strong participant in the open-source mouve- ment. Today, there are high-quality and widely used open-source implementations for most of networking protocols. This includes the TCP/IP implementations that are part of linux, freebsd or the uIP stack running on 8bits controllers, but also servers such as bind, unbound, apache or sendmail and implementations of routing protocols such as xorp or quagga. Furthermore, the documents that define almost all of the Internet protocols have been developed within the Internet Engineering Task Force (IETF) using an open process. The IETF publishes its protocols specifications in the publicly available RFC and new proposals are described in Internet drafts.

This open textbook aims at filling the gap between the open-source implementations and the open-source network specifications by providing a detailed but pedagogical description of the key principles that guide the operation of the Internet. The book is released under a creative commons licence. Such an open-source license is motivated by two reasons. The first is that we hope that this will allow many students to use the book to learn computer networks. The second is that I hope that other teachers will reuse, adapt and improve it. Time will tell if it is possible to build a community of contributors to improve and develop the book further. As a starting point, the first release contains all the material for a one-semester first upper undergraduate or a graduate networking course.

CHAPTER

TWO

INTRODUCTION

When the first computers were built during the second world war, they were expensive and isolated. However, after about twenty years, as their prices were decreasing, the first experiments began to connect computers together. In the early 1960s researchers including Paul Baran, Donald Davies or Joseph Licklider published independently the first papers describing the idea of building computer networks [Baran] [Licklider1963]. Given the cost of computers, sharing them over a long distance was an interesting idea. In the US, the ARPANET started in 1969 and continued until the mid 1980s [LCCD09]. In France, Louis Pouzin developed the Cyclades network [Pouzin1975]. More other research networks were built during the 1970s [Moore]. At the same time, the telecommunication and the computer industry became interested in computer networks. The telecommunication industry bet on the X25. The computer industry took a completely different approach by designing Local Area Networks (LAN). Many LAN technologies such as Ethernet or Token Ring were designed at that time. During the 1980s, the need to interconnect more and more computers lead most computer vendors to develop their own suite of networking protocols. Xerox developed XNS, DEC chose DECNet, IBM developed SNA, Microsoft introduced NetBIOS, Apple bet on Appletalk, ... In the research community, ARPANET was decommissioned and replaced by TCP/IP [LCCD09] and the reference implementation was developed inside BSD Unix [McKusick1999]. Universities who were already running Unix could thus adopt TCP/IP easily and vendors of Unix workstations such as Sun or Silicon Graphics included TCP/IP in their variant of Unix. In parallel, the ISO, with support from the governments, worked on developing an open 1 suite of networking protocols. In the end, TCP/IP became the de facto standard that is used not only within the research community. During the 1990s and the early 2000s, the growth of the usage of TCP/IP continued and today proprietary protocols are seldom used. As shown by the figure below that provides the estimation of the number of hosts attached to the Internet, the Internet sustained a huge growth during the last 20+ years.

Figure 2.1: Estimation of the number of hosts on the Internet (^1) Open in ISO terms was in contrast with the proprietary protocol suites whose specification was not always publically available. The US government even mandated the usage of the OSI protocols (see RFC 1169), but this was not sufficient to encourage all users to switch to the OSI protocol suite that was considered by many as too complex compared to other protocol suites.

Recent estimations of the number of hosts attached to the Internet show a continuing growth since 20+ years. However, although the number of hosts attached to the Internet is high, it should be compared to the number of mobile phones that are in use today. More and more of these mobile phones will be connected to the Internet. Furthermore, thanks to the availability of TCP/IP implementations requiring limited resources such as uIP [Dunkels2003], we can expect to see a growth of TCP/IP enabled embedded devices.

Figure 2.2: Estimation of the number of mobile phones

Before looking at the services that are provided by computer networks, it is useful to agree on some terminology that is widely used in the networking literature. First, computer networks are often classified in function of the geographical area that they cover

  • LAN : a local area network typically interconnects hosts that are up to a few or maybe a few tens of kilometers apart.
  • MAN : a metropolitan area network typically interconnects devices that are up to a few hundred kilometers apart
  • WAN : a wide area network interconnect hosts that can be located anywhere on Earth 2

Another classification of computer networks is based on their physical topology. In the following figures, physical links are represented as lines while boxes show computers or other types of networking equipment.

Computer networks are used to allow several hosts to exchange information between themselves. In order to allow any host to send messages to any other host in the network, the easiest solution is to organise them as a full-mesh with a direct and dedicated link between each pair of hosts. Such a physical topology is sometimes used, especially when high performance and high redundancy is required for a small number of hosts. However, it has two major drawbacks :

  • for a network containing n hosts, each host must have n-1 physical interfaces. In practice the number of physical interfaces on a node will limit the size of a full-mesh network that can be built
  • for a network containing n hosts, n×(n 2 −1)links are required. This is possible when there are a few nodes in the same room, but rarely when they are located several kilometers apart

The second possible physical organisation, which is also used inside computers to connect different extension cards, is the bus. In a bus network, all hosts are attached to a shared medium, usually a cable through a single interface. When one host sends an electrical signal on the bus, the signal is received by all hosts attached to the bus. A drawback of bus-based networks is that if the bus is physically cut, then the network is split in two isolated networks. For this reason, bus-based networks are sometimes considered to be difficult to operate and maintain especially when the cable is long and there are many places where it can break. Such as bus-based topology was used in the early Ethernet networks.

(^2) In this book, we focus on networks that are used on Earth. These networks sometimes include satellite links. Besides the network technologies that are used on Earth, researchers develop networking techniques that could be used between nodes located on different planets. Such an InterPlan- etary Internet requires different techniques than the ones discussed in this book. See RFC 4838 and the references therein for information about these techniques.

4 Chapter 2. Introduction

Figure 2.6: A network organised as a Ring

Figure 2.7: A network organised as a Tree

Figure 2.8: A simple internetwork

6 Chapter 2. Introduction

their respective role to enable all hosts to exchange information. We will also discuss how networks are interconnected together and the rules that guide these interconnections. We will also analyse how the bus, ring and mesh topologies are used to build real networks.

The last point of terminology that we need to discuss are the transmission modes. When exchanging information through a network, we often distinguish three transmission modes. In TV and radio transmission, broadcast is often used to indicate a technology that sends a video or radio signal to all receivers in a given geographical area. Broadcast is sometimes used in computer networks, but only in local area networks where the number of recipients is limited.

The first and most widespread transmission mode is called unicast. In the unicast transmission mode, information is sent by one sender to one receiver. Most of today’s Internet applications rely on the unicast transmission mode. The example below shows a network with two types of devices : hosts (drawn as computers) and intermediate nodes (drawn as cubes). Hosts exchange information via the intermediate nodes. In the example below, when host S uses unicast to send information, its sends it via three intermediate nodes. Each of these nodes receives from its upstream node or host and, processes and forwards to its downstream node or host the information. This is called store and forward and we will see later that this concept is key in computer networks.

Figure 2.9: Unicast transmission

A second transmission mode is multicast transmission mode. This mode is used when the same information must be sent to a set of recipients. It was first used in LANs but became later supported in wide area networks. When a sender uses multicast to send information to N receivers, the sender sends a single copy of the information and the network nodes duplicate the information whenever necessary so that it can reach all the recipients that belong to the destination group.

Figure 2.10: Multicast transmission

In computer networks, the notion of service is more formally defined in [X200]. It can be better understood by considering a computer networks, what ever its size or complexity as a black box that provides a service to users as shown in the figure below. These users could be human users or processes running on a computer system. Many users

Figure 2.12: Users and service provider

can be attached to the same service provider. Through this provider, each user must be able to exchange messages with any other user. To be able to deliver these messages, the service provider must be able to unambiguously identify each user. In computer networks, each user is identified by a unique address. We will discuss later how these addresses are built and used. At this point, and when considering unicast transmission, the main characteristics of these addresses is that they are unique. Two different users attached to the network cannot use the same address. Throughout this book, we will define a service as a set of capabilities provided by a system (and its underlying elements) to its user. A user interacts with a service through a service access point. Note that as shown in the figure above, the users interact with one service provider. In practice, the service provider is distributed over several hosts, but these are implementation details that are not important at this stage. These interactions between a user an a service provider are expressed in [X200] by using primitives as show in the figure below. These primitives are an abstract representation of the interactions between a user and a service provider. In practice, these interactions could be implemented as system calls for example. Four types of primitives are defined :

Figure 2.13: The four types of primitives

  • X.request. This type of primitive corresponds to a request issued by a user to a service provider
  • X.indication. This type of primitive is generated by the network provider and delivered to a user (often related to an earlier and remote X.request primitive)
  • X.response. This type of primitive is generated by a user to answer to an earlier X.indication primitive
  • X.confirm. This type of primitive is delivered by the service provide to confirm to a user that a previous X.request primitive has been successfully processed.

Primitives can be combined to model different types of services. The simplest service in computer networks is the connectionless service. This service can be modelled by using two primitives :

  • Data.request(source,destination,SDU). This primitive is issued by a user that specifies as parameters its (source) address, the address of the recipient of the message and the message itself. We will use Service Data Unit (SDU) to name the message that is exchanged transparently between two users of a service.
  • Data.indication(source,destination,SDU). This primitive is delivered by a service provider to a user. It contains as parameters a Service Data Unit as well as the addresses of the sender and the destination users.

When discussing about the service provided in a computer network, it is often useful to be able to describe the interactions between the users and the provider graphically. A frequently used representation is the time-sequence

2.1. Services and protocols 9

diagram. In this chapter and later throughout the book, we will often use diagrams such as the figure below. A ‘time- sequence diagram describes the interactions between two users and a service provider. By convention, the users are represented in the left and right parts of the diagram while the service provider occupies the middle of the diagram. In such a time-sequence diagram, time flows from the top to the bottom of the diagram. Each primitive is represented by a plain horizontal arrow to which the name of the primitive is attached. The dashed lines are used to represent the possible relationship between two (or more) primitives. Such a diagram provides information about the ordering of the different primitives, but the distance between two primitives does not represent a precise amount of time. The figure below provides a representation of the connectionless service as a time-sequence diagram. The user on the left, having address S, issues a Data.request primitive containing SDU M that must be delivered by the service provider to destination D. The dashed line between the two primitives indicates that the Data.indication primitive that is delivered to the user on the right corresponds to the Data.request primitive sent by the user on the left. There are several

Figure 2.14: A simple connectionless service

possible implementations of the connectionless service that we will discuss later in this book. Before studying these realisations, it is useful to discuss the possible characteristics of the connectionless service. A reliable connectionless service is a service where the service provider guarantees that all SDUs submitted in Data.requests by a user will be eventually delivered to their destination. Such a service would be very useful for users, but guaranteeing perfect delivery is difficult in practice. For this reason, computer networks usually support an unreliable connectionless service.

An unreliable connectionless service may suffer from various types of problems compared to a reliable connectionless service. First, an unreliable connectionless service does not guarantee the delivery of all SDUs. This can be expressed graphically by using the time-sequence diagram below.

Figure 2.15: An unreliable connectionless service may loose SDUs

In practice, an unreliable connectionless service will usually deliver a large fraction of the SDUs. However, since the delivery of SDUs is not guaranteed, the user must be able to recover from the loss of any SDU.

A second imperfection that may affect an unreliable connectionless service is that it may duplicate SDUs. Some unreliable connectionless service providers may deliver twice or even more a SDU sent by a user. This is illustrated by the time-sequence diagram below.

Finally, some unreliable connectionless service providers may deliver to a destination a different SDU than the one that was supplied in the Data.request. This is illustrated in the figure below.

10 Chapter 2. Introduction

Figure 2.19: A connectionless service that does not preserve the ordering of SDUs sent by a given user

Figure 2.20: A confirmed connectionless service

of the connection-oriented service is divided in three phases. The first phase is the establishment of a connection. A connection is a temporary association between two users through a service provider. Several connections may exist at the same time between any pair of users. Once established, the connection is used to transfer SDUs. Connections usually provide one bidirectional stream that supports the exchange of SDUs between the two users that are associated through the connection. This stream is used to transfer data during the second phase of the connection that is also called the data transfer phase. The third phase is the termination of the connection. Once the users have finished to exchange SDUs, they request the service provider to terminate the connection. As we will see later, there are also some cases where the service provider may need to terminate itself a connection.

The establishment of a connection can be modelled by using four primitives : Connect.request, Connect.indication, Connect.response and Connect.confirm. The Connect.request primitive is used to request the establishment of a con- nection. The main parameter of this primitive is the address of the destination user. The service provider delivers a Connect.indication primitive to inform the destination user of the connection attempt. If it accepts to establish a connection, it responds with a Connect.response primitive. At this point, the connection is considered to be open and the destination user can start to send SDUs over the connection. The service provider processes the Connect.response and will deliver a Connect.confirm to the user who initiated the connection. The delivery of this primitive terminates the connection establishment phase. At this point, the connection is considered to be open and both users can send SDUs. A successful connection establishment is illustrated below.

Figure 2.21: Connection establishment

12 Chapter 2. Introduction

The example above shows a successful connection establishment. However, in practice not all connections are suc- cessfully established. A first reason is that the destination user may not agree, for policy or performance reasons, to establish a connection with the initiating user at this time. In this case, the destination user responds to the Con- nect.indication primitive by a Disconnect.request primitive that contains a parameter to indicate why the connection has been refused. The service provider will then deliver a Disconnect.indication primitive to inform the initiating user. A second reason is when the service provider is unable to reach the destination user. This might happen because the destination user is not currently attached to the network or due to congestion. In these cases, the service provider responds to the Connect.request with a Disconnect.indication primitive whose reason parameter contains additional information about the failure of the connection. Once the connection has been established, the service provider sup-

Figure 2.22: Two types of rejection for a connection establishment attempt

plies two data streams to the communicating users. The first data stream can be used by the initiating user to send SDUs. The second data stream allows the responding user to send SDUs to the initiating user. The data streams can be organised in different ways. A first organisation is the message-mode transfer. With the message-mode transfer, the service provider guarantees that one and only one Data.indication will be delivered to the endpoint of the data stream for each Data.request primitive issued by the other endpoint. The message-mode transfer is illustrated in the figure below. The main advantage of the message-transfer mode is that the recipient receives exactly the SDUs that were sent by the other user. If each SDU contains a command, the receiving user can process each command as soon as it receives a SDU. Unfortunately, the message-mode transfer is not widely used on the Internet. On the Internet, the

Figure 2.23: Message-mode transfer in a connection oriented service

most popular connection-oriented service transfers SDUs in stream-mode. With the stream-mode, the service provider supplies a byte stream that links the two communicating user. The sending user sends bytes by using Data.request primitives that contain sequences of bytes as SDUs. The service provider delivers SDUs containing consecutive bytes to the receiving user by using Data.indication primitives. The service provider ensures that all the bytes sent at one end of the stream are delivered correctly in the same order at the other endpoint. However, the service provider does not attempt to preserve the boundaries of the SDUs. There is no relation enforced by the service provider between the number of Data.request and the number of Data.indication primitives. The stream-mode is illustrated in the figure below. In practice, a consequence of the utilisation of the stream-mode is that if the users want to exchange structured SDUs, they will need to provide the mechanisms that allow the receiving user to delineate these SDUs in the byte

2.1. Services and protocols 13

the opposite stream. This graceful connection release is usually performed as shown in the figure below. One user issues a Disconnect.request primitive to its provider once it has issued all its Data.request primitives. The service provider will wait until all Data.indication primitives have been delivered to the receiving user before issuing the Disconnnect.indication primitive. This primitive informs the receiving user that it will not receive anymore SDUs over this connection, but it is still able to issue Data.request primitives on the stream in the opposite direction. Once the user has issued all its Data.request primitives, it issues a Disconnnect.request primitive to request the termination of the remaining stream. The service provider will process the request and deliver the corresponding Disconnect.indication to the other user once it has delivered all the pending Data.indication primitives. At this point, all data has been delivered and the two streams have been released successfully and the connection is completely closed.

Figure 2.27: Graceful connection release

Reliability of the connection-oriented service An important point to note about the connection-oriented service is its reliability. A connection-oriented service can only guarantee the correct delivery of all SDUs provided that the connection has been released gracefully. This implies that while the connection is active, there is no guarantee for the actual delivery of the SDUs ex- changed as the connection may need to be released abruptly at any time.

2.2 The reference models

Given the growing complexity of computer networks, network researchers proposed during the 1970s reference mod- els that allow to describe network protocols and services. The Open Systems Interconnection (OSI) model [Zimmer- mann80] was probably the most influential one. It served as the basis for the standardisation work performed within the ISO to develop global computer network standards. The reference model that we use in this book can be considered as a simplified version of the OSI reference model 3.

2.2.1 The five layers reference model

Our reference model is divided in five layers as shown in the figure below. Starting from the bottom, the first layer is the Physical layer. Two communicating devices are linked through a physical medium. The physical medium is used to transfer an electrical or optical signal between two directly connected devices. Several types of physical mediums are used in practice :

  • electrical cable. Information can be transmitted over different types of electrical cables. The most common ones are the twisted pairs that are used in the telephone network, but also in enterprise networks and coaxial cables. Coaxial cables are still used in cable TV networks, but not anymore in enterprise networks. Some networking technologies operate over the classical electrical cable. (^3) An interesting historical discussion of the OSI-TCP/IP debate may be found in [Russel06]

2.2. The reference models 15

Figure 2.28: The five layers of the reference model

  • optical fiber. Optical fibers are frequently used in public and enterprise networks when the distance between the communication devices is larger than one kilometer. There are two main types of optical fibers : multimode and monomode. Multimode is much cheaper than monomode fiber because a LED can be used to send signal over a multimode fiber while a monomode fiber must be driven by a laser. Due to the different modes of propagation of light, monomode fibers are limited to distance of a few kilometers while multimode fibers can be used over distances larger than several tens of kilometers. In both cases, repeaters can be used to regenerate the optical signal and one endpoint of a fiber to send it over another fiber.
  • wireless. In this case, a radio signal is used to encode the information exchanged between the communicating devices. Many types of modulation techniques are used to send information over a wireless channel and there is lot of innovation in this field with new techniques appearing every year. While most wireless networks rely on radio signals, some use a laser that sends light pulses to a remote detector. These optical techniques allow to create point-to-point links while radio-based techniques, depending on the directionnality of the antennas, can be used to build Local Area Networks containing devices spread over a small geographical area.

An important point to note about the Physical layer is the service that it provides. This service is usually an unreliable connection-oriented service that allows the users of the Physical layer to exchange bits. The unit of information transfer in the Physical layer is the bit. The Physical layer service is unreliable because :

  • the Physical layer may change, e.g. due to electromagnetic interferences, the value of a bit being transmitted
  • the Physical layer may deliver more bits to the receiver than the bits sent by the sender
  • the Physical layer may deliver fewer bits to the receiver than the bits sent by the sender

The last two points may seem strange at first glance. When two devices are attached through a cable, how is it possible for bits to be created or lost on such a cable?

This is mainly due to the fact that the communicating devices use their own clock to transmit bits at a given bandwidth. Consider a sender having a clock that ticks one million times per second and sends one bit every tick. Every microsec- ond, the sender sends an electrical or optical signal that encodes one bit. The sender’s bandwidth is thus 1 Mbps. If the receiver clock ticks exactly 4 every microsecond, it will also deliver 1 Mbps to its user. However, if the receiver’s clock is slightly faster (resp. slower), than it will deliver slightly more (resp. less) than one million bits every second. This explains why the physical layer may loose or create bits.

(^4) Having perfectly synchronised clocks running at a high frequency is very difficult in practice. However, some physical layers introduce a feedback loop that allows the receiver’s clock to synchronise itself automatically to the sender’s clock. However, not all physical layers include this kind of synchronisation.

16 Chapter 2. Introduction