All devices on a network need some way to identify themselves as a specific host. Early networks simply used a naming format, and a server on the network kept a map of MAC addresses to host names. Tables quickly grew very large and with this grew issues such as consistency and accuracy (see Figure 5.1 below). IP addressing effectively resolved this issue.
Figure 5.1 – Device Naming Tables Became Too Cumbersome
IP Version 4
IP version 4 (IPv4) was devised to resolve the device naming issue. IPv4 uses binary to apply an address to network devices. IPv4 addresses use 32 binary bits divided into four groups of eight (octets). The following is an example of an IPv4 address in binary:
11000000.10100011.11110000.10101011
which you would see in decimal as:
192.163.240.171
Each binary bit represents a decimal number, and you can use or not use the number by placing a 1 or a 0, respectively, in the relevant column. The eight columns are as follows:
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
In the chart above, you can see that only the first two decimal numbers are used (those with 1s beneath them), which produces the value 128 + 64 = 192.
Binary
In order to understand how IP addressing works, you need to understand binary mathematics (sorry). Computers and networking equipment do not understand decimal. We use decimal because it is a numbering system using 10 digits, invented by a caveman millenia ago when he realised he had 10 digits on his hands that could be used for counting dinosaurs as they walked past his cave.
Computers and networking equipment can only understand electrical signals. Since an electrical signal is either on or off, the only numbering system that will work is binary. Binary uses only two numbers, a 0 or a 1. A 0 means there is no electrical pulse on the wire and a 1 means that there is a pulse on the wire.
Any number can be made up using binary values. The more binary values you add, the larger the number becomes. For every binary value you add, you double the next number (e.g., 1 to 2 to 4 to 8 to 16, and so on into infinity), starting at the right and moving left. With two binary digits, you can count up to 3. Just place a 0 or a 1 in the column to decide whether you want to use that value.
Let’s start with only two binary values in columns 1 and 2:
|
2 |
1 |
|
0 |
0 |
0 + 0 = 0
|
2 |
1 |
|
0 |
1 |
0 + 1 = 1
|
2 |
1 |
|
1 |
0 |
2 + 0 = 2
|
2 |
1 |
|
1 |
1 |
2 + 1 = 3
If you use eight binary bit places (an octet), you can get any number from 0 up to 255. You can see that the numbers start from the right and move across to the left:
|
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
If you add a 0 to each of these columns, you have a value of 0 in decimal:
|
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
|
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
If you add a 1 to each of these columns, you have a value of 255 in decimal:
|
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
|
1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
Don’t believe me?
128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255
So logic dictates that you can actually make any number from 0 to 255 by placing a 0 or a 1 in various columns, for example:
|
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
|
0 |
0 |
1 |
0 |
1 |
1 |
0 |
0 |
32 + 8 + 4 = 44
IP addressing and subnetting are based on the fundamentals above. Table 5.1 below summarises what you know so far. Pay special attention to this table because the values can be used for any subnet mask (more on that later).
Table 5.1 – Binary Values
|
Binary |
Decimal |
|
10000000 |
128 |
|
11000000 |
192 |
|
11100000 |
224 |
|
11110000 |
240 |
|
11111000 |
248 |
|
11111100 |
252 |
|
11111110 |
254 |
|
11111111 |
255 |
Make up some of your own binary numbers to ensure that you understand this concept fully.
Hexadecimal
Hexadecimal (or hex) is an alternative numbering system. Rather than counting in 2s or by 10, 16 numbers or characters are used. Hex starts at 0 and goes all the way up to F, as illustrated below:
0 1 2 3 4 5 6 7 8 9 A B C D E F
Each hexadecimal digit actually represents four binary digits, as shown below in Table 5.2:
Table 5.2 – Decimal, Hex, and Binary Digits
| Decimal |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
| Hex |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
| Binary |
0000 |
0001 |
0010 |
0011 |
0100 |
0101 |
0110 |
0111 |
| Decimal |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
| Hex |
8 |
9 |
A |
B |
C |
D |
E |
F |
| Binary |
1000 |
1001 |
1010 |
1011 |
1100 |
1101 |
1110 |
1111 |
Converting from binary to hex to decimal is fairly simple, as shown in Table 5.3 below:
Table 5.3 – Conversion of Binary to Hex to Decimal
| Decimal |
13 |
6 |
2 |
12 |
| Hex |
D |
6 |
2 |
C |
| Binary |
1101 |
0110 |
0010 |
1100 |
Hex is a more manageable counting system for humans than binary, but it’s close enough to binary to be used by computers and networking equipment. Any number can be made using hex, as it can use binary or decimal; just count in multiples of 16 instead, for example:
1 x 16 = 16
16 x 16 = 256
256 x 16 = 4096
…and so on.
| Hex |
4096 |
256 |
16 |
1 |
|
1 |
A |
Counting in hex, therefore, goes 0 1 2 3 4 5 6 7 8 9 A B C D E F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22, etc., to infinity. 1A (above), for example, is an A in the 1 column and a 1 in the 16 column: A = 10 + 16 = 26.
When converting binary to hex, it makes the task easier if you break the octet into two groups of four bits. So 11110011 becomes 1111 0011. 1111 is 8 + 4 + 2 + 1 = 15, and 0011 is 2 + 1 = 3. 15 is F in hex and 3 is 3 in hex, giving us the answer F3. You can check Table 5.2 to confirm this.
Hex to binary is carried out using the same process. For example, 7C can be split into 7, which is 0111 in binary, and C (12 in decimal), which is 1100 in binary. The answer, then, is 01111100.
Converting Exercise
Here are some examples for you to try. Write out the charts above for working out hex and binary (i.e., for hex, a 1 column, then a 16 column, then a 256 column, and so on):
- Convert 1111 to hex and decimal.
- Convert 11010 to hex and decimal.
- Convert 10000 to hex and decimal.
- Convert 20 to binary and hex.
- Convert 32 to binary and hex.
- Convert 101 to binary and hex.
- Convert A6 from hex to binary and decimal.
- Convert 15 from hex to binary and decimal
- Convert B5 from hex to binary and decimal.
It would be useful in the exam to write out Table 5.2 to help you work out any binary to hex to decimal conversions.
The rule for using IP addressing is that each address on the network must be unique to that host (i.e., it can’t be shared). Some addresses can’t be used for hosts. This will be covered in more detail later, but for now, know that you can’t use an address which is reserved for the entire network, a Broadcast address, or addresses reserved for testing. In addition, three groups are reserved for use on internal networks to save addresses.
Because of the rapid growth of network sizes, each IP address must be used in conjunction with a subnet mask. The subnet mask is there to tell the network devices how to use the numbers in the IP address. The reason for this is that some of the addresses available for hosts on your network can actually be used to chop down the network into smaller chunks or subnets.
An example of an IP address with a subnet mask is 192.168.1.1 255.255.255.240.
