id="info"

Networking

Getting to know your IP addresses

Knowing how an IP address identifies a host on a network can be confusing. Before you begin calculating various addresses, you should know the fundamentals of IP addressing. Todd Lammle describes this concept in an easy-to-understand fashion.


The Internet Protocol (IP) was developed in the 1960s to provide packet fragmentation and reassembly across a packet-switched network. This packet-switched network became what we now call the Internet.

IP addressing is used to uniquely identify hosts on an internetwork. An internetwork is made of LANs and WANs that are connected with a router or routers. To send data from a host on network A to a host on network B, a logical network addressing protocol must be used. IP is the most popular logical addressing protocol. However, IPX in the Novell stack and Datagram Delivery Protocol (DDP) in the AppleTalk stack can also be used. Although you can find many other types of routed protocols that provide the same functionality as IP, they aren’t as efficient as IP in larger networks.

The dreaded IP address
Before we conquer IP addresses, I want to define some of the terminology used in this Daily Drill Down:
  • Bit: One digit; either one or zero.
  • Byte: 8 bits. This term is interchangeable with octet.
  • Octet: 8 bits. This term is interchangeable with byte.
  • Network address: Address with all host bits turned off.
  • Broadcast address: Address with all host bits turned on.

To fully understand IP addressing, you must be familiar with binary-to-decimal conversion. To find the decimal equivalent of a binary number, you must add the binary values. Binary numbers use eight bits to create a byte. Each bit in the byte has a certain value, and if a bit is turned on (assigned a value of 1), then the byte takes on that decimal value. Each bit has a value that starts at 1 and doubles in value from right to left. Table 1 shows an example of converting a byte to a decimal value.

Table 1
128 64 32 16 8 4 2 1 Decimal value
0 0 0 1 1 0 1 0 Binary number
This table shows an example of converting a byte to a decimal.

In the above example, there are three bits that are turned on (1s). Add each of these values to get the bytes decimal value (16+8+2=26). Let’s take a look at another example in Table 2.

Table 2
128 64 32 16 8 4 2 1 Decimal value
0 1 1 0 1 0 0 0 Binary number
In the above example, there are three bytes that are turned on (64+32+8=104).

The IP address
IP addressing is not hard-coded into a machine. It is known as a software or logical address because of the way an administrator must statically configure each host (either manually or with DHCP). The basic design of an IP address allows hosts on different networks to communicate with each other, regardless of the type of network on which they are located.

The IP address is 32 bits long and is divided into dotted decimal. An example of an IP address is: 10.205.34.2. Each of the decimals is known as a byte and is 8 bits long. Therefore, an IP address is 4 bytes, or 32 bits long.

An IP address is hierarchal in design and is divided into two parts: network and host. An IP address not only defines the host on the internetwork but also describes the network on which the host is located. In the example above, 10 is the network and 205.34.2 is the host address.

The job of a router is to get packets to a network using the logical address. To get a packet to a host, the hardware address is used. If a packet has a destination IP address of 10.205.34.2, the routers in the internetwork will forward the packet to network 10. If the routing tables do not have an entry for network 10, the routers will discard the packet.

An IP address can only be configured within certain ranges. Although an IP address can be displayed in decimal from 0.0.0.0 to 255.255.255.255, only certain addresses can be used to configure hosts on an internetwork. It is imperative that you can look at an IP address and know whether it’s a valid host address.

Classes of IP addresses
The original designers of the IP stack came up with a hierarchical addressing scheme with five ranges, called classes. These ranges are named:
  • Class A: IP address range from 0-127 in the first byte designed for very large companies.
  • Class B: IP address range from 128-191 in the first byte designed for medium-size companies.
  • Class C: IP address range from 192-223 in the first byte designed for small companies.
  • Class D: IP address range from 224-239 in the first byte reserved for multicast addressing. Not used in the public sector.
  • Class E: IP address range from 240-255 in the first byte reserved for scientific studies. Not used in the public sector.

