e-PG Pathshala Subject : Computer Science Paper: Computer Networks Module: An overview Module No: CS/CN/1 Quadrant 1 – e-text 1.1 Networks – An overview Ask any common person on the streets - a non-CS or non-IT person perhaps - of the terms that come to their mind when you say "networks". It is highly likely that you will hear terms like Internet, mobile, cell, wifi, web, google, facebook, on-line shopping etc. Now ask yourself what terms come to your mind when you hear the term "networks ", you will definitely add to the set of words already mentioned. You would probably add LAN, MAN, routers, switches, Ethernet, cables, protocol, IP, IP address, sockets, ports, world-wide-web (www), HTTP, etc. You may also recollect terms such as layered model, layers, socket programming, TCP/IP, and so on. Your mind is likely to not only look at latest applications and use of the network, but also in terms of the technology behind it, how it is connected (Fig. 1.1) and how it works. Figure 1.1 A picture of a network Let us try to organize these thoughts so that we can get an overview of the networking that we are already familiar with. Let us begin with what me mean by a network. The following are some of the statements or "definitions" that are likely to arise in our minds. It is an interconnection of computers or devices across the globe (Fig. 1.2). Figure 1.2 Networks - view 1 It allows easy / efficient communication among individuals. Figure 1.3 Networks - view 2 It facilitates access to shared resources. Figure 1.4 Networks - view 3 It allows remote access to machines/servers. It enables sending and receiving of data. All these statements are true from different perspectives. If you try to look at it physically, you may say it is all about connecting systems using devices such as cables, connectors, switches, routers, access points, tower etc. Here, we will try to understand networks from broadly three angles - the physical structure, the logical structure and then the application viewpoint. Let us start with a very common view of a network as shown in the Fig. 1.5. Figure 1.5 Network edge and core We can view the network has having a core part and edges. The host machines running applications are at the edge of the network - the client, the server farm and the corporate LAN. The core consists of routers, switches, telephone system, and other communication equipment that connect the various edges. As we can see, the edge itself could be a network, hence the core can be considered as an interconnection of various networks. The edge also includes access mechanisms for different devices to be able to connect to the core. 1.1.1 Network edge Typically, an application running at an edge talks to a corresponding application running at another edge (Fig. 1.6). The core is only responsible for making this possible. Thus at the edge we are concerned about different models employed for the host applications to communicate with each other. Fig. 1.6 Network Edge There are two popular models - the client-server model, and the peer-to-peer (P2P) model. The client-server model works on a request-response paradigm. The client side requests for a service from the server, and the server responds with the service. Common examples of applications that follow this model are world-wide-web access and e-mail. The browser through which we access different web-servers are the client applications for www access. For e-mail similarly, the e-mail program in the office package (ms-office or open-office) is the e-mail client that talks to the servers such as gmail, yahoo-mail etc. In this model, the functions performed by the client and server are different. In the peer-to-peer model, the host-interaction is symmetric. The two applications talking to each other are peers - no hierarchy between them. Either of them could request or respond to requests. A teleconferencing system, in which any host can speak or listen or do identical functions is a good example of this model. 1.1.2 Network core The network core is fundamentally a mesh of interconnected routers and switches (Fig.1.7). There are edge routers that connect the edges to the core, and core-routers that are at the heart of the core. Their primary responsibility is to transfer the data from the sender (or source) through the appropriate routers to the receiver (or destination). Figure 1.7 Network core The fundamental question that we have here is - " How is data transferred through this core ?". There are two predominant techniques at work here - circuit switching and packet switching. In circuit-switching, a physical circuit is established from one end to the other by properly configuring or setting up the various switches in between, and then the data is transferred along this circuit without any intermediate processing (Fig.1.8(a)). The delay is minimal - just the propagation delay for the signal to go from one end to the other. Also, data is not subject to loss or change in order. However, the resources along the path are reserved and dedicated for this "call" or transfer, and cannot be used by others even if no transfer is actually taking place. The number of calls that can be supported is limited by the available bandwidth. The good old landline telephone network is an example of this kind of switching. Figure 1.8(a) Circuit switching (b) Packet Switching In packet-switching, no physical circuit is established before data transfer. The data to be sent is divided into packets, and each packet has the full address details - who is the source and who is the destination (Fig.1.8(b). The packet is sent to the first router that the source is connected to, and the router looks at the address, and determines the path along which the packet has to be sent, by consulting its routing table and forwards it along that path to the next router. That router then does the same, and sends it to the next router. This process continues until the packet reaches the destination. Of course, the routers would have already talked to each other to figure out the correct path to be taken to reach any destination. There would be delays, because some processing is required at each router to forward the packet. Packets may also be lost or re-ordered in this process, as the routers would be receiving and processing packets from different sources to different destinations simultaneously. The data networks (the internet for instance) prefer this approach as this allows better sharing and utilization of the network resources. A real-life analogy to this packet-switching scheme is the postal (surface mail) delivery system. We post letters with the full address of the destination in a post box. The letter gets picked up from the post box along with other letters for various other destinations and is sorted and sent along different paths at various post offices in between the sender and the recipient. No connection is established before posting letter ! Letters may be delayed ! Letters may be sent in a different order! Letters may be lost ! But plenty of letters can be sent ! The work done at the post offices is analogous to that of routers. 1.1.3 Access network We talked about the edge and the core, and we said that the hosts would be connected to the edge router. Now, let us look at how the end systems connect to the edge routers. The end systems may be part of a residential network, or an institutional network (school, college, company). The connection may be wired or wireless. There again in wireless, the host may be mobile. Let us briefly look at the technologies employed in these cases. Let us start with the physical media or link employed for the connections. The physical link is where the signals corresponding to the data propagate to reach the destination. The physical media is normally classified into guided and unguided media. In guided media the signals propagate in solid media and their path is guided by that media - such as a copper wire or optical fibre (Fig.1.9). In unguided media, such as radio, signals propagate freely. Figure 1.9 (a) Twisted Pair (b) Coaxial (c) Optical fibre When copper wire is employed, data is converted to electrical signals and transmitted. There are two common types of copper cables used - twisted pair and coaxial cable. In a coaxial cable there is a carrier wire within a shield. There may be only one channel (transmission) on the cable - as in the case of base-band transmission. Or there could be multiple channels carried on the cable - as in the case of broad-band transmission. Optical fibres carry light signals and can support much higher data rates than the copper cables. We'll leave it as an exercise to you to find out the current data rates supported on these cables. In the case of radio transmission, the signal is carried in the electromagnetic spectrum. There is no physical “wire”. The transmission is of the nature of a broadcast in all directions, although it can also be limited to certain sectors or directions. The main challenges that have to be dealt with in the case of wireless transmission are the different propagation environment effects - namely, reflection - the signals could be reflected, obstruction by objects - some physical objects in the path could obstruct the signal propagation, interference - when two simultaneous transmissions take place, etc. Coming to the access mechanisms, residential access may happen as a point-to-point access using many technologies. Starting with a dialup via modem (which can support up to 56Kbps direct access to router), ISDN: Integrated Services Digital Network (which provides 128Kbps all-digital connect to router), and ADSL: Asymmetric Digital Subscriber Line are common technologies employed. In ADSL, we have a difference in the data rates of the uplink and the downlink - uplink of 1-5 Mbps home-to-router and downlink of 8-52 Mbps router-to-home. We also have cable modems used for residential access - coax or hybrid of fibre and coax (HFC) are employed. A network of cable and fiber attaches homes to the router of the Internet Service Provider (ISP), providing shared access to router among homes. These are also asymmetric in terms of the data rates supported : up to 10Mbps downstream and 1 Mbps upstream. Large institutions, on the other hand, employ local area networks (LANs) to connect the internal systems, and connect this LAN to the edge router. This may happen via leased lines or dedicated connection. Ethernet is the most common LAN technology employed in the wired world, and provides data rates from 10/100 Mbps to 1/10Gbps. In the case of wireless access, a shared wireless access point (AP) connects end systems to the router (Fig.1.10). It could be a wireless LAN providing the connectivity, or a cellular network with data service providing the connectivity. The latter is becoming more common in the case of mobile users. Figure 1.10 Wireless Network We have been talking about connecting hosts to edge routers. How do you think the edge routers are connected to the core routers ? How are the core routers connected among themselves ? Can you guess that ? You are right if you say that there are cables again. The main difference is that they are highcapacity (data-rate) cables - mainly optical fibre ! Find out the data-rates supported for such inter-router communication. 1.2. Logical communication With this overview of the physical structure, let us now venture into the logical structure of networks. When we bring in a logical structure what we are actually trying to do is to understand he functions at different levels of abstraction. For instance, without worrying about the physical connectivity employed, we could look at how to provide reliable transmission across a link. Or how do we send data across networks ? Or we could be more concerned about what exactly is happening at the end systems. Thus, we could get link-level or network-level or end-to-end views of the network. In the network world, this logical structure is achieved with the help of protocols and layers. Various layers to handle different levels of abstraction, and various protocols to provide different services. Let us start with understanding these two terms. 1.2.1 What’s a protocol ? In plain English, a protocol is the official procedure or a set of rules that are used in a governing body - typically, government, military etc. It is used to ensure that there is no mis-communication or confusion in carrying our matters of importance. You can see that, we have a similar requirement in the case of networks as well. When devices communicate with each other, there should be an agreement in terms of the messages that they exchange. Only specific messages must be sent. And specific actions must be taken when messages are received, or other events take place. We need rules and procedures for that. All these are defined in protocols. We will see that networks is full of protocols. In networks, protocols define the following : Format - of the message sent Order of messages sent and received among network entities, and Actions taken on transmission and receipt of messages. 1.2.2 Layering In the Internet world, there are a number of protocols used for varied purposes. These are often organized in terms of layers and referred to as a protocol stack. The functions in a network are divided into 5 or 7 layers depending on the model chosen. The 5 layer model which is used in the Internet today (aka TCP/IP stack - again named after two protocols in the stack !) has the following five layers : Application layer - for supporting networked applications for the user; Transport layer - to provide host-host data transfer; Network layer - for routing and forwarding of datagrams from source to destination; Link layer - for data transfer between neighbouring network elements - across a link ; Physical layer - for signalling bits “on the wire”, The following are a common set of protocols used in this Internet protocol stack at the different layers : Application protocols - FTP, SMTP, HTTP Transport protocols - TCP, UDP Network protocols - IP, OSPF, RIP Link level protocols - PPP, Ethernet Physical level protocols - SONET, Ethernet physical layer, USB physical layer etc. 1.2.2.1 Why layering ? Layering has many advantages. It is basically a modular approach. Thus it has all the advantages that a modular approach has. It sub-divides the problem and makes maintenance easier. It provides a structure to the organization of the network functions. Each layer relies on services from the layer below, and exports services to the layer above. The interface between the layers defines the interaction. Thus you could work at one layer without any knowledge of the implementation details of adjacent layers. Therefore, layers can change without disturbing other layers. In any device, only those layers which are required for its function need to be present. 1.2.2.2 Layering - how does it work ? Let us look at how these layers are distributed across the different networking elements. Each node - end system or router or switch - implements the layer functions required at that node. Look at the Fig. 1.11. The end systems have all five layers, and the router has only three. Figure 1.11 Logical communication Why does the router have only three layers ? Because those three layers are sufficient for the routers function. The router need not worry about end-to-end connection - in the sense of application to application connection. Thus, we can note that routers only have the lower three layers - up to the network layer. The physical layers at the two ends of a link are physically connected by the cables. All other layers are only logically connected. The corresponding layers are peers and they exchange messages and perform actions. In the figure below, the transport layer is connected only to the transport layer at the other end system - clear example of logical connection ! Now let us look at how the physical communication takes place in this layered approach. The Fig. 1.12 illustrates that very clearly. Figure 1.12 Physical communication The data from the application layer flows through the various layers and reaches the physical layer at that node; it then travels along the physical link until it reaches the physical layer at the end of the link, then travels up to the network layer at the intermediate router(s); then travels down to the physical layer corresponding to another link to which the router is connected (which is on the path to the destination); it then goes through the physical link in a similar manner through various routers until it reaches the destination node. There again it travels up the layers to reach the application layer. 1.2.2.3 Layering – encapsulation & decapsulation During this flow of data, some processing happens at each layer. When a layer gets data from above, it adds some (its own) header information, to create a new data unit, and passes it to the layer below. This is referred to as encapsulation. Each layer adds its own header (Ha, Ht, Hn, Hl, Hp say for short by the application layer to the physical layer). Hence, when the data comes out of the physical layer of the node, it would have 5 headers added to it - one by each of the five layers(Fig. 1.13). This header is meant to have the information or message that the particular layer wants to pass on to its peer so that this data can be transmitted correctly. Figure 1.13 Encapsulation & Decapsulation Hence, when the fully encapsulated packet (with 5 layers of headers) reaches the physical layer of the first router, the physical layer will inspect the header put in by its peer (which is the outermost header), and process that information. Then it will remove that header and give the rest of the packet (with 4 headers) to the link layer above. The link layer now inspects the outermost header which will be the link layer header put in by its peer, and perform the necessary functions. It will then remove this header and give the packet with three headers to the network layer. The network layer, will inspect the network header, and perform the necessary function, and send this packet to the link layer through which it has to be now forwarded. Figure 1.14 Data flow through a router This removal of headers is called as decapsulation. Thus we have a series of encapsulations and decapsulations that take place as the packets go through the various layers in the network elements. Encapsulations happen as we go down the layers, and decapsulation as we go up the layers. Thus at the sender end it is all encapsulation, while at the receiver end, it is all decapsulation (see Fig.1.13). At the routers, we have both (Fig.1.14 ) ! 1.3 OSI model – historical perspective Before we end this overview, let us quickly look at the OSI model - which is a 7 layer model which was originally proposed. Shown in Fig. 1.15 is the OSI model. End host End host A pplication A pplication Presentation Presentation Session Session Transport Transport Netw ork Data link Physical Netw ork Data link Physical Netw ork Data link Physical Netw ork Data link Physical One or more nodes w ithin the netw ork Fig. 1.15 OSI Model You can locate two additional layers - namely, presentation & session layers - between the application layer and the transport layer. These are end-to-end layers handling issues such as presenting data in the correct format, establishing and maintaining sessions etc. These are absent in the TCP/IP model. How do you think these functions are accommodated ? In the TCP/IP model, these functions are expected to be performed by the transport or the application layers ! You can see the mapping between these two models below. The TCP/IP model can also be viewed with the bottom-most two layers combined (into a single network interface layer) as shown in the Fig.1.16 below. Fig. 1.16 Comparison of OSI and TCP/IP models