• IP and postal addresses are considered to be hierarchical, which means they contain a structure. Consider a letter with the following postal address:

Mr Weyland

32 Colony Avenue

Hicksville

LV426

• The address identifies the house, street and town that the postal service needs to use to deliver the letter. It also identifies the person in the house for whom the letter is intended. This is very important, as the house probably contains a number of people and they need to be able to determine who the letters is for.
• Now consider an IPv4 address: 192.168.10.10
• The address identifies the network that the packet has to be delivered to using the ‘192.168.10’ portion of the address.
• The identity of the device, or host, within the network for which the packet is intended is ‘.10’.
• Therefore, we can say that an IPv4 address contains a network and a host component.
• Because IP addresses are designed to be used by computing devices, they are actually 32-bit binary numbers, which are converted to decimal to make them easier for people to work with. To make the addresses even easier to work with, they are divided into four 8-bit blocks called octets:
Figure 3
• The decimal numbers within each octet can range from 0 to 255.

## Activity: Decimal and binary numbers

You need to be comfortable with converting between decimal and binary numbers. Try using the excel spreadsheet to convert the following decimal numbers into binary.

Decimal Binary
2
To use this interactive functionality a free OU account is required. Sign in or register.
4
To use this interactive functionality a free OU account is required. Sign in or register.
8
To use this interactive functionality a free OU account is required. Sign in or register.
10
To use this interactive functionality a free OU account is required. Sign in or register.
24
To use this interactive functionality a free OU account is required. Sign in or register.
32
To use this interactive functionality a free OU account is required. Sign in or register.
48
To use this interactive functionality a free OU account is required. Sign in or register.
64
To use this interactive functionality a free OU account is required. Sign in or register.
128
To use this interactive functionality a free OU account is required. Sign in or register.
160
To use this interactive functionality a free OU account is required. Sign in or register.
255
To use this interactive functionality a free OU account is required. Sign in or register.
192
To use this interactive functionality a free OU account is required. Sign in or register.
168
To use this interactive functionality a free OU account is required. Sign in or register.
Interactive feature not available in single page view (see it in standard view).
• In the example above we used colour to identify the network and host components in the IPv4 address, but this technique will not work for computing devices. Instead IP subnet masks are used. The IP subnet mask is a 32-bit binary number, and each binary ‘1’ is used to identify a network bit within the IP address itself:
Figure 4
• Note that the subnet mask bits are set to ‘0’ to identify the host portion of the address. A computing device will evaluate the IP address and subnet mask together, bit by bit (this is called bit wise), performing a logical ‘AND’ operation:
Figure 5
• The AND function will take two inputs, and if they are both ‘1’, it will output a ‘1’. Any other combination of inputs will result in a ‘0’ output.

## Example: AND function

Try performing the AND function on the address and mask shown below:

Figure 6
• Proceed from left to right, taking 1 bit from the address, 1 bit from the mask and perform the AND function. The output will be the network address:
Figure 7
• Note that the network address is 192.168.10.0, not 192.168.10 as shown previously in the coloured example. This is because the network address has to be 32-bits long, but as it does not include any host information, the host component is set to the all zero condition.