Drobe :: The archives
About Drobe | Contact | RSS | Twitter | Tech docs | Downloads | BBC Micro

An introduction to IP networks

By Eddie Lord. Published: 4th Sep 2004, 21:09:56 | Permalink | Printable

Part one of masking the 'net

Archive logoIn a series of articles originally published earlier in Archive magazine, Eddie Lord gently talks us through the growth and structure of IP based networks

Anyone who has the delved into the Network section of the !Boot configuration tool might be forgiven for wondering what on earth the IP address and netmask numbers are all about. My aim in this article is to give the general readership some background material on network addressing, and subnet masks in particular.

In order to do this, I will go back into Internet history and quickly recap on some elementary binary arithmetic. I will then look at the gory details of network classes, subnet masks, subnetting and CIDR (classless inter-domain routing).

Some network jargon
Networks have acquired a jargon all of their own, as is usual with anything technical, so I will try to explain any jargon as it arises, but first some elementary definitions are required.

Networks can be either a local area network (LAN), such as you might have at home, or that mother of all networks, the ‘Internet’. Generally, large networks are called wide area networks or WANs. Networks of all kinds are just a collection of hosts or nodes connected together.

The words ‘host’ and ‘node’ are used extensively in network jargon. A host or node is simply any computer, printer, Internet router or other device with its own network card or interface. Each host or device requires an address in order to communicate with the net. In the context of a network, it’s actually the interface that is important. Some hosts, such as a device called a router/modem, can have more than one interface, and it is each interface that needs an address.

Data sent via a network has to be packaged in a certain way. This is known as a protocol. There are many protocols on the Internet, TCP/IP being probably the most common. Other common protocols are NetBEUI, AppleTalk and IPx.

The term TCP/IP stands for Transmission Control Protocol/Internet Protocol. In simple terms, TCP ensures that any message is sent error free, whilst the IP controls the routing of the message. It’s not the most efficient protocol, but many of the other protocols are proprietary, being marketed by various big companies.

TCP/IP is equally at home on a small network, even if it is only two machines connected together by a single cable.

To successfully deliver a message, the Internet protocol requires that each host has a unique address. This is the IP address which currently consists of a 32bit binary number. As I shall explain in more detail later, hosts must be arranged in a series of networks. To control the division of these networks, we need another 32bit number called the subnet mask or just ‘netmask’.

History of the IP address
The origins of the Internet can be traced back to the US military who were concerned about their ability to communicate in the event that all centres of communication were destroyed. In 1969, a project was set up to try to address this problem and build a ‘web’ of routes which would automatically bypass any failed communication centre.

By the mid 1980s, the project had become dominated by universities and research sites. TCP/IP was developed and in place as the major protocol, and email started to become popular amongst the researchers. In 1983, a total of 562 hosts had been registered.

In the early days, it was possible for anyone to just request an IP address from the controlling organisation. However, it soon became evident that some sort of system had to be put in place to administer IP address allocation.

The Internet Assigned Numbers Authority (IANA) is now the international organisation that oversees the issue of IP addresses. In fact, IANA allocates parts of the address space to the various Regional Internet Registries according to their requirements. These regional bodies are then responsible for assigning addresses to other operators and users within their own regions.

A major problem with the established scheme is that the supply of available IP addresses is running out. A new scheme is now being rolled out which extends the current 32bit number regime (called IPv4) to 128 bits (called IPv6 or IPng - next generation).

The growth in the Internet has been stunning and continues to grow beyond the original designers’ wildest estimates. A typical pattern of growth can be seen in the chart (figure 1), which shows the growth in the number of active routes of a major ‘backbone’ network. A backbone network is just one of many central networks that connect smaller and usually slower speed networks together. This phenomenal growth also brought further problems with the storage of all the IP addresses – an issue which I’ll look at later.

Figure 1: Growth in routing tables

On a practical note, when you log on to your ISP, they lend you an IP address for the duration of the session, and this is known as dynamic addressing. A static IP address means that the ISP will allocate you an IP address of your very own. (Buy one now whilst stocks last!). However, in reality, if you move to another ISP, you will have to change your IP address anyway. This means that you don’t ‘own’ the IP address but only rent it.

