IP Network Addresses

1 Conversation

WORK IN PROGRESS

A number of articles, both here and elsewhere, have been written on the subject of setting up TCP/IP1 networks. Many tell you to set your IP address to X, your Netmask to Y, and your gateway to Z, without providing an adequate explaination of what any of this means, and why it works the way it does.

Internet Protocol (IP) networks - The basics

Internet Protocol (henceforth, IP) is designed to be media-independant. This means that it works on various types of networking hardware, without preference to any particular technology. When new networking hardware comes along, someone will write an internet protocol implementation that runs on that technology, and users of that new hardware will be able to exchange data with users of existing hardware. Whether your network runs on ethernet, token rings, ARCnet, carrier-pigeon, serial lines, or wet-peices-of-string, the rules of IP networking are the same.

Every network interface in an IP network has an address ('IP Address'). If a machine on the network (a 'host') has more than one
interface, it will have more than one IP address. A host with more than one interface is considered to be on multiple networks.
It may provide a route between those networks (a 'router') or it might not. That is a matter for the network administrator
to decide when they design the network.

An IP Address is normally quoted as four decimal numbers in the range 0 to 255. Each of these numbers represents one byte
of the four bytes that makes up an IP version 4 address. IP version 6, which is slowly being adopted, has a far larger address,
and is not covered in this entry.

A typical IP address, such as that used by the BBC Web server is, 212.58.224.124

If we express this address in binary, which is the pattern of 1's and 0's that appear in the actual network data that gets transmitted down the various types of wire, it looks like this:

21258224124
11010100001110101110000001111100

Rule Number 1: No two network interfaces that can possibly talk to each other can have the same IP Address

In addition to an IP Address, each network interface also has a Network Mask associated with it. This network mask tells the network how many bits of the 32-bit IP address are 'network bits' and how many are 'host bits'. This brings us to rule 2.

Rule Number 2: All interfaces connected to the same network have the same network mask, and the same values in all of their network bits.

The network mask is quoted in the same style as the IP Address. It comprises four decimal numbers in the range 0 to 255. Because network bits in an IP address always come before host bits when written left to right, the network mask is always a number of 1's, followed by a number of 0's. It follows that the only values that can appear in a network mask are 255 (all bits set, or 11111111), 254 (all except the last bit set, or 11111110), 252 (all except the last two, or 11111100), 248 (11111000), 240 (11110000), 224 (11100000), 192 (11000000), 128 (10000000), and 0 (00000000), and that no decimal number in a network mask can be larger than any number that precedes it.

Given the information2 that the network mask for tbe BBC's web server network is 255.255.252.0, it is possible to apply that to the IP address of the BBC web server to see its network bits and host bits:

IP Adddress21258224124
..in binary11010100001110101110000001111100
Network Mask2552552520
..in binary11111111111111111111110000000000
Network bits1101010000111010111000
Host bits0001111100

This becomes clearer if we look at the IP Address of news.bbc.co.uk, which is 212.58.226.20

IP Adddress2125822620
..in binary11010100001110101110001000010100
Network Mask2552552520
..in binary11111111111111111111110000000000
Network bits1101010000111010111000
Host bits1000010100

From this, it can be seen that www.bbc.co.uk and news.bbc.co.uk are two different hosts on the same network.

The number of 1's in a network mask also gives you an idea of the size of the network. The more 1's, the more bits represent the network part of the address, and fewer bits represent the host part of the address. The network mask 255.255.255.0 contains 24 1's, so there are only 8 bits left over for the host part. This means that the network can have a maximum of 256 possible addresses.

It is worth noting at this time that the IP Address with all of the host bits set to 1 is used as the 'Broadcast Address'. This special address is used by all of the machines on the network to broadcast information to all of the other machines on the network. Machines running the windows operating system use the broadcast address to broadcast information about network resources that they offer, so that other machines in their local area know about them.

The IP Address with all of the host bits set to 0 is also reserved, and cannot be used for any interface connected to a network.

Rule number 3: If you want to talk to a machine which has different network bits to all of the network interfaces on your system, you are trying to talk to a machine that is not connected to you. This is difficult to do.

For data to reach another address which is not on any of the networks to which the source of that data is connected to, it needs to know which route to take. This requires the services of a 'Router' or 'Gateway'. Machines on a network are given the IP Address of the local gateway, and send any traffic that is not going to a local machine to that gateway. The gateway, we hope, knows what to do with it. Typically, the local gateway does not know what to do with it, and passes it up the chain to another router, and so on until it finds a router which knows who deals with that sort of traffic. The data is then forwarded to that router, which sends it back down the chain until it arrives on the network to which the target machine is connected, and is then dealt with.

For example, when you want to view the BBC's web pages, your machine tries to connect to the BBC's web server. When it realises that the BBC's web server is not on it's own local network, it forwards the request to it's default gateway, which in my case is an ADSL router (which is on my network, and also on my internet service provider's ('ISP's') network.. My router does not know the BBC personally, so it sends the request on to my ISP's routers, which know that to reach the BBC, it needs to go via Telehouse, in London. My ISP has a router in Telehouse, and so does the BBC. My ISP's router forwards the request on to it, and the request then goes into the BBC network, arriving at the BBC's Maidenhead network, before being forwarded on to the BBC's Internet Services network, on which the web server sits. In total, the data travels through nine different machines on it's way to the BBC. The response from the BBC (this web page) takes a similar route back to me.

1TCP/IP = Transmission Control Protocol / Internet Protocol, the language of the internet2This information is probably wrong, but it is good enough as an example

Bookmark on your Personal Space


Entry

A12179216

Infinite Improbability Drive

Infinite Improbability Drive

Read a random Edited Entry


Currently in:

Disclaimer

h2g2 is created by h2g2's users, who are members of the public. The views expressed are theirs and unless specifically stated are not those of the Not Panicking Ltd. Unlike Edited Entries, Entries have not been checked by an Editor. If you consider any Entry to be in breach of the site's House Rules, please register a complaint. For any other comments, please visit the Feedback page.

Write an Entry

"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."

Write an entry
Read more