IP Addressing Rules

In order to be certain that IP addresses are valid, there are a number of rules that must be followed. Be sure to pay particular attention to these rules, as they form the basis of determining valid IP addresses.

The first rule of IP addressing is critical. The host portion of an address cannot be set to all binary 0s or all binary 1s. When the host portion of an address is set to all binary 0s, it is used as a way of referring to that particular network. For example, consider the Class B address shown in the figure below, where the host portion is set to all binary 0s.

Figure: Host portion of an IP address in all binary 0s represents the network.

The IP address 131.107.0.0 is simply another way of saying “the 131.107 network”.
The requirement that the host portion of an address cannot be all binary 1s exists for a different reason. When the host ID is set to all 1s, it represents a broadcast on that particular network. For example, consider the Class C address in the figure below, where the host portion is set to all binary 1s.

Figure: Host portion of an IP address in all binary 1s represents a network broadcast.

In this example, the address 213.142.199.255 represents the broadcast address for the 213.142.199.0 network. Any packets sent to this special address are destined for all hosts on the 213.142.199.0 network.

Recall how we subtracted 2 when attempting to figure out how many hosts a given network could support – this was to account for when the host portion is set to all binary 0s or 1s, as I just described.

The second rule that you need to remember is the use of all binary 0s or 1s in the network portion of an address. When the network portion is set to all 0s, it is interpreted to mean “this network”. For example, the address 0.0.12.145 would be interpreted as “host 12.145 on this network”. When the network portion is set to all ones, for example 255.255.1.2, this is the same as saying “host 1.2 on all networks”. For the most part, you will not be manipulating the network portion of addresses in this manner – these designations will be used by the protocols, as per their programming.

The remaining rules are fairly simple. They include:

  • The network ID of 127.0.0.0 is reserved for diagnostics and testing. The address 127.0.0.1 is referred to as the loopback address
  • An IP address of all 0s (0.0.0.0) is used to represent the default route, or where all packets destined for unknown networks should be sent.
  • An IP address of all 1s (255.255.255.255) is used to represent a broadcast to all hosts on a network.
  • Network IDs of 224 and above in the first octet are not valid to assign to hosts, since Class D and E addresses are not valid for hosts.

The table below summarizes the IP addressing rules that we’ve looked at in this section.

Rule

Purpose

Example

Host ID cannot be all binary 1s This address represents a network broadcast 131.107.255.255
Host ID cannot be all binary 0s This address identifies a network 131.107.0.0
Network ID cannot be all binary 0s This address represents “on this network” 0.0.145.23
Network ID cannot be all binary 1s The address represents “ on all networks” 255.255.1.142
Network ID cannot be decimal 127 This address range is reserved for the loopback address 127.0.0.1
IP address cannot be all binary 0s This address is used to represent the default route 0.0.0.0
IP address cannot be all binary 1s This address is used to represent a broadcast 255.255.255.255
Network IDs of 224 and above in the first octet cannot be assigned to hosts Class D addresses are reserved for multicasting, while Class E addresses represent an experimental range 224.0.0.1

As a quick test, see if you can answer the following question. Is the address 47.203.191.0 valid to assign to a host? You may not have thought so, but answer is yes. Why? The fact that the address ends in a decimal value of 0 doesn’t make a difference. Since this is a Class A address, if you convert it to binary, you’ll notice that the host portion (the last three octets) is neither all binary 0s nor all binary 1s. This is just another example of why it’s so important to always consider addresses in binary. Try not to let assumptions based on what you see in decimal throw you off.

Author: Dan DiNicolo

Dan DiNicolo is a freelance author, consultant, trainer, and the managing editor of 2000Trainers.com. He is the author of the CCNA Study Guide found on this site, as well as many books including the PC Magazine titles Windows XP Security Solutions and Windows Vista Security Solutions. Click here to contact Dan.