Class A
In the four-byte Class A IP address, only the first byte is used to identify the network. The last three bytes are used to describe the hosts on each network: network.host.host.host. The Class A range is 0-127 in the first byte. Only 1-126 can be used to identify Class A networks because 0 and 127 are reserved.

To find the valid host addresses in a Class A network, you must find the network and broadcast address in the IP range. Since the Class A address only uses the first byte to identify the network, the last three octets are host bits.

To find the network and broadcast address, turn off the host bits and then turn them on again. For example, if we want to use the Class A network address of 10, the network address, broadcast address, and valid hosts are determined as shown:
  • 10.0.0.0 is the network address because all of the host bits are turned off (0). The last three octets are zeros because the first octet is a 10, which is in the Class A range of 1-126.
  • To find the broadcast address of the IP address, turn on the host bits: 10.255.255.255.
  • The valid hosts are the numbers in between the network address and the broadcast address: 10.0.0.1 through 10.255.255.254.

Class B
The Class B range is 128-191. For example, if you find an IP address that begins with 152, then you know that it’s a Class B address. Class B addresses use the first two bytes to define the network and the last two bytes to define the hosts on each network: network.network.host.host.

For example, in the IP address 152.93.10.5, 152.93 is the network address and 10.5 is the host address. In this example, what are the network address, broadcast address, and valid host range? Remember, all you have to do is to find the host bits and turn them all off and then turn them all on. In a Class B address, the host bits are the third and fourth octets by default.
  • 152.93.0.0 is the network address (all host bits off).
  • 152.93.0.1 is the first valid host.
  • 152.93.255.254 is the last valid host.
  • 152.93.255.255 is the broadcast address (all host bits on).

Class C
In a Class C IP address, only the fourth octet is used to address hosts. The first three octets are used to define the network: network.network.network.host.

An example of a Class C address is 200.10.10.59. By glancing at this address, you can see that the network address is 200.10.10 and the host address is 59. To find the valid host range, turn all of the host bits off and then turn them on.
  • 200.10.10.0 is the network address because all host bits are off.
  • 200.10.10.1 is the first valid host.
  • 200.10.10.254 is the last valid host.
  • 200.10.10.255 is the broadcast address because all host bits are on.

Subnet masks
Subnet masks are used in IP configurations to tell hosts on the network which part is the network address and which part is the host address of an IP address. You cannot configure an IP address on a host without also configuring the subnet mask information.

Remember that a Class A IP address uses only the first byte to describe the network address and three bytes to describe the host addresses. In a subnet mask, the network portion consists of all ones (1s) and the host portion is all zeros (0s). Therefore, a default Class A subnet mask must be 255.0.0.0. Since the entire first byte is the network portion and must be all 1s, the decimal value is 255. IP will examine this mask to determine the host and network bits in an address.

In a Class B IP address, the first two bytes represent the network portion and the last two bytes are the host portion. Therefore, the default mask is 255.255.0.0.

In a Class C IP address, the first three bytes represent the network portion and the last byte is the host portion. The default mask is 255.255.255.0.

This is an example of a Class A configuration of a host where 10 is the network address and 59.135.4 is the host address:
10.59.135.4
255.0.0.0


This is an example of a Class B configuration of a host where 130.59 is the network address and 135.4 is the host address:
130.59.135.4
255.255.0.0


Here is an example of a Class C configuration of a host where 210.59.135 is the network address and 4 is the host address:
210.59.135.4
255.255.255.0


The default gateway address is typically configured but is not required. It is the router address on the network. If no default gateway address is configured on the host, the host won’t be able to communicate outside its own local network.

Conclusion
In today’s computing age, IP addressing is critical in every network. To become certified in any network program, you must have a fundamental understanding of IP addressing. If you want a networking job, it’s imperative that you’re familiar with IP addressing. You should be able to determine a valid IP address just by glancing at the IP address and mask. To do this, you must be able to quickly and efficiently determine what the network and broadcast addresses are.

Editor's Picks