Decoding the IP address
Should you ever look at the network configuration option within !Boot, you will see that the IP address is expressed as four decimal numbers separated by dots. This is known as the dotted decimal notation. The decimal notation is simply a shorthand method of writing the address which, in reality, is a 32bit binary sequence. Since we poor mortals find it difficult to count in binary, the decimal notation is intended to help with the understanding and handling of IP addresses.

Any 32bit number can be broken down into four bytes. Each byte represents eight bits. (These bytes are sometimes called octets.) Each decimal number of the dotted decimal IP address represents one of these bytes. Each byte or eight bits can range in value from 0 to 255 which, in binary, is 00000000 to 11111111. Figure 2 illustrates how the dotted decimal notation relates to the 32bit binary equivalent.

Figure 2: Dotted decimal notation

Note that the binary number is, in fact, one long number and has only been separated for clarity. In theory, a 32bit number can represent 232 addresses. That’s 4,294,967,296 or just under 4.3 billion addresses. Of course, life is not that simple; what nature gives with one hand, it takes away with the other. In this case, trying to attach four billion computers together on one (very long) wire just wouldn’t work.

Apart from anything else, one wire couldn’t support all the network traffic at once as there would be insufficient bandwidth. It was clear that the one wire network had to be broken down into a series of subnetworks and, in order to subdivide the 232 addresses available into more manageable sizes, the class system was devised. Three classes were designed to accommodate large, medium and small networks, respectively. However, before discussing network classes, it’s time for some education.

Back to school
To fully understand IP addressing and netmasks, some elementary binary sums are required to convert decimal numbers to and from binary, and to handle binary addition.

Conversion between binary and decimal numbers is relatively easy when you recall that each 0 or 1 in a binary number stands for some power of 2. Table 1 will give a clue. In the example shown, we convert the binary number 00110001 to decimal by noting the numbers represented by the 1’s and adding them up. In this case, add 32+16+1=49.

Table 1

Conversion from decimal to binary is similar. Just divide the decimal number by the highest power of two and, if there is a remainder, divide that by the next lower power of 2, and so on. If the number is less than the power of two then record a 0 - otherwise record a 1. In this example (table 2), the number 220 converts to 11011100.

Table 2

One other concept we need to know is the special manipulation of binary numbers known as ‘bitwise logical AND’. This is relatively simple idea that is illustrated below:
1 AND 1 = 1
0 AND 1 = 0
1 AND 0 = 0
0 AND 0 = 0

In other words, if you are ANDing with 1, the original binary number is passed through:

1 AND 1 = 1
0 AND 1 = 0

If ANDing with 0, the result is always 0:

1 AND 0 = 0
0 AND 0 = 0

This is the fundamental principle used in netmasks which we will come to later. The term ‘bitwise’ just means handle each byte one bit at a time.
You can see a practical analogy of the ANDing process if you consider two switches in series as shown in figure 3. Electricity will only flow in the first example.

Figure 3: ANDing two bits

These binary manipulations can be checked on the computer. Just go to the task window <ctrl-F12> and type BASIC. This will start Basic V and, at the command line, type PRINT %1010 AND %1100. This will calculate the AND of these two binary numbers and display the result in decimal.

You may well wonder why I have indulged in this interlude of binary conversions but that will start to become clear as we continue. In fact, binary notation is an essential part of understanding how IP addresses and netmasks work, so it’s worth getting to grips with it. I said earlier that dotted decimal notation was used to make IP addresses easier to understand but, on occasions, it actually makes it more difficult to see what is going on. Using the binary notation is then essential for understanding the principles.

You will also notice how the powers of two keep cropping up throughout this article.

Classic IP addressing
In 1981, the Internet protocol was standardised as a 32bit number which consisted of two parts, the network part and the host part. The two-part structure allows the various routers to correctly forward any data packets by referring to the network part alone. Each router looks up its routing table and forwards the packet to the next router closest to the destination. Once the packet reaches the destination network, the router then uses the host part of the address to deliver the message to its final destination host.

