BACK TO HOME PAGE
This is an article I prepared for the Canberra PC Users' Group magazine Sixteen Bits. It was published in 1998.
Nope. These days it’s more likely to be a beige box full of complex circuit boards, wires, switches and other paraphernalia - connected to a whole pile of other beige boxes like it! As Sun Microsystems of the US exclaims “the network is the computer”.
Many of us have used networked computers for years at our workplaces. It would be hard to imagine functioning usefully any other way (except the days when the network is down!).
Nowadays, many of us are extending computer networks to our homes. Some of us connect to an employer’s network so we can work after hours or take up home-based work. Lots of us are getting connected simply for play and pleasure - and to nothing less than the network of networks, the Internet. (You’ll find out that ‘network of networks’ is actually a very apt title.)
Oh yes, the Internet again. I dare not think how many words have been written about the ‘Net but this article is DIFFERENT. I’m not going to thrill you with clever things you can do on the Internet. Instead, I’m going to dabble in the standards, protocols and architecture that make it work. My aim is to avoid excessive techno-babble and explain it in a way that even the ‘technically-challenged’ can understand...
Let’s dive straight in. You may have seen the acronym TCP/IP. This is the stuff of the Internet. TCP stands for Transmission Control Protocol and IP stands for Internet Protocol. These are the two standards that work together to drive data over the ‘Net. But before looking at these in any detail, we need to learn some basics of computer networks.
Figure 1 shows a simplified computer network. For comparison, a simple telephone network is shown in figure 2. Let’s look at the phones first. The black lines connecting each phone to the exchange each represents a pair of wires. Every phone connected to the exchange is connected via its own separate, private pair of wires. This means that at the telephone exchange end, there are huge, thick bundles of wires going in: one pair for each subscriber. When a call is made from a phone on Exchange 1 to a phone on Exchange 2, the switches in the two exchanges connect the two relevant phone lines together via one of the trunk lines between the two exchanges. The significant thing to note is that once the connection is made, it remains unbroken for the length of the call. Both subscriber phones will be ‘busy’ and no other calls are possible because their lines are occupied with the current call. There is a permanent and private physical connection established between the two phones for the duration of the call.
The computer network is very different (figure 1). Any computer connected to a particular switch is connected via a single cable which it shares with all other computers connected to that switch (computers use special ‘switches’ which I’ll explain a bit later). There is no private line for each computer. When a ‘call’ is connected between a computer on Switch 1 and a computer on Switch 2, the data first travels down the common cable to Switch 1 which shunts it onto the cable connecting the two switches. Switch 2 then switches the data onto the shared cable that goes out to the computers on the right side of the figure.
The call between the two computers might remain active for minutes, hours or days but is only allowed to occupy the cable for brief moments every now and then, when data is ready to be exchanged. All the other computers sharing the cable can have active calls over the same period and can exchange data - but they have to wait until the cable isn’t tied up with another caller’s data. A single computer can also have multiple ‘calls’ in progress at one time. It simply jumps from one to another as needed. In the case of the computer network, there are multiple virtual connections established over a single permanent physical circuit or connection (the single shared cable).
An analogy for the computer network, using the telephone example, would be a conference call among a group of people. Each person is connected to all the other parties, and can address anyone, at any time and in any order - provided no-one else is currently talking, of course. This analogy illustrates another important point which applies to the computer network: the conference callers can’t conduct a private conversation with any one of the other callers because everyone else can hear. Any computer sharing the same network cable as other computers can obviously hear all the other conversations going on. This is one of the features of computer networks that hackers can take advantage of to intercept and interfere with other ‘calls’ (although there are solutions to this problem).
Be aware that the computer and telephone descriptions are simplifications. Also, technology is constantly on the move such that computer networks are increasingly being designed like the connections between telephones and exchanges: with each having a private cable. This enables network engineers to do nifty things like isolate computers onto different virtual networks (virtual LANs). Likewise, telephone trunk routes will, more times than not, be ‘digital’ and use very similar technology to that which connects two computers.
You might be wondering how this relates to your humble (or not so humble!) computer which has a connection to the Internet. Well, your computer isn’t directly networked (ie shares a common cable) with other computers. But the computers at your Internet service provider are. In the case of the PCUG, these are The Internet Project (TIP) computers. Much of what I cover will describe what happens to your data once its gets into the big wide world at your ISP and beyond.
I haven’t quite finished on the problems that arise when computers share a common cable. When does a particular computer know it is allowed to ‘have its go’ on the cable? There are many ways this can be done and it varies with the type of network. All of them rely on the sender breaking his or her data up into lots of small chunks that won’t tie up the cable for very long. These chunks of data are called packets or frames. There is no standardised terminology. For the sake of this article, I will stick mostly with the term packet. Computer and digital networks are often described as packet-switched networks and the concept of packets is fundamental to such networks, including the Internet.
There are a few different ways that computers can avoid turf battles on a shared cable. While you don’t really need to understand this, you might find it interesting all the same. One simple method is to give each machine a small, regular slot of time. Each computer keeps track of the time and can easily predict when its turn comes up next. The name for this technique is time division multiplexing. It is not used very often because it suffers from a major weakness. Can you guess what that is? To give you a hint, what would happen if one computer suddenly needed to send a lot of data over the cable while the others remained fairly idle. Would it be efficient to make this busy computer wait around for a time slot while the others weren’t making good use of their time slots?
A more efficient method is to allow computers to fire their packets of data willy nilly (at least initially), but if someone else happens to send their packet at the same time, then they each wait a short but random time before sending again. The chance that they will both choose the same random time is very small and another packet ‘collision’ can thereby be avoided. This method, in fact, forms the basis of one of the most widely used network technologies: Ethernet. Just to let you know what I am saving you from by way of gobbledegook, here is the official name for this collision detection protocol: Carrier Sense Multiple Access with Collision Detection, or CSMA/CD for short.
From a wiring point of view, the computer network is obviously a lot simpler (and potentially cheaper). But there is a particularly worrisome question that this architecture raises... For any data transmitted on the cable, how do the computers and the switches know where the data is coming from or going to?
The solution is conceptually very simple. An address is simply added to the start of each data packet, just as a paper envelope would have a destination address on the front. The address specifies the computer the packet is being sent to. This is where TCP/IP comes in. The ‘IP’ part provides the addressing feature. And just like ordinary postal mail, it’s useful to have a sender’s address in the packet header. IP provides this and a number of valuable features as well.
It’s now time to have a more detailed peek at what an IP packet looks like before running through an example of how it works in the real world. Figure 3 is a diagrammatic representation of an IP packet. (The official documents describing IP packets actually call them datagrams, but I’ll stick with the term packet here). An IP packet is simply a long string of bits (ones and zeroes). The bits are transmitted one after the other over the network cable or phone line, starting from the left. Since transmission is from the left, the first data transmitted is the IP header. You will also notice the TCP header lurking behind it - but I won’t be explaining its role until later. The remainder of the packet contains the actual sender’s data - which could be anything -- maybe part of an email message, or a piece of a Web page.
Figure 3: Structure of an IP packet with an ‘exploded’ view of the IP header.
The IP header is the first thing to be transmitted because the network ‘switches’ need to retrieve the destination address before the packet can be forwarded in the correct direction. It makes sense, therefore, to put this information up front. Don’t ask me, however, why the destination address was put down the tail end of the header!
As you can see, there are lots of other fields in the IP packet. A brief explanation of each will start giving you some hints about the other capabilities of IP. I have also indicated in brackets the number of bits occupied by each field:
There are a couple of fields above worth a further comment or two. One of these is packet length. The size of packets is a tricky thing to specify. Because the IP and TCP headers might occupy, between them, almost 400 bits, they add a lot of ‘overhead’ to the packet. Ideally the ratio of data bits to header bits should be maximised to keep this overhead down. However, networks physically can’t transport packets with no chance of error. And the larger the packet gets, the more chance that it will score some damage during transmission and must be discarded. So the packet length is something of a compromise between network error rates and packet header overhead.
The IP source and destination
address fields are probably the most
and the most important to this article (see box on IP addresses). Every
computer or device connected to the Internet has its own 32 bit
This means there are 4,294,967,296 possible addresses ie just over 4
Like the 640K limit on RAM in the original IBM computer, no one ever
this would be exceeded. And, like IBM memory, there are now serious
about running out of 32 bit IP addresses. IP version 6 (the next
will solve this, at least for a ‘little while’. IPv6 addresses are 128
bits long. This means there are 2128 possible addresses. To
put a number of this size in context, the total number of atoms in the
Earth is estimated to be 2170.
IP addresses are written in an unusual way. They consist of four numbers separated by dots, for example: 10.157.23.98 The dots are just convenient separators. Each of the numbers represents one of the four bytes that make up the 32 bit address, and each byte has a possible value of 0 to 255.
Every IP address has to be different to ensure that every user or machine on the Internet can be uniquely identified. The only effective way to achieve this is to leave a single body in charge of all IP addresses. There is such a body and it is called the Internet Assigned Numbers Authority (IANA). However, rather than issue all the IP addresses itself, it delegates the job to recognised authorities around the world, and issues each of these with a block of addresses that can be handed out. There are four such bodies in Australia: Melbourne IT, Netlink Holdings, Capital Networks [in Canberra!] and Moniker. (The politics of IP address allocation are very complex and warrant a whole article in themselves.)
These bodies also register names associated with the IP addresses, simply so we don’t have to remember a 32 bit number to get to a site or mailbox on the Internet. Instead, we remember the name associated with that address, for example, www.pcug.org.au instead of 22.214.171.124. (By the way, this 32 bit number should work if you try it, but I recommend you don’t as there is no guarantee that TIP won’t be reconfigured by our TIP administrators tomorrow, and the address changed.)
Just as we need telephone directories to find people’s telephone numbers, the Internet has to provide directories so that the IP addresses of Internet sites can be found. These ‘directories’ are stored in computers on the ‘Net and form part of the Domain Name System (DNS for short).
Now it’s time to look at what actually happens when you send or receive data between your computer and the Internet. As an example, let’s look at what happens when you fire up your World Wide Web browser to take a peak at a Web site of interest. Figure 4 shows a layout of the hypothetical section of the Internet (the real thing is similar but vastly bigger than this). You will need to look at this diagram to make sense of the explanation below.
Figure 4: A hypothetical section of the Internet showing a ‘surfer’ connected via modem to TIP (top part of figure). The shaded boxes are network switches called routers. The routers each have a private network connected to them, shown either as a cloud or abbreviated as a dotted line. The routers could be scattered around the world and are connected to one another by public communication lines such as satellite links, undersea cables, optical fibres etc which are rented off phone companies or the like.
At the moment, you only know the name of the site. You have no idea what its IP address is. So the first thing to do is look up the IP address. To get this process underway, an IP packet is created on your computer. The data section of the packet (not the header) will contain the name of the site you want to look at (for example www.intel.com). The IP header of this packet will contain, as its destination address, the IP address of your preferred Domain Name System (DNS) server. This server looks up “www.intel.com” to find the corresponding 32 bit IP address. It then creates a new IP packet containing this information and sends it back to you by putting your IP address as the destination in the IP header. We’ll look at the process by which the packet gets routed to and from you in a minute since it is the same for other packets.
Before finishing on the topic of the DNS, there are a couple of interesting questions to answer. How do you know which DNS server to send your request to in the first place? Well, this is the only address where you must tell your computer the numerical IP address. When you first subscribe to TIP or another Internet Service Provider (ISP), you will be told the local DNS server’s IP address (or it will be buried somewhere in the start up kit your ISP gives you and automatically loaded for you). In the case of TIP, it actually has its own DNS (the IP address is 126.96.36.199).
What happens if you make an error in the name of the site you send off to the DNS server? Try it some time and have a look at the message on your browser screen. It will say something like “DNS name lookup failure... The named host probably does not exist.”. Hopefully you’ll now have a better idea of what that message means.
Our browser now has the 32 bit address for the Web site. Another packet is created containing this as the destination address in the IP header. The data section of the packet will contain a message requesting the Web page. (The format for this message is not of interest here; it is part of the HyperText Transfer Protocol, or http for short.) We’re interested in how the packet gets to its destination and how the requested information is returned in response.
Back to figure 4 again. Let’s assume we are fetching a Web page from the Web server located on network ‘I’ (the Web server is nothing more than a computer on this network running Web server software).
The first thing that happens is the packet is turned into a stream of bits by your computer and transmitted to TIP over the phone lines, via a modem at each end. Once in the TIP network, it will be one of many packets on the shared cable that connects all the machines at TIP, including the TIP router. Router is the term used for a network packet ‘switch’ and they are just specialised computers (there are a few other switch types, but we won’t get into these). The router’s job is to look at the destination address in each packet and decide whether it should be sent to the outside world on one of its ports, or just ignored. In the case of the packet we have just sent to TIP requesting a Web page, the TIP router reads the destination address and says to itself “Aha, this packet is not addressed to any IP address in TIP. It therefore must be sent forth into the wider Internet.”
In figure 4, it happens that the TIP router is only connected to one point on the Internet: router A (all of the boxes with letters in them in figure 4 are routers). Note that there is also a ‘private’ network (network ‘A’, shown as a cloud) connected to router A. In fact, the only reason router A probably exists is because the organisation that created network ‘A’ decided it wanted an Internet connection and so put the router in place to connect itself. The managers of the TIP network and network ‘A’ would have to agree with each other before renting a line to connect them. Network ‘A’ could be just about anything including a private network in a company, another organisation like TIP, a university, a public Internet Service Provider (ISP) and so on.
(All the other routers shown in figure 4 will probably have private networks connected to them and network clouds are shown for some. To save space, the networks connected to other routers have simply been abbreviated as dotted lines. The Internet is sometimes referred to as a ‘network of networks’. The logic behind this name is that the routers are connected to one another in one huge network while there are smaller private networks connected to each router.)
Coming back to our packet, from here on the same thing happens each time it gets to another router. The destination address is examined by the router to first determine whether or not it is addressed to any machine on that router’s private network -- if not, it sends it to the next router. The packet will finally get to the router connected to the destination network, which in our case is network ‘I’. Once it reached router I, that router would look at the destination address and say to itself “Wow, this packet is actually addressed to someone on my network. How exciting. I’ll forward it on to my local network straight away” (routers have pretty boring lives).
The tricky part with routing comes when there is more than one router to send the packet to (for example, router E). But let’s first backtrack and look at what happens to our packet at router A. This router could, in fact, send the packet to router B or back to the TIP router if it wanted. To make the right decision (ie send it to router B), router A not only has to know what IP addresses exist on network ‘A’ (so it can decide whether or not to forward any packet on to network ‘A’), it must also have some idea of the network addresses that are connected to its other ports. On the TIP side, that will be the relatively short list of TIP addresses. On the router B side, all the remaining IP addresses on the Internet are found. The simplest way for router A to deal with this is to record only the addresses that are connected to the TIP port and to private network ‘A’ in its routing table. Anything that doesn’t match these will simply be forwarded to router B (the router’s equivalent of buck-passing!). In this situation, router B would be referred to as the default router for router A.
The job of configuring router A is
obviously fairly straightforward
and can probably be done manually by the administrator of network ‘A’.
There are three classes of IP addresses that are issued to end users: A, B and C.
Remember that IP addresses consist of four bytes, each with a range of values from 0 to 255. When all but the last byte is specified in an address, this is said to be a Class C allocation. For example, 203.10.76.* is Class C. The person or organisation which is assigned this can use all of the 256 possible values for the final byte to assign to people or machines on their network (don’t forget that anyone who wants to use the Internet has to have their own unique IP address).
A Class B allocation only specifies the first two bytes, for example 132.10.*.*. There are 65,536 possible values for the remaining two bytes. Such large amounts of address space would be reserved for either very large organisations.
You have probably guessed that Class A allocations only specify the first byte, for example 45.*.*.*. Each Class A allocation can provide almost 17 million addresses. A Class A allocation would be sufficient for a whole country in many cases.
Because addresses have mostly been allocated in blocks as just described, routers can save themselves a lot of work. Rather than storing all the 4 bytes addresses which are accessible on each port (after all, there are 4 billion addresses total), they only need to store the class A, B or C numbers in their routing table. This vastly reduces the storage and processing power required in the router down to a practical level. An analogy in the ordinary postal system is the use of street, suburb and country identifiers to help the postal service to efficiently sort and dispatch mail. For example, a postal worker sorting international mail only needs to look at the country in the address. He or she doesn’t have to worry about the other parts of the address.
Router E, on the other hand, can’t get away this easily. It has to store a lot more information in its routing table because it has many more active ports with routers connected. (It will probably be a lot busier too, and consequently have a faster processor and bigger memory.) Router E can still have a default router, but that doesn’t greatly diminish the task of knowing what IP addresses are connected to its other ports.
The job of manually entering all the routing information that router E needs is a bit excessive although some manual configuration will always be essential. Router E’s task is compounded by the fact that the network is constantly changing to a greater or lesser degree. Fortunately, there are automated ways for it to find out about the addresses that are accessible on its various ports. Most routers come with routing daemons. These are software routines that create and exchange packets with other routers solely to swap routing table information.
Daemons also have other uses. Let’s look again at our packet being sent from TIP to the Web server on network ‘I’. Once this packet gets to router E, it has a few choices about where to go next. It could go directly to router G. But maybe the line between E and G is slow or error prone. Hence, it might be preferable to send the packet via router F.
Now what happens if router F fails? Will router E find out about this? This is where the daemons come in again since they also help detect failures in the network. If a router somewhere goes off line or crashes (for example, router F), it will stop sending its routing information. Other routers listening for this information (like router E) will suspect a problem and will, after a short time -maybe a minute - delete all of F’s routing information from their routing tables. It’s as if router F didn’t even exist. Router E will still have the information from router G which tells it there is a path to network I through G. Hence, router E will forward the packet this way instead.
So the next time you have trouble reaching an address on the Internet, you might rightly blame the “daemons in the network”!
Jokes aside, the Internet is actually a very robust network. One of the key reasons is that there are usually multiple paths to the same destination. The Internet protocol was specifically designed to take advantage of this so that even if parts of the Internet were out of action, the packet would probably get through. After all, the Internet protocol was designed for the US defence department which was conscious that an enemy might be able to take out part of a network, but not all of it. In those circumstance, they would still be able to communicate over much of the network.
Time to look again to our original request to fetch a Web page from network ‘I’. Our packet has finally reached its destination. The Web server on network ‘I’ will intercept it and respond with a copy of the requested page. This will probably be large enough that many packets will be needed to send it back to us. The Web server will send these packets off in the correct order, but there is no guarantee they will reach our end in the same order because it is quite possible for each packet to go by a different route and thereby take a different amount of time in the process. This is where the Transmission Control Protocol (TCP) comes to the rescue...
The Internet protocol is responsible for ensuring that the packet gets from the sender to the destination. IP doesn’t care if there is one or one hundred packets that need to be sent. It is worries about each individual packet when it gets it. TCP, on the other hand, is responsible for ensuring that the stream of data which may have been broken up into many IP packets, actually gets to the receiving end without any parts damaged or missing, and in a form that can be reconstructed easily.
Figure 5: The TCP header in an IP packet
Figure 5 shows the structure of the TCP header. Here’s a brief rundown on what each of the fields in the header does:
TCP is quite a bit more complex than IP because it is designed to conduct a two-way conversation between the sender and the receiver. The role of some of the fields above might become a little clearer once you know how this conversation occurs. There are several ways a conversation can start. In the example below, the sender initiates the conversation. Here’s an outline of what occurs, with some steps removed for simplicity (remember, all of these messages are ‘wrapped’ inside properly addressed IP packets):
The Internet protocol and the transmission control protocol work hand-in-hand to ensure that data gets from the sender to the receiver reliably and in an uncorrupted form. IP is responsible for creating packets and for addressing them to the correct destination. IP is mostly worried about the network and shifting packets around. TCP, on the other hand, provides crucial quality control. It constantly checks up on IP to see that its packets and getting through. TCP ensures that data is split up properly for transmission (by IP), and is reassembled correctly at the destination end.
I have simplified the story somewhat and left out a few of the more estoric details. There is also lots about computer networking that I haven’t covered like the layer structure of the OSI model. But this article was only intended as an introduction, although one with enough detail to satisfy the curious... and it has already turned out far longer than I anticipated.
If you want to read more about TCP/IP and computer networking, there are heaps of resources on the ‘Net. Try a search with your favourite search engine. One source of information that is extremely valuable is the RFC documents. ‘RFC’ is short for ‘request for comment’. RFCs are the technical documents that specify all of the Internet protocols and standards. Be warned though, there are thousands of them. Much of this article was drawn from the IP and the TCP RFCs (RFC 791 and RFC 793 respectively). The RFCs are prepared by individuals and working groups of the Internet Engineering Task Force (IETF) and are available on many sites. Do a search with your favourite search engine.