IP Addresses And Subnet Masks

Addressing for intranets (and the Internet) explained
TCP/IP is the networking protocol of the Internet, and by extension of intranets. For TCP/IP to work, your network interfaces need to be assigned IP addresses. Note that we said network interfaces and not computers. The IP addresses are assigned to interfaces and not to computers. So, one computer can have more than one IP address. For example, if you have two network cards on your computer, then each of them can have a different IP address either static or dynamic (more about that in a minute). Similarly, if you have a proxy server running, then the machine on which it is installed should have a static IP address. Now, the same machine has to establish a dial-up link to the Internet through, say VSNL. Then the dial-up adapter would be assigned a different dynamic address.

What's an IP address?
An IP address is a number that represents a device like a network card uniquely on the Internet or on your company's intranet. This number is actually a binary one, but for convenience it's normally written as four decimal numbers. For instance, a typical IP address would be something like The four constituent numbers together represent the network that the computer is on and the computer (interface) itself. Let us first look at the network address part.
The IP addresses for networks on the Internet are allocated by the InterNIC. If you have an Internet connection (a registered domain and a permanent link to the Internet, and not just a dial-up connection), then you would be allocated a network address by the agency that registered you, like the InterNIC. Let us assume this to be, a class C network. Then all the machines on this network would have the same network address. And the last 0 will be replaced by a number from 1 to 254 for the node address. So, nodes will have addresses,, and so on up to would be worth mentioning here that IP address calculations and concepts make sense only when done in binary.

Types of networks and corresponding IP addresses
Depending on the size of the network, IP-based networks are divided into three classes.
Class A- Class A networks are mega monster networks with up to 224 nodes 16 million plus. Class A networks have their network addresses from to, with the zero's being replaced by node addresses.
Class B- Class B networks are smaller networks in comparison they can have only about 65,000 nodes! Network addresses for these ranges from to Here the last two zeros get replaced by the node addresses.
Class C- These are the baby networks that can have only 254 nodes at the maximum. The network IP addresses for these range from to

For a given network address, the last node address is the broadcast address. For example, for the C class network with address, the address is the broadcast address, used to transmit to all nodes in that network. So, this address along with the network address itself should not be used as node address.If you want your network to be permanently on the Internet, then you need to be allocated a network address by the InterNIC. Most of the network addresses now available for allocation are class C addresses.There are other classes of networks class D and class E. These are primarily used for experimental purposes.

Introducing subnet masks
In an IP network, every machine on the same physical network sees all the data packets sent out on the network. As the number of computers on a network grows, network traffic will grow many fold, bringing down performance drastically. In such a situation, you would divide your network into different subnetworks and minimize the traffic across the different subnetworks. Interconnectivity between the different subnets would be provided by routers, which will only transmit data meant for another subnet across itself. To divide a given network address into two or more subnets, you use subnet masks. The default subnet masks for class A networks is, for class B is, and for class C is, which signify a network without subnets.

Which class of network? Which IP address?
The InterNIC has (RFC 1597 Address Allocation for Private Internets) allocated particular blocks of network addresses for use in intranets. These IP addresses don't conflict with those of existing Internet hosts and will not be handed out for use on the Internet.
The address blocks are:
Class A:
Class B: From to
Class C: From to

Computers on networks using the above IP addresses will be treated as private ones and they can communicate only within the company intranet. However, they can still access the outside world using proxy servers. This adds to the security of your intranet. So, your intranet should always use addresses from these reserved groups only.

Now, which IP address class should you use for your intranet?The answer depends on the number of hosts that are going to be connected to the intranet. Any machine connected to the network, whether server or client, is called a host.
Without subneting, you can have the following configurations.

No of machines to be connected Class of network Network addresses
254 or less C to
255 to 65,534 B to
65,535 to 16,777,214 A

Thus, if you are having a class C network that is not permanently connected to the Internet, your network address can be any one from to, and without subneting, you can have 254 hosts having addresses to, if you have selected as your network address; is the broadcast address and is the network address for this network.

