Tips : IP subnetting

The first IP address is usually used for gateway, and the last IP address belongs to host in the subnet.
- Network address is always an even number, the last bit is zero (0)
- The first usable address is always an odd number, the last bit is one (1)
- On the other side it is inverted, the broadcast is odd number, and the last host is always even number

Lets see this example

Subnet 192.168.1.32/27

Number of bits to mask = 27
Number of host bits       =  32 - 27 = 5

First usable 192.168.1.33
last 192.168.1.62,
broadcast 192.168.1.63,
next network 192.168.1.64/27


The last octet:

00100000 - network
00100001 - first
00111110 - last
00111111 - broadcast

The next network is broadcast + 1 = 01000000 - 64/27

It will be very usefull to learn subnet numbers.
The networks are increasing on exponent of 2, in exactly specified blocks.

24 - 255.255.255.0 = 256 2^8
25 - 255.255.255.128 =128 2^7
26 - 255.255.255.192 = 64 2^6
27 - 255.255.255.224 = 32 2^5
28 - 255.255.255.240 = 16 2^4
29 - 255.255.255.248 = 8 2^3
30 - 255.255.255.252 = 4 2^2
31 - 255.255.255.254 = 2 2^1
32 - 255.255.255.255 = 1 2^0
For a address range in 3. octet is the same situation, where you can use prefix minus 8...
Example:
255.255.0.0 /16


No comments: