To convert an IP address into a number, you can use the following method where each of the four octets of the IP address is multiplied by a power of 2 corresponding to its position:
Formula:
Example: Converting IP Address 46.51.219.242
We can break down the conversion of the IP 46.51.219.242 into a number:
First, separate the octets:
- Octet1: 46
- Octet2: 51
- Octet3: 219
- Octet4: 242
Apply the formula:
- Add them together:
So, the IP address 46.51.219.242 corresponds to the number 775150578.
Class-based IP Addressing:
IP addresses are classified into five classes (A, B, C, D, and E), and each class has a designated range and subnet mask:
| Class | Leading Bits | Start Address | End Address | Subnet Mask |
|---|---|---|---|---|
| Class A | 0 | 0.0.0.0 | 127.255.255.255 | /8 |
| Class B | 10 | 128.0.0.0 | 191.255.255.255 | /16 |
| Class C | 110 | 192.0.0.0 | 223.255.255.255 | /24 |
| Class D | 1110 | 224.0.0.0 | 239.255.255.255 | NA |
| Class E | 1111 | 240.0.0.0 | 255.255.255.255 | NA |
Explanation of Classes:
- Class A: Uses addresses from
0.0.0.0to127.255.255.255with a/8subnet mask, meaning the first 8 bits represent the network part, and the remaining bits represent the host. - Class B: Uses addresses from
128.0.0.0to191.255.255.255with a/16subnet mask, meaning the first 16 bits represent the network part. - Class C: Uses addresses from
192.0.0.0to223.255.255.255with a/24subnet mask, meaning the first 24 bits represent the network part. - Class D: Reserved for multicast addresses (
224.0.0.0to239.255.255.255). - Class E: Reserved for experimental purposes (
240.0.0.0to255.255.255.255).