Originally the whole IP address space was broken down into five classes. Each class was defined by the first four bits of the binary address plus the length of the network part of the address. Figure 4 illustrates this division of classes whilst tables 3 and 4 add the details. Note the alternative names given to the different parts, which are often used interchangeably in networking literature. These days ‘network prefix’ is the preferred term for the network part − more of that later.

Figure 4: Classic IP address space

Table 3: Classic IP Network and Host Division
ClassBinary Network and Host partsNetwork bitsHost bitsNumber of Nets per Class2NNo. ofHost per Net2hTotal No. of hosts supported
A0NNNNNNN.hhhhhhhh.hhhhhhhh.hhhhhhhh 72412816,777,2162,147,483,648
B10NNNNNN.NNNNNNNN.hhhhhhhh.hhhhhhhh14 1616,38465,5361,073,741,824
C110NNNNN.NNNNNNNN.NNNNNNNN.hhhhhhhh21  82,097,152256536,870,912
Total hosts supported (theoretical)3,758,096,384

In the early days, Internet routers would detect the first four bits and automatically decide which class the address belonged to and hence, the length of the network part of the address.

Table 3 shows how each class has its address bits divided into network bits and host bits. The ‘N’ represents the network bits. The ‘h’ represents the host bits. Note how the parts divide on the byte boundary. The first part gives the network address or network number and the second part the host ID.

For class A, the length of the network part is defined by the first byte, for class B the first two bytes, and class C by the first three bytes.
Table 4 illustrates how each class is also defined by the first four bits of the address. Class A is specified as 0yyy, class B as 10yy and class C as 110y, where y can be either 0 or 1.

Table 4: Original Class System for IP Address Space
ClassFirst 4 address bitsAddress range of the first byte or octetFull address range for each classIntended use
Binary rangeDecimal range
Class A0yyy0000 0001 to 0111 11101 to 1261.x.x.x126.x.x.xLarge Organisations
0111 1111127127.x.x.xLoop Back test
Class B10yy1000 0000 to 1011 1111128 to 191128.0.x.x191.255.x.xMedium Networks
Class C110y1100 0000 to 1101 1111192 to 223192.0.0.x223.255.255.xSmall networks
Class D11101110 0000 to 1110 1111224 to 239Multicasting
Class E11111111 0000 to 1111 1111240 to 255Experimental

Using the first four bits, the address range of each class can be found. For example, class C has the first three bits set to 110. All the other bits in the network part can be either 0 or 1. The first byte must, therefore, range from 1100 0000 (192) to 1101 1111 (223). As the next two bytes of a class C address are also part of the network address, each of these bytes can range from 0 to 255. The host part is left to the client to select.

In simple terms, this just means that the network bytes are assigned by IANA, whilst the ‘x’ part of the address is assigned by the ISP or network administrator. So the full address range for class C networks is 192.0.0.x to 223.255.255.x

The observant amongst you will notice that not all possible values are represented or used. In particular, addresses to are reserved for use as the ‘default’ route.
One other important address which is reserved is This is used as the ‘all hosts’ broadcast address. (Broadcast addresses are covered below).