Dynamic IP addressing Vs Static IP addressing
In assigning IP addresses to machines, you have two choices. You can either go around typing in the individual address on each machine or you can setup one machine to assign IP addresses to the others. The second one called dynamic addressing is preferred for three reasons. First, it makes the job of administering the network such as adding new clients, avoiding IP clashes, etc a lot easier. And second, since only those machines that are switched on will need an IP address, you could potentially have more machines on your network with dynamic addressing, than you could with static addressing. Finally, mobile computing has become an everyday reality, and notebook computers have a likelihood of moving from one network to another or from one subnet to another. In such a situation, if you have static IP addressing, you have to reconfigure the machine every time you move it something that is eminently avoidable.
You do dynamic addressing with DHCP (Dynamic Host Configuration Protocol). To make DHCP work on your network you have to set up a DHCP server.

Calculation of IP addresses and subnet masks is no job for the binary challenged. A handy tool which will do all this for you is the IP Subnet calculator, a freeware tool from the Net3 Group. It is available on the PCQ July 97 CD-ROM.

An example in subnet design
Warning: You can safely ignore this section and use the IP subnet calculator instead. Remember that all this is done in binary. If you are curious as to what happens behind the scenes, here it goes.

We will consider a class C network being subneted.
First of all you have to decide how many subnets you want to have. This can be along functional lines like different subnets for accounts, sales, and marketing etc. You also need to know the number of hosts that the largest subnet is to support. And remember to keep future needs in mind.

Assume that the network address chosen for your intranet is, and that you want seven subnets, with the largest one having 20 hosts.Since you are dealing with binary numbers, subnets can be created only in blocks of powers of two. That is you can have two subnets, four, eight, 16, and so on. In this case you choose eight subnets, which will also give you one free subnet for future use. Your IP address is a 32-bit binary number. Out of this the first 24 bits (8 x 3) have already gone for the network address. Now you have to set aside the next three (8 = 23 ) for subneting. That leaves you with 32-24-3 = 5 bits for host addresses. With five bits you can have 25 = 32 individual IP addresses for the hosts. Of these, two all 1s and all 0s cannot be assigned to hosts. The all 0s host number identifies the base network or the subnet while the all 1s host number identifies the broadcast address of the network or subnetwork. So, you can have a maximum of 30 hosts on each subnet.

If you want more than 30 hosts on a subnet, what would you do? Reduce the number of subnets or go for a higher class of network. Remember that the maximum number of hosts on a class C network is 254 (after subtracting the broadcast address and the network address), and with every subnet, you are reducing that number by two. (8 x 30) + (7x2) = 240 + 14 = 254.

Now we come to the binary numbers.
Network address = = 11000000.10101000.00000001.00000000
Default subnet for class C = = 11111111.11111111.11111111.00000000
Adding 8 subnets = 11111111.11111111.11111111.11100000

Converting this to binary, the required subnet mask is (11100000 in binary is 224 in decimal notation).
The subnets are numbered 0 to 7. The subnet is defined by replacing the three most significant digits ( first three from left) of the last octet in the network address with the binary representation of the subnet number. Thus,
Subnet 0 will be 11000000.10101000.00000001.00000000 =
Subnet 1 will be 11000000.10101000.00000001.00100000 =
Subnet 2 will be 11000000.10101000.00000001.01000000 =
Subnet 3 will be 11000000.10101000.00000001.01100000 =
Subnet 4 will be 11000000.10101000.00000001.10000000 =
Subnet 5 will be 11000000.10101000.00000001.10100000 =
Subnet 6 will be 11000000.10101000.00000001.11000000 =
Subnet 7 will be 11000000.10101000.00000001.11100000 =

A quick check on your calculations is that the fourth octet (in decimal) of all subnets will be multiples of the fourth octet (in decimal) of subnet 1.As originally defined, subnets with all 0s and all 1s subnets 0 and 7 in this case were not to be used. But today's routers can overcome this limitation.

Now we come to the host address for each of the subnets. Hosts are numbered from 1 onwards as against subnets which as we saw are numbered from 0 onwards. In this case, we have 30 hosts in each subnet, and they will be numbered from 1 to 30. To arrive at the host IP address, replace the host portion of the relevant subnet address (the last five digits of the fourth octet in this case) with the binary equivalent of the host number.Thus, the IP address of host number 3 on subnet 1 will be 11000000.10101000.00000001.00000011 = and that for host number 30 in subnet 6 will be 11000000.10101000.00000001.11011110 = broadcast address for subnet 4 is 11000000.10101000.00000001.10011111 =, which is one less than the subnet address of subnet 5.