Next Previous Contents

2. IP addresses and host names

2.1 IP address and subnet mask

The first problem encountered is how do I address a computer. Just as we give names to people, each computer recieves a unique IP address. For example, my computer is Given that number, anyone on the Internet can reach out and touch my computer, except my computer probably won't respond. For people with dialup Internet access, you're IP address changes each time you connect.

An IP address is refresented by 4 numbers, delimited by periods. The range for each number is 0-255. For those computer savvy people, you realize that these are 8 bit integers. Basically, each IP address is just a 32 bit field, but to make it easier for humans to understand, it is broken down into 4 8-bit integers. For those not so computer savvy, this means that the valid range of IP address is to This notation is also called "dotted decimal notation".

Back in the days before 386's and 286's (yes, you were born), the people who made the internet had to decide how to give out these IP addresses. What they arrived at is to slice up the consecutive IP addresses into groups. Then, when someone wanted IP addresses, they woul be handled a group of IP addresses.

Essentially, there are 3 groups or classes: A, B, and C. The different classes only differ in the number of IP addresses in each group. For example, MIT has a class A network 18.*, this means that they "own" all IP addresses from to This translates to enough IP addresses for 16,581,375 computers. 16 million computers is probably enough for a city, let alone a school. But in reality this wide range of addresses is used to build a good structured network with a couple of subnets. Class B networks are smaller, with 65,025 IP address. Class C networks, the smallest, have 255 addresses. For those of you who want more current information check out RFC 1918.

Class Netmask       Network Addresses
  A    -
  B  -
  C  -
Multicast  - 

The Netmask is the part of a network address that defines the netblock. The netmask might seem pretty odd with all the 255's. To make sense, it needs to be converted to binary.

               Dot Notation    Binary notation
Netmask       1111-1111-0000-0000-0000-0000-0000-0000
Subnet Mask     1111-1111-1111-1111-0000-0000-0000-0000
IP        0001-0010-1111-0010-0000-0011-0010-1010

Here the netmask shows that for the IP, the Net part is 18. Basically this shows that 18.* is a netblock, more specifically a Class A netblock.

The next question is to know what is the network part of an IP address and what the host part (the network part is the same for all computers within the same subnet). You've to define a special number in IP address format, the subnet mask. Combine this number by a logical AND with the IP address and the result is your network address:

     IP address
AND subnet mask
network address

2.2 Valid IP-address ranges for local networks

And there are some address ranges reserved for private LAN's. If you use such an address range for your TCP/IP LAN you won't have any conflict with internet addresses:    -  (Class A network)  -  (Class B network) - (Class C network)

There are however, many special IP addresses. For example is referred to as the loopback address. Basically, anything sent to, is never actually sent out, but returned back. The purpose of this is for people to test their network services, such as their web server. There are some other special ips for special uses, such as the broadcast ip.

2.3 Host names

Now, let's assume that every computer has an IP address, and everyone is happily connected. I can now get school info from Check my mail at Grab gaming news at This is all fine and dandy if we could remember numbers all that well. Could you imagine a company advertising their website as a set of 4 numbers? People don't want to type in to go to Yahoo.

The solution was to use hostnames. So now, Yahoo can advertise their website as and not an IP address. However, the Internet still runs on TCP/IP, so there must be a way of converting a hostname (ie. to a IP address (ie. To do this, your computer goes through several sources, the two important ones being the HOST file (on WIN95/98/NT) and the DNS server.

The DNS server is a computer who's duty it is to remember hostnames and their IP address. When you tell your web browser to go to, your computer realizes that it doesn't know Yahoo's IP address, so it asks the DNS sever what the IP address is. The DNS server then goes through it's database to see if it knows.

If it does, it tells your computer IP address for Well, what happens if it doesn't? That's where the great fun of internet regulation comes in.

2.4 Host names and domains

A name, such as, breaks down into 2 sections: the host name, and the domain name. The host name is basically everything before the first ".". For, it is the www. Everything else is called the domain name -- here, the part.

For longer ones, such as, the phobos is the hostname, and the is the domain name. One difference between hostname and domain name is who controls them. Domain names have to be registered with an Internet regulation company, generally InterNIC. Where as host names can be given at liberty by the owners of the domain name.

The DNS (Domain Name Service)

Let's say that you wanted to start a web server called, "". Then you would have to register "" with InterNIC. After that, you would have to setup a DNS (technically 2, due to a bunch of weird regulations) for "". The reason for this, is that if someone is going to "", but the DNS realizes that it doesn't know what is. Then it checks to see if it knows If it also doesn't know that, it asks the top level DNS servers, what the ip to the DNS for is. Then using that, it asks's DNS what the IP to is.

Hosts file

Now let's say that you want to locally access your own web server, but you don't like to type in http://localhost/ or Instead, you would much be happier typing in http://popcorn/. Well, generally this means that you would put an entry into the DNS that points popcorn to your IP address. But most people don't have acceess to change the DNS, or you might not be connected to the network at that time.

If you're running Win95 or WinNT, there is the HOSTS file in the windows directory, that basically acts like a DNS. In the file, it lists IP addresses, and their related name. Whenever you type in a name into your web browser, the OS goes throught the HOSTS file before it starts using any DNS; however, since this local file, the entries in this file only affect your computer.

IP Address         HostName        Alias1        Alias2          localhost       popcorn

So if you want to locally access your computer as pi3, then you would add an entry that points pi3 to

Next Previous Contents