Addresses beginning 127.x.x.x are also excluded and are used for loopback testing on the local host. (If you look at the !Boot configuration Network->Hosts, you will note that the loopback address is, which is a standard IP address for loopback testing. This must not be changed.) You can test this by pinging which, of course, points to your own computer. (<F12> *ping When you get bored watching the results scroll past, just hit escape.

As far as we are concerned, only classes A, B and C are important as class D and E are used for other purposes and shouldn’t be used as valid IP addresses.

In fact, class D is reserved for multicasting, and class E is reserved for experimental work and future expansion. Observe from figure 4 that class A takes up half of the available address space, whilst class B uses a quarter and class C takes up an eighth. The power of two strikes once again.

Calculating network sizes
Now for some more sums. Look again at table 3 and the importance of the network part and host part becomes apparent when calculating the size of each network class. The number of networks available in each class is given by 2N and the number of hosts on each network is 2h.

One conclusion from table 3 is that the theoretical number of hosts supported by a 32bit number has dropped from the original 4.3 billion down to 3.7 billion, as class D & E addresses are excluded from the normal address space. Even this is only a theoretical limit as we’ll see in a moment.

In particular, addresses beginning with 0.x.x.x and 127.x.x.x aren’t available, reducing the number of class A nets to 126 and the number of hosts by 33,554,432 (2×256×256×256). Several other address blocks have been set aside for special purposes such as private address space and other ‘martian’ addresses − more in a moment.

Network and broadcast addresses
In addition to the reserved blocks, noted above, two of the available addresses within every network are also reserved and shouldn’t be assigned to any hosts. These reserved addresses are designated as the network and the broadcast address of the network respectively.

This is best illustrated with another example. Take a host address of, which from table 4, we can see is a class C address. There are a total of 2,097,152 class C networks, and each network can, in theory, support 256 hosts. The full address range for our example network will be from to It is the start and end addresses which are special cases and are reserved.

These addresses are special because the hosts bits are either all ‘0’ or all ‘1’. When all the host bits are set to ‘0’, the resulting IP address becomes, and is called the network route address. Think of the network address as the address of the network cable.

When all the host bits are set to ‘1’ then the IP address becomes which is called the broadcast address. The broadcast address is used to address all the hosts at once, so any packet sent to is sent to every host on that network. For class C networks, the actual number of available hosts on each network is now reduced to 254.

Private address space and other martian addresses
IANA had the foresight to set aside some of the available IP addresses for some private address space. These IP numbers can be used by anyone building a private network, as these numbers aren’t registered to anybody on the Internet.

Owing to the fact that they are unregistered, Internet routers won’t forward messages from these IP addresses. The down side is that you can’t use these numbers if you intend to connect your LAN directly to the Internet unless you are isolated behind a router, or a proxy server.

The security aspect is another important advantage of using private address IP numbers. Since these numbers are undefined on the Internet routing tables, these networks should be relatively secure from discovery.
One set of private addresses has been taken from each class and these are shown in table 5.

Table 5: Private Address Space
ClassPrivate Address RangeNo of Classic NetsHosts SupportedNetwork prefix
A10.0.0.0 to x A16,777,21610.0.0.0/8
B172.16.0.0 to x B1,048,576172.16.0.0/12
C192.168.0.0 to x C65,536192.168.0.0/16

If you are setting up a LAN at home then you are strongly advised to choose your host addresses from these IP numbers. In fact, you will probably find that the LAN side of any router you buy will already programmed with one of these addresses, and in my case it was, with a netmask of

As mentioned earlier, there are several other addresses reserved for special purposes and these are listed in table 6 with a brief explanation of their purpose. These are sometimes known as ‘martian addresses’.

Table 6: Other Reserved Addresses
Reserved IP AddressesNetwork prefixNetwork usage to “This” network to data networks to TV networks to address to configuration on a local link to network (Use in docs) to to 4 relay to Interconnect hosts broadcast address

Notice that a network prefix has suddenly appeared, and this will be covered later.

Classic problems
By 1985, it became obvious that the original class system had its problems. This is no surprise really as the original designers never envisioned the phenomenal growth of the Internet.

In retrospect, the class system was found to be extremely wasteful of address space. The class A regime takes up half the available IP address space and was quickly allocated, often to organisations that couldn’t possibly use the huge number of host addresses available to them. Class B addresses were also quickly exhausted, but again they were found to be wasteful, leaving class C addresses which were really too small for the needs of many organisations.

For instance, if an ISP needed enough addresses for, say, 30,000 hosts, a class B address might have been allocated. Since a class B network can support 65,536 hosts, the remaining 35,536 addresses were just wasted.

As a consequence, the availability of IP numbers was severely reduced. A second problem was also beginning to emerge with the global routing tables.

Global routing tables reach capacity
In order for messages to be delivered anywhere on the Internet, all the Internet backbone routers have to maintain a complete set of lookup tables with all the IP addresses logged. (Figure 1 actually shows the growth in these routing tables.)

Routing tables are complex and have to be constantly updated to keep up with the dynamic changes in the Internet. These tables started to grow beyond the ability of the software and personnel to manage the tables effectively. The problems of keeping the routing tables in sync started to threaten the growth of the Internet.

In Part Two
The story of the Internet is largely one of solving the above problems and the next development in the story was subnetting, which is covered in part two.


Articles, comments? Archive magazine - the subscription magazine for RISC OS users

Previous: Iyonix price slash offer, yawns stifled
Next: Solar powered RISC OS: wrong place at right time


Viewing threaded comments | View comments unthreaded, listed by date | Skip to the end

Wow what a well writen and informative article.

Very well done.

 is a RISC OS UserRevin Kevin on 4/9/04 10:45PM
[ Reply | Permalink | Report ]

A damn fine article, and it'll be interesting to read the bits I'm less familiar with in the next few articles :)

 is a RISC OS UserNoMercy on 5/9/04 3:33AM
