Qingquan-Li / blog

My Blog
https://Qingquan-Li.github.io/blog/
132 stars 16 forks source link

IP Addressing, CIDR, and Subnet Mask #270

Open Qingquan-Li opened 3 months ago

Qingquan-Li commented 3 months ago

1. Classless Inter-Domain Routing (CIDR)

CIDR was introduced to overcome the limitations of class-based addressing (Classful network). It allows for more flexible IP address allocation by using variable-length subnet masks. CIDR notation (e.g., /24) indicates the number of bits used for the network portion of the address. The remaining bits are used for host addresses within that network.

Examples Calculation with CIDR

Consider the IP address 192.168.1.0/24:

cidr.xyz

IP Range:

Consider the IP address 10.0.0.0/16:

IP Range:

2. Subnet Mask

A subnet mask is a 32-bit number that separates the network portion of the IP address from the host portion. It determines which part of an IP address is used to identify the network and which part identifies the host within that network.

Example: 192.168.1.0/24

Subnet Mask Calculation:

Subnet masks are also expressed in dot-decimal notation like an IP address. The prefix 192.168.1.0/24 have the subnet mask 255.255.255.0.

In this example, the subnet mask 255.255.255.0 tells us that the first three octets (192.168.1) represent the network, while the last octet is used for hosts within that network.