Search code examples
ipip-addresssubnetdata-communication

How to perform IP subnetting on 192.168.0.0/16?


I need to have at least 30 subnets. Also, in this case, what is the number of bits borrowed, and bits left? I am confused with the many information I got online. I appreciate any help. Thank you in advance.


Solution

  • For an easy explanation, I need to write down the subnet mask in binary format:

    IP: 192.168.0.0/16

    Netmask (Decimal Format): 255.255.0.0 or,

    Net mask (Binary Format): 1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0

    As far as the Netmask and (/16) show 16 bits belong to network portion and 16 bits belong to host portion. In order to make 30 subnets, you need to add 5 bits of host portion to the network portion. Then 11 bits remain in host portion that provide {(2^11 = 2048), or [(2^3 = 8) * (2^8 = 256)] = 2048} IP address for each subnet. As a result of adding 5 bits to the network portion, the new subnet mask becomes:

    CIDR: /21

    Decimal: 255.255.248.0

    Binary: 1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.0.0.0.0.0.0.0.0.0.0.0

    Note: This way, you can create (2^5 = 32) subnets. However, you should know that you can’t create exactly 30 subnets since the IP works in binary format. Therefore, you have to create either (2^5 = 32) subnets or (2^4 = 16) subnets. As far as 16 subnets don’t meet your requirement, you would choose 32 subnets. Now you can assign each subnet 2048 IP address and write down as following:

    1st subnet: (192.168.0.0 ~ 192.168.7.255)/21

    2nd subnet: (192.168.8.0 ~ 192.168.15.255)/21

    3rd subnet: (192.168.16.0 ~ 192.168.23.255)/21

    30th subnet: (192.168.232.0 ~ 192.168.239.255)/21

    31st subnet: (192.168.240.0 ~ 192.168.247.255)/21

    32nd subnet: (192.168.248.0 ~ 192.168.255.255)/21