A course in TCP/IP
networking
Part 3: The IP
address
The Version 4 IP (Internet Protocol) address consists of a 32 bit (4 byte) number. Each network adapter that will be used on a network must have a unique IP address on that network. Each adapter connected to the Internet must have an IP address that is unique in the world.
An IP address for a host could be represented by:
11100010011101111000000100010010
This IP address is divided into the host portion and the network portion of the address. The network portion is the leftmost part of the IP address, and the host portion is the remaining, rightmost portion of the address. The part of the IP address assigned to the network and host is indicated by the netmask, discussed later.
If, for example, the host portion of the IP address is six bits then the network portion is the remaining 26 bits. In this example they have been physically separated for clarity:
11100010011101111000000100 │ 010010
network portion host portion
The network portion of the IP address is unique to the network, and all hosts on the same network have the same network portion of the IP address. The host portion of the IP address is unique to the host, and each host on one network has a different host portion of the IP address. The network itself also has an IP address, commonly called the network number: the network portion of this address is the same network portion attached to all hosts on the network, while the host portion is entirely composed of zeros.
The network address of this host’s network would be:
11100010011101111000000100 │ 000000
network portion host portion
As this example shows, the network portion of the network IP address and of the host IP address on the network are identical. The host portion of the network IP address is entirely zero, which indicates that this is a network address.
A host IP address is applied to an adapter, which is any device on a computer that listens and transmits over the network. A computer may therefore have many IP addresses, each associated with an adapter.
A network IP address is associated with a network but not with any specific device on the network. A network may have only one network IP address.
Writing IP addresses
It is impossible for a human to visually take in 32 bits written as a single string, so IP addresses are usually written with dots separating the bytes:
11100010. 01110111.10000001.00010010
is the host IP address and
11100010. 01110111.10000001.00000000
is the network IP address shown in earlier examples.
This makes the IP address easier to see, but the location of the byte boundaries is not essential to the separation of the IP address into host or network portions or for the computer’s use of the IP address. The dots are present only to simplify the IP address for human use.
The IP address can be further simplified for writing by translating the binary used by the computer into decimal notation. In decimal the above address would translate to the familiar format:
226.119.129.18
for the host IP address and
226.119.129.0
for the network IP address.
Host and network portions
of the IP address
With 32 places in binary it is possible to enumerate 232 or about 6 billion hosts with IP addresses, starting with 00000000. 00000000. 00000000. 00000000 (0.0.0.0) and ending with 11111111. 11111111. 11111111. 11111111 (255.255.255.255). This collection of numbers is called the IP address space. For organizational and historical purposes the IP address space includes some reserved addresses that are never used to enumerate actual hosts on a network, including 0.0.0.0 and 255.255.255.255!
The division between the host and network portions of an IP address are distinguished with a 32 bit value called the netmask. A netmask in traditional format looks like an IP address but is meaningless without an association with an IP address or collection of IP addresses. It only distinguishes the network and host portions of the address or addresses to which it is attached.
A netmask in traditional format has the value 1 in any place in the IP address used for the network number, and a 0 in any place used for the host number. For the IP address used above, where the last six places are used for the host number, the traditional netmask would be:
11111111.11111111.11111111.11000000
In decimal this would be written 255.255.255.192.
The netmask can also be written in slash notation. Slash notation is now the preferred netmask format. In slash notation, an IP address is followed by a forward slash (/) and the number of bits of the IP address used for the network number. Using this format, the above host IP address would be written:
11100010. 01110111.10000001.00010010/26
and the network IP address would be written:
11100010. 01110111.10000001.00000000/26
or in decimal:
226.119.129.18/26
and
226.119.129.0/26
since 26 bits of the IP address are used for the network number.
Practice Problems:
1. Translate the following IP addresses into decimal:
a. 11101101.00101101.10110111.00000100
b. 10000110.11011101.01110100.11001001
2. Translate the following IP addresses into binary:
a. 146.47.230.19
b. 131.89.41.240
3. What portion of the following host IP addresses is the network number?
a. 10000110.11011101.01110100.11001001/28
b. 10000110.11011101.01110100.11001001/24
4. What are the network addresses, in binary, associated with the networks of the above IP addresses?
5. What is the network number, in decimal, of the following IP address?
129.34.250.6/28
6. What is the network IP address, in decimal, of the following host IP address?
138.54.251.7/23
Solutions:
1. Translate the following IP addresses into decimal:
a. 11101101.00101101.10110111.00000100
b. 10000110.11011101.01110100.11001001
a. 237.45.183.4
b. 134.221.116.201
2. Translate the following IP addresses into binary:
a. 146.47.230.19
b. 131.89.41.240
a. 10010010.00101111.11100110.00010011
b. 10000011.01011001.00101001.11110000
3. What portion of the following host IP addresses is the network number?
a. 10000110.11011101.01110100.11001001/28
b. 10000110.11011101.01110100.11001001/24
a. 10000110.11011101.01110100.1100
b. 10000110.11011101.01110100
4. What are the network addresses, in binary, associated with the networks of the above IP addresses?
a. 10000110.11011101.01110100.11000000
b. 10000110.11011101.01110100.00000000
5. What is the network number, in decimal, of the following IP address?
129.34.250.6/28
First translate the IP address into binary:
10000001.00100010.11111010.00000110/28
Then determine the network portion of the IP address:
10000001.00100010.11111010.0000
Replace the host portion of the IP address with zeroes:
10000001.00100010.11111010.00000000
Then translate back into decimal:
129.34.250.0
Notice that the full translation from decimal into binary was not necessary. The netmask indicates that the separation between the network and host portions of the IP address is in the fourth byte of the IP address. It is possible to work this problem by translating only the last byte into binary.
6. What is the network IP address, in decimal, of the following host IP address?
138.54.251.7/23
Translate the last two bytes into binary, because the host portion of this IP address includes nine bits, and the network IP address will have zeroes in those bits:
138.54.11111011.00000111
Replaces all host bits with 0:
138.54.11111010.00000000
Translate back into decimal:
138.54.250.0/23
Because the entire last byte was in the host portion of the IP address, it did not really need to be translated into binary. It could simply have been replaced with zero, since, by the definition of a network address, all bits in that byte were zero.