Search code examples
ipipv4subnet

Which IP addresses can I NOT use in a subnet because they are reserved?


I'm studying subnetting and I can't seem to find a straight answer to what seems like a simple question. Say I have the network 192.168.1.0/26 or in other words, 192.168.1.0 - 192.168.1.63

I have 64 IP's in total and I know the last usable one is 192.168.1.62 since 192.168.1.63 is the broadcast address. Where is the first usable address and how do the Default Gateway, Loopback address and Network IP figure in? I keep getting conflicting info.


Solution

  • For any subnet, there is a "network address" and a "broadcast address". The former is the subnet prefix followed by all zero bits and the latter is the subnet prefix followed by all one bits.

    Thus, an N-bit subnet has 2^N - 2 addresses available. (Where N=32-M in A.B.C.D/M notation.)

    The "default gateway" is an address on any local subnet where is sent all traffic not destined for any local subnets. It can be any valid subnet address though it's common for it to be the very first address of the subnet on which in resides. A machine can be connected to many subnets (eth0, eth1, wifi0, etc.) but has only one default gateway.

    The "loopback address" is not part of a subnet. It is its own interface and has the address 127.0.0.1/8 so any address starting with 127 will reference the local machine.

    Note: I have seen configuration options to make the "broadcast address" match the "network address" but I've never seen this used in practice.