Tokyo PC Users Group
	  Home Page
Home
Members Only
Newsletter
Newsgroups
Become a Member
Meeting Info & Map
Officers
Members
Corporate Members
Photos
Workshops & Training
Other Clubs
Job Hunting?
Constitution

An introduction to IP addresses: Part 1

by Kurt Keller

IP addresses (part 1) - on the internet you're only a number

If you have a connection to the internet and set it up yourself, you have at least once handled a number like 192.168.43.4. And every time you connect to the internet your computer becomes a number just like that one.

These numbers, consisting of four octets (or four bytes, a term which most people are more familiar with) are called IP numbers. (And if you're curious what IP stands for, it means Internet Protocol.) IP numbers are used all over the internet, without them the internet would not work. Even though they are all over the place, you rarely see them. One place you can find such a number for sure is the DNS server entry in your TCP/IP setup. If you don't have a number in there, then you're either using DHCP (Dynamic Host Configuration Protocol) to configure all these settings dynamically, you use IP numbers exclusively, or you ought to enlighten me on how you can connect to the internet without IP numbers.

DNS

An IP number, usually called IP address, is the address under which a specific machine on a TCP/IP network is known, similar to a phone number. Every machine has its own address, sometimes even more than one. Also your computer gets assigned such an address when you connect to your provider. The provider will assign you an address out of their pool temporarily and dynamically, unless you have a contract which guarantees you fixed IP addresses.

Humans, being somewhat different from computers, have quite some difficulty remembering lots of similar numbers. Working with names is much easier for us and less prone to errors. That's why you rarely see the bare numbers on the internet. Programs and computers are kind enough to translate names to numbers and back, so we can conveniently work with what we can remember. This translation is done by the Domain Name System, in short: DNS. So the DNS server you specify in your TCP/IP setup is the machine doing this translation for you. If you send off a request to connect to a certain website, let's say www.tokyopc.bbs.net, you first send a request to the DNS server to lookup and translate www.tokyopc.bbs.net into the correct IP address for you. With this IP address you then make the actual connection to the website.

People were already using names instead of IP addresses before DNS came into existence in 1984. At that time, they had all the known machines entered in a text file, the so called 'hosts' file. This file has survived till today, even though it has not the same importance any more. Working with the hosts file only is possible only for a manageable number of connected machines. In the early days of the internet this was no problem. There was one master hosts file which everyone would retrieve regularly and copy to their local machines. Whenever a host was connected newly to the internet or a host was taken off the net, a change in the master hosts file was necessary and all the other hosts only knew about the change after they retrieved the new master hosts file. With the internet growing rapidly, this way of managing name to IP resolution became unmanageable; on one hand because of the sheer number of machines to manage and the speed with which hosts were added, changed or removed, on the other hand because of the enormous bandwidth consumed by everyone copying the ever bigger master hosts file to their local machines.

DNS, which was invented because of the aforementioned problems, is a sort of distributed database system and does some more things than simply translating names into addresses and vice versa, but going into details would be a topic of its own.

IP classes

If you happen to know the IP address of your provider's DNS server, the mailserver, the news server and possibly some other machines, you will realize that very often the first three octets of their IP addresses are the same, for example 192.168.43.4 for the DNS server, 192.168.43.5 for the mail server, 192.168.43.7 for the news server and 192.168.43.25 for the secondary DNS server. This is not just by chance. Instead of giving out one IP address by one, there are classes which are assigned to organizations. A, B, and C classes are the most known ones, with the C-class the most common one. There are only 127 A-class ranges, or networks, but each of them has 16,777,214 addresses for hosts. There are 16,384 possible B-class networks with 65,534 addresses for hosts each and 2,097,152 C-class networks with 254 possible host addresses each.

Let's put it a little easier for the eye:

class networks hosts first octet

A 127 16'777'214 001 - 127

B 16'384 65'534 128 - 191

C 2'097'152 254 192 - 223

(The address range from 224.0.0.0 up is reserved for the special purpose classes D and E, which we will ignore here.)

Now you probably also understand why C-class addresses are the most common ones. First of all there are lots of them, and unless you are an institution with a couple of hundred thousand employees, you'll hardly be able to justify an A-class IP address.

Looking at the numbers above, there must be some scheme to calculate the number of networks and hosts per class and there must be some difference for each class. Indeed, there is. Each IP address consists of four octets or bytes separated by dots, such as 192.168.43.4. And in each address, there is a "class identifier," a "network part" and a "host part" encoded. For a C-class address, the host part is 1 byte long, for a B-class address it is 2 bytes and for an A-class address it is 3 bytes. The class identifier for class A is 1 bit, for class B 2 bits and for class C 3 bits. A little more graphically, it looks like this:

byte 1 byte 2 byte 3 byte 4

........ ........ ........ ........

0/////// -------- -------- -------- class A

10////// //////// -------- -------- class B

110///// //////// //////// -------- class C

1 0 actual values of the bits

/ bit used for network part

- bit used for host part

As you can see, a program can determine what class an IP address belongs to by checking at which place the first bit with a value of 0 is. And according to this information it then knows how many bits it should take for the network part of an address and how many bits for the host part. If we decode the address 192.168.43.4 we'll find that it is a C-class IP address; 192.168.43 is the network part and 4 is the host part, so this is host 4 in the network 192.168.43.

192 168 43 4

11000000 10101000 00101011 00000100

<-> class identifier

<------------------------> network part

<------> host part

I know you're already burning to know why a C-class only has 254 host addresses available, and not the full 256. If you calculated the number of hosts for the B- and A-classes too, you'll have realized that they are also smaller by two hosts from the theoretical maximum. The answer is that the lowest address, the one with all bits in the host part set to 0 is used to address the network itself, and the highest address, having all bits of the host part set to 1, is used as broadcast address, meaning all hosts in this net.

Everything clear? Ok then, we'll continue in the next issue with subnets.


© Algorithmica Japonica Copyright Notice: Copyright of material rests with the individual author. Articles may be reprinted by other user groups if the author and original publication are credited. Any other reproduction or use of material herein is prohibited without prior written permission from TPC. The mention of names of products without indication of Trademark or Registered Trademark status in no way implies that these products are not so protected by law.

Algorithmica Japonica

May, 1998

The Newsletter of the Tokyo PC Users Group

Submissions : Editor


Tokyo PC Users Group, Post Office Box 103, Shibuya-Ku, Tokyo 150-8691, JAPAN