IPv4 uses binary numbering, which means 0 or 1, The 0 and 1 are called bits
Servers & Network devices are given numbers to uniquely identify them in a network, this is called addressing.
A server or laptop is given a network address which consists of number that is 32 bits long.
The 32 bits is divided into 4 groups of 8 binary numbers called octets.
For example:
The full binary address
00001010000000010011001000000010
The full binary address broken up into 4 groups of 8 binary numbers, there is a dot after every 8 bits
00001010.00000001.00110010.00000010
As these numbers are not practical for people to use, they are converted to the decimal equivalent. The computer will however carry on using the 32 bit binary numbers.
Here's an example of a conversion from binary to decimal
00001010.00000001.00110010.00000010 = 10.1.50.2
To explain you how that gets converted
The decimal numbering works of the number 10, binary works of the number 2.
For decimal numbers 0 - 9 the total amount of numbers is 10
For binary numbers 0 - 1 the total amount of numbers is 2
Let's work out the numbers in the position notation, to provide and example for a decimal number 2468
Read out that says two thousand, four hundred, and sixty eight.
Description
Thousands
Hundreds
Tens
Ones
Positional Value
1000
100
10
1
Decimal number
2
4
6
8
Calculate
2 x 1000
4 x 100
6 x 10
8 x 1
Add up
2000
400
60
8
And that makes 2468
Now let's do a binary number, the base number is 2, position starts from right to left, begins with zero
Description
Position seven
Position six
Position five
Position four
Position three
Position two
Position one
Position zero
Base Number
2
2
2
2
2
2
2
2
Position of number
7
6
5
4
3
2
1
0
Calculate
2^7
2^6
2^5
2^4
2^3
2^2
2^1
2^0
Add up
128
64
32
16
8
4
2
1
Keep that table in mind and recall our binary number
00001010.00000001.00110010.00000010 = 10.1.50.2
The first number in our IP address is 10 which in binary format is 00001010, let's see how.
Description
Position seven
Position six
Position five
Position four
Position three
Position two
Position one
Position zero
Positional value
128
64
32
16
8
4
2
1
Our binary number
0
0
0
0
1
0
1
0
Calculate
0 x 128
0 x 64
0 x 32
0 x 16
1 x 8
0 x 4
1 x 2
0 x 0
Add up
0
0
0
0
8
0
2
0
The result is 8 + 2 = 10
We have our first number converted, if you do the same for the other numbers you get the IP address 10.1.50.2
The IP address structure
The 32 bit binary number IP address is split into two, a host part and a network part.
The network part and the host part is determined by something called a Subnet Mask "1's" are the network part of the address and "0's" are the host/device part.
The process of determining what the network address is a comparison of the binary numbers of the IPv4 IP and the binary number of the subnet mask. The process uses digital logic, called ANDing
1 AND 1 = 1
0 AND 1 = 0
0 AND 0 = 0
1 AND 0 = 0
Description
Octet 1
Octet 2
Octet 3
Octet 4
IPv4 IP
10
1
50
2
IPv4 Binary
00001010
00000001
00110010
00000010
Subnet Mask
255
255
255
0
Subnet Mask Binary
11111111
11111111
11111111
00000000
ANDing
00001010
00000001
00110000
00000000
Resulting Network Address
10
1
50
0
The resulting network address is from converting ANDing to the decimal equivalent using the binary positional values we discussed earlier.
Specifying decimal network address and host address with subnet mask is a bit long winded.
To make this easier a short version is just to count the number of "1's" in the subnet mask and put that in a slash "/" notation.
A commonly used one is
255.255.255.0
11111111.11111111.11111111.00000000
/24
Another one is:
255.255.255.252
11111111.11111111.11111111.11111100
/30
A network identity has the following address associated with it.
Network Address
Host Addresses
First Host Address
Last Host Address
Broadcast Address
Staying with our example IP: 10.1.50.2
Network Address = 10.1.50.0/24
Host Addresses, Range from = 10.1.50.1/24 - 10.1.50.254/24
Broadcast Address = 10.1.50.255/24