Choosing IP Addresses for Your Network: Choosing IP Addresses for Your Network
Articles and Tips:
01 Feb 1997
To set up an intranet, you must properly configure eachhost(theterm used for any node on a TCP/IP network) with an IP address and a subnetworkmask. You can assign these values manually, or you can assign these valuesautomatically through a Dynamic Host Configuration Protocol (DHCP) server.(For information about DHCP servers, see the related article, "IntranetWare:Transforming Your IPX Network Into an Intranet.") Because the IP addresses and subnetwork masks you assign determine whether or not eachhost on your intranet can communicate, you must understand how to assignan IP address and a subnetwork mask.
ONE HOST, ONE ADDRESS
Each host on your network must have a unique IP address, and if you willbe connecting your network to the Internet, you must ensure that these hostshave an Internet-unique IP address. To ensure that IP addresses are Internetunique, an agency called the Internet Assigned Numbers Authority (IANA)regulates IP address assignments.
In the early days of the Internet, if you wanted to get some unique IPaddresses, you applied directly to the IANA. To handle the many users onthe Internet today, however, the IANA has assigned blocks of numbers toInternet service providers (ISPs), which then allocate IP addresses to theircustomers.
THE BASIC FORM OF AN IP ADDRESS
IP addresses are ordinarily written as a sequence of four decimal numbersseparated by periods, with each decimal number in the range between 0 and255. For example, 220.127.116.11 is a typical IP address.
In binary form, each of the four decimal numbers is represented by 8bits called an octet. For example, the binary form of the first decimalnumber in the previous example address (198) is 11000110. A complete IPaddress (four octets) is a 32-bit binary number. The complete binary formof 18.104.22.168 is 11000110.10101000.00101101.11111001. Using a 32-bitnumber allows for 4,294,967,296 unique IP addresses--more than enough forany private intranet (although the Internet might soon run out of uniqueIP addresses).
By default, each IP address is divided into a network number and a hostnumber. The network number is similar to an IPX network number. Just aseach LAN segment on an IPX network must have a unique IPX network number,each LAN segment on a TCP/IP network must have a unique IP network number.
Understanding binary numbers in IP addresses would be easier if the numberof bits used to represent the network number and the number of bits usedto represent the host number were always the same. However, the number ofbits used to represent each number varies, depending on whether the addressis a Class A, Class B, or Class C address: The network number can be thefirst 8, 16, or 24 bits; the host number can be the last 24, 16, or 8 bits.
ADDRESS CLASSES, NETWORK NUMBERS, AND HOST NUMBERS
The value of the first octet in an IP address determines whether theaddress is a Class A, Class B, or Class C address. This value also determinesthe default number of bits in the address that are used to represent thenetwork number and the host number.
If the value of the first octet in an IP address is a number from 1 to126, the address is a Class A address. In this case, the first octet (8bits) specifies the network number, and the last three octets (24 bits)specify the host number. For example, the IP address 22.214.171.124 representsthe network number 102 and the host number 56.187.5.
If the value of the first octet in the IP address is a number from 128to 191, the address is a Class B address. In this case, the first two octets(16 bits) specify the network number, and the last two octets (16 bits)specify the host number. For example, the IP address 126.96.36.199 representsthe network number 154.2 and the host number 91.240.
Finally, if the value of the first octet in the IP address is a numberfrom 192 to 223, the address is a Class C address. In this case, the firstthree octets (24 bits) specify the network number, and the last octet (8bits) specifies the host number. IP addresses with first octet values of0, 127, and 224[shy ]255 are reserved, as explained in the next section.
Because only the first octet in a Class A address is used for the networknumber and the value of the octet must be between 1 and 126, only 126 ClassA networks can exist on any network.
Reserved Host Numbers
Although the number of bits used to specify a host number may be 8, 16,or 24 bits, depending on the address class, two host numbers are alwaysreserved:
The number that results when all of the bits in the host number of the IP address are set to zero (zero)
The number that results when all of the bits in the host number of the IP address are set to one (a number that varies with the number of bits)
The two reserved host numbers have special uses: An IP address with ahost number of zero is used as the address of the entire network. For example,for a Class C network with the network number 199.60.32, the IP address188.8.131.52 indicates the entire network.
If all of the bits in the host number of the IP address are set to avalue of one, a broadcast message will be sent to every host on the network.For example, suppose that a host on a Class C network with the network addressof 184.108.40.206 wanted to send a message to all of the other hosts on thenetwork. The host would send this message to 220.127.116.11.
After subtracting the reserved host numbers in a Class A network, 16,777,214unique hosts are possible.
Addressing Recommendations and Requirements
You must ensure that each LAN segment on the same network uses a uniquenetwork number. You can use different network numbers on the same LAN segment,but we suggest that you give all of the hosts on the same LAN segment thesame network number. In addition, all of the hosts that use the same networknumber must have a unique host number.
If you observe these rules, hosts that share the same network numbercan communicate without a router. Hosts with different network numbers mustcommunicate through a router, even if they are on the same LAN segment (inthe event that you assign different network numbers to hosts on the samesegment).
TOO MANY HOSTS SPOIL THE PARTY: SUBNETWORKS TO THE RESCUE
Although you must assign each LAN segment a different network number,using all of the available IP addresses on this network would be impossible.For example, to use all of the 16 million IP addresses available in a singleClass A network, you would have to confine the 16 million available IP addressesto one LAN segment. Even if building such a network were physically possible,the sheer volume of traffic on the segment would make it unusable. Evenwith Class C addresses, connecting 254 hosts on one segment may be too many.To get around the"one segment, one network number"requirement,IP addressing allows you to organize your hosts into subnetworks.
For example, suppose that I had been assigned the Class B address 18.104.22.168for my department's network. The 65,534 host numbers available in this ClassB address would be more than enough to assign a unique IP address to eachhost.
However, suppose that my department's network were configured as threeLAN segments connected by a router, as shown in Figure 1. Although I had been assigned only one Class B address (22.214.171.124),changing the network's configuration to attach all of the hosts on one segmentwould not be an option. I could solve this problem by creating subnetworksunder the 126.96.36.199 network address and assigning a different subnetworknumber to each LAN segment.
Figure 1: This network would require three unique network numbers or a network number divided into subnetworks.
Creating Subnetworks by Specifying a Subnetwork Mask
To create a subnetwork, you divide the default number of bits assignedfor the host number of an IP address into two fields: a subnetwork numberfield and a new (smaller) host number field. (Essentially, you take someof the bits assigned for the host number and use these bits for a subnetworknumber.) The resulting IP address contains a network number, a subnetworknumber, and a host number.
To specify how you will divide the default number of bits assigned forthe host number, you use a subnetwork mask--a 32-bit number that has thesame form as a complete IP address (but is separate from the IP address).The subnetwork mask specifies how many bits from the default host numberare to be used as the subnetwork number, and how many bits are to be usedas the new (smaller) host number.
Each IP address class (A, B, and C) has a default subnetwork mask. Forexample, for a Class C address, the default subnetwork mask is 255.255.255.0.
In the default subnetwork mask, the bits in all of the bit positionsthat correspond to the bits used for the network number of the IP addressare set to the value of one. The bits in all of the bit positions that correspondto the bits used for the host number of the IP address are set to the valueof zero. For example, in a Class C address, the first three octets are usedfor the network number. In the default subnetwork mask then, the first threeoctets are set to the value of one.
If all 8 bits of the last octet in a Class C subnetwork mask are zero,all 8 bits in the last octet of the corresponding IP address are to be usedfor the host number--there are no subnetworks. The default subnetwork maskfor each address class always indicates that there are no subnetworks. (Fora Class A address, the default subnetwork mask is 255.0.0.0, and for a ClassB address, the default subnetwork mask is 255.255.0.0.) Figure 3 (image unavailable) shows both the decimal and binary forms of an IP address for eachaddress class, and the binary form of the default subnetwork mask for eachaddress class.
To create subnetworks, you have to change the default subnetwork maskfor the address class. To create a subnetwork number, you specify the bitpositions in the IP address' host number that you want to use for the subnetworknumber. To specify these bit positions, you set the bits in the correspondingsubnetwork mask bit positions to the value of one. You use bits startingfrom the leftmost (high-order) portion of the default host number. You leavethe bits in the remaining bit positions in the subnetwork mask set to zero--indicatingthat the remaining bit positions in the IP address' host number are to beused as the new (smaller) host number.
For example, suppose that you wanted to use three bit positions of thehost number of a Class C address (the 3 high-order bits of the last octet)as the subnetwork number. You would set the bits in the three high-orderbit positions in the last octet of the subnetwork mask to the value of one.
The remaining 5 bits of the octet would designate the host number--youwould leave these bits set to the value of zero. The binary notation forthe last octet of the subnetwork mask would be 11100000 (in decimal notation,224). Figure 4 shows a complete subnetwork maskin both decimal and binary forms for a Class C address.
Figure 4: In this subnetwork mask for a Class C address, the 3 high-order bits of the last octet are set to the value of one, indicating that these bits will be used as a subnetwork number.
When you specify a subnetwork mask, you can assign IP addresses to hostsand create subnetworks by specifying different values in the subnetworknumber of the IP addresses for different hosts.
An Extended Example
Suppose that I wanted to assign IP addresses to the hosts on the threeLAN segments shown in Figure 1, but I had onlyone Class B network address to use. At a minimum, I would need three subnetworks--onefor each existing LAN segment. Since I might eventually have as many as12 LAN segments, however, I would allow for 12 subnetworks in my availablesubnetwork number range.
First, to figure out my subnetwork mask, I would need to determine howmany bits of the default host number were needed to create as many as 12subnetwork numbers. In a subnetwork number, every available bit cannot beset to the value of zero or to the value of one. Thus, if I chose to use3 bits of the default host number for a subnetwork number, I could havea maximum of six subnetworks. Using 3 bits would provide me with enoughsubnetworks for my current network but would allow for only three additionalsubnetworks. A 4-bit subnetwork number would allow me to have as many as14 subnetworks, so I would use a 4-bit subnetwork number.
With a Class B address and a 4-bit subnetwork number, my subnetwork maskwould be 255.255.240.0 as shown in Figure 5. I would specify this subnetwork mask during the configuration of every hoston my network (regardless of which subnetwork the host is on).
Figure 5: Determining IP addresses when using subnetworks
Using 4 bits of the 16-bit default host number for the subnetwork numberwould leave 12 bits available for the actual host number. With a 12-bithost number, I could assign 4,094 unique host numbers in each subnetwork.
To find out the total number of available IP addresses, I would multiplythe 14 subnetworks by the 4,094 hosts per subnetwork, resulting in 57,344IP addresses. This number is 8,190 fewer IP addresses than are availablein a single Class B network without subnetworks. In other words, you payfor the convenience of subnetworking by losing IP addresses. Figure 6 (image unavailable) shows the IP addresses available for a Class C network that uses a3-bit subnetwork number. As you can see, many IP addresses are no longeravailable.
Now suppose that I wanted to assign the server shown in Figure 2 the host number 14 in subnetwork number 3. Figure 5 shows the process for assigning the server's actual IP address. Iwould start with the base network number (134.234) and add the necessaryvalues for the last two octets. First, I would specify the subnetwork numberusing the 4 high-order bits of the third octet (subnetwork number 3 = binary0011). Then I would specify the host number using the last 4 bits of thethird octet and all 8 bits of the last octet (host number 14 = binary 000000001110). If I then took the resulting complete binary number and expressedeach of the octets separately in decimal form, I would get the server'sIP address (188.8.131.52).
PRIVATE VERSUS INTERNET-UNIQUE IP ADDRESSES
What IP addresses should you choose if an ISP does not assign you theseaddresses? If you are certain that you will never connect your network tothe Internet, you can choose any IP addresses, as long as you observe theIP addressing rules outlined in this article. To keep things simple, I suggestthat you use Class C addresses, so you can avoid having to determine thenecessary subnetwork mask and calculate the correct IP address for eachhost.
Assign each LAN segment its own Class C network number. Then you canassign each host a complete IP address simply by appending the decimal hostnumber to the decimal network number. With a unique Class C network numberfor each LAN segment, you will have 254 available host numbers per segment.
If there is even a remote possibility that you will eventually connectyour network to the Internet, you should not use IP addresses that mightresult in address conflicts when you do connect to the Internet. To preventsuch address conflicts, you can either ask an ISP for Internet-unique IPaddresses or use IP addresses reserved for private networks.
The preferred method of preventing address conflicts is to get Internet-uniqueIP addresses from an ISP. In this way, you ensure that when you connectyour network to the Internet, none of your IP addresses will be used anywhereelse on the Internet. Many ISPs will provide IP addresses to companies evenif the company has only a dial-up modem account. However, some ISPs willnot assign you IP addresses if your network is not connected to the Internetinitially. Even if an ISP is willing to assign you IP addresses, you willprobably have to pay a fee.
Nevertheless, using Internet-unique IP addresses is the best option becausewhen you do connect to the Internet, you will probably not need to reconfigurehosts, and setting up a gateway between your network and the ISP's networkwill be simple.
The other method of preventing IP address conflicts on the Internet isusing addresses reserved for private networks. The IANA has reserved severalblocks of IP addresses for this purpose. You can choose from a Class A network address, a Class B networkaddress, or 256 Class C network addresses.
Hosts on the Internet are not supposed to be assigned reserved IP addresses.Thus, if you do eventually connect your network to the Internet, even iftraffic from one of the hosts on your network somehow gets to the Internet,there should be no address conflicts. Furthermore, reserved IP addressesare not routed on the Internet because Internet routers are programmed notto forward messages sent to or from reserved IP addresses. In fact, yourown Internet gateway should prevent this communication. Thus, when you doconnect your network to the Internet, your hosts that are using reservedIP addresses are not likely to cause address conflicts.
The disadvantage of using IP addresses reserved for private networksis that when you do connect your network to the Internet, you will haveto reconfigure the hosts that want to communicate on the Internet. You willeither have to reconfigure each host with an Internet-unique IP address,or you will have to configure the connecting gateway as a proxy to translatethe reserved IP addresses into Internet-unique IP addresses that you havebeen assigned by an ISP. (For more information about IP addresses reservedfor private networks, read RFC1918 at http://ds.internic.net/rfc/rfc1918.txt.)
Terry L. Jeffress works for Niche Associates, an agency that specializesin technical writing and editing.
* Originally published in Novell Connection Magazine
The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.