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.
The IP address 184.108.40.206 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.
In this example, the address 220.127.116.11 represents the broadcast address for the 18.104.22.168 network. Any packets sent to this special address are destined for all hosts on the 22.214.171.124 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.
|Host ID cannot be all binary 1s||This address represents a network broadcast||126.96.36.199|
|Host ID cannot be all binary 0s||This address identifies a network||188.8.131.52|
|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||184.108.40.206|
As a quick test, see if you can answer the following question. Is the address 220.127.116.11 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.