[ Reply | Permalink | Report ]

Well explained for something I only just understand. Reminds me of the Acorn User Guide, something written to be understood! :grin:

 is a RISC OS UserSawadee on 5/9/04 4:14AM
[ Reply | Permalink | Report ]

I'd agree with the other people who've commented, it is a *stunningly* good article, well done Eddie.

 is a RISC OS UserAMS on 5/9/04 8:02PM
[ Reply | Permalink | Report ]

Yes I also agree that this article is extremely well written!

Well Done and thank you indeed for this insight in IP addresses :)

 is a RISC OS UserTimothy609 on 5/9/04 8:46PM
[ Reply | Permalink | Report ]

Is drobe.co.uk or Eddie Lord willing (in agreement with Archive, of course) to offer this excellent article as pdf file for download?

 is a RISC OS UserGollum on 6/9/04 12:29AM
[ Reply | Permalink | Report ]

Thank you for all your kind comments. Most gratifying.

As to a pdf file, its something I have thought about, but my idea was to have an Archive special with all the various networking articles in one volume. Something to discuss with Paul Beverley and Chris I think.

In the meantime, part two and three need some more work....:-)

 is a RISC OS UserEddie on 6/9/04 6:04AM
[ Reply | Permalink | Report ]

Will look forward to the next 2 parts then.

And if they are as good as this it will be a treat.

 is a RISC OS UserRevin Kevin on 6/9/04 10:02PM
[ Reply | Permalink | Report ]

It could be a bit clearer that this is history and the internet is classless for quiet some time now. We'll see in part two... subnetting.

 is a RISC OS UserJaco on 6/9/04 10:56PM
[ Reply | Permalink | Report ]

Fantastic Eddie. Simply Great

 is a RISC OS UserUmair on 9/9/04 10:11PM
[ Reply | Permalink | Report ]

Please login before posting a comment. Use the form on the right to do so or create a free account.

Search the archives

Today's featured article

  • Wakefield 2006 show report
    All the thrills and spills from the weekend [Updated]
     90 comments, latest by bucksboy on 23/05/06 5:57PM. Published: 15 May 2006

  • Random article

  • Intel to shed XScale chips
    Rids itself of non-mobile families, it's claimed
     15 comments, latest by druck on 7/5/06 9:19PM. Published: 5 May 2006

  • Useful links

    News and media:

    Top developers:
    RISCOS LtdRISC OS OpenMW SoftwareR-CompAdvantage SixVirtualAcorn

    CJE MicrosAPDLCastlea4X-AmpleLiquid SiliconWebmonster


    RISCOS.org.ukRISCOS.orgRISCOS.infoFilebaseChris Why's Acorn/RISC OS collectionNetSurf

    Non-RISC OS:
    The RegisterThe InquirerApple InsiderBBC NewsSky NewsGoogle Newsxkcddiodesign

    © 1999-2009 The Drobe Team. Some rights reserved, click here for more information
    Powered by MiniDrobeCMS, based on J4U | Statistics
    "Oh, and making up stories and quoting private emails out of context isn't damaging then?"
    Page generated in 0.1662 seconds.