Level 3 addresses: IPv4
Definition: An IPv4 address is a sequence of 4 numbers separated by a dot, called : dotted decimals.
Ex: 192.168.10.1 -- xxx = 1 byte = 8 bits An IPv4 address is encoded on 4 bytes The size of an IP address is 32 bits.
Anatonmie of an IPv4 address :
IPv4 addresses are divided into classes: There are 5 IPv4 classes:
| Class | Range |
|---|---|
| A | 0.0.0.0 -> 126.255.255.255 |
| B | 128.0.0.0 -> 191.255.255.255 |
| C | 192.0.0.0 -> 226.255.255.255 |
| D | |
| E |
Example:
| IPv4 | Class |
|---|---|
| 172.16.10.1 | B |
| 193.168.10.10 | C |
| 230.10.175.10 | ? |
Subnet mask
The subnet mask is an IPv4 address whose first octet must be 255.
It separates the network and machine parts of an IPv4 address.
Default subnet masks
| Class | Mask | IPs available |
|---|---|---|
| A | 255.0.0.0 | ~16,000,000 |
| B | 255.255.0.0 | ~65,534 |
| C | 255.255.255.0 | 254 |
Network part: NetID -- Network Identification
This is the network part of an IPv4 address, enabling you to identify the network to which a machine belongs.
Machine part: HostID
This is the machine/host part of an IPv4 address, used to identify a machine on the network.
Calculating the number of available addresses :
To calculate the number of available addresses:
n = number of 0s in the subnet mask in binary.
Private IP addresses
A private IP address is used to communicate on a local area network (LAN).
A public IP address enables communication on the public network (WAN).
| Class | Range |
|---|---|
| A | 10.0.0.0 --> 10.255.255.255 |
| B | 172.16.0.0 --> 172.32.255.255 |
| C | 192.168.0.0 --> 192.168.255.255 |
Network subdivision
We subdivide a network to obtain distinct sub-networks.
Example:
Specification: The network is given:
192.168.10.1 | 255.255.255.0
We ask that this network be divided into 4 distinct subnetworks.
Step 1
Find the number of bits to freeze:
n is the number of bits to freeze.
In our case:
The number of bits to freeze is 2.
Step 2
Convert IP address and mask to binary
Reminder of the truth table for the ET logical operator:
| A | B | A^B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Step 3:
Perform the logical “AND” operation bit by bit between the IP address and the subnet mask.
11000000.10101000.00001010.00000000 will be the address of the router, the subnetwork
@router = 192.168.10.0 | 255.255.255.0
Subdivision into subnetworks :
Reminder:
2² = 4
Count to 4 in binary with 2 bits :
| n | Subnet |
|---|---|
| 00 | 0 |
| 01 | 1 |
| 10 | 2 |
| 11 | 3 |
Subnet 0 :
192.168.10.0000 00000
| Address | IP |
|---|---|
| Subnet | 192.168.10.0 |
| Broadcast address | 192.168.10.0011 1111 |
| 192.168.10.63 |
The bolded bits are the freezed bits, 00 for subnet 0, we start counting from 0. The aim is to set all non-freezed bits to 1 to have the broadcast address.
INFO: The broadcast address makes it possible to communicate with all hosts on the network.
First usable address = Subnet address + 0.0.0.1
Last usable address = Broadcast address - 0.0.0.1
Subnet 0 summary :
| Address | IP |
|---|---|
| Subnet | 192.168.10.0 |
| Broadcast address | 192.168.10.63 |
| First usable address | 192.168.10.1 |
| Last usable address | 192.168.10.62 |
Subnet 1 :
Subnet address = 192.168.10.0100 0000
Subnet address = 192.168.10.64
Broadcast address = 192.168.10.0111 1111
Broadcast address = 192.168.10.127
Subnet 1 summary
| Address | IP |
|---|---|
| Subnet | 192.168.10.64 |
| Broadcast address | 192.168.10.127 |
| First usable address | 192.168.10.65 |
| Last usable address | 192.168.10.126 |
Subnet 2 :
Subnet address = 192.168.10.1000 0000
Subnet address = 192.168.10.128
Broadcast address = 192.168.10.1011 1111
Broadcast address = 192.168.10.191
Subnet 2 summary
| Address | IP |
|---|---|
| Subnet | 192.168.10.128 |
| Broadcast address | 192.168.10.191 |
| First usable address | 192.168.10.129 |
| Last usable address | 192.168.10.190 |
Subnet 3 :
Subnet address = 192.168.10.1100 0000
Subnet address = 192.168.10.192
Broadcast address = 192.168.10.1111 1111
Broadcast address = 192.168.10.255
Subnet 3 summary
| Address | IP |
|---|---|
| Subnet | 192.168.10.192 |
| Broadcast address | 192.168.10.255 |
| First usable address | 192.168.10.193 |
| Last usable address | 192.168.10.254 |
CIDR notation :
CIDR notation (Classless Interdomain Routing) is a notation that associates its IP address with its subnet mask.
We thus have: <@IP>/Number of bits in subnet.
Example: @IP : 192.168.10.1 | 255.255.255.0
255.255.255.0 => 11111111.11111111.11111111.00000000
8+8+8 = 24 192.168.10.1/24