1

I want to know that how can we calculate the Subnet prefix and CIDR, when the given information is only IP address and required No of hosts. For example: Suppose we have:
IP Address= 198.1.1.0 and Required No of hosts= 60
what will be the subnet prefix and CIDR?

I know how to calculate CIDR from NETMASK, but what if there is no netmask given ?? I have been trying to solve it for hours. Please give a clue or something as I am new to this subject.

Tom
  • 13
  • 1
  • 3

1 Answers1

1

Ok if you know how to calculate CIDR from NETMASK this will be easy...

/30 = 4-2=2 hosts
/29 = 8-2=6 hosts
/28 = 16-2=14 hosts
/27 = 32-2=30 hosts
/26 = 64-2=62 hosts

basically,

/x is 2^(32-x)-2 hosts

and if you have n hosts, you can use a /x with

x=floor(32-LOG2(n+2))

you can remove one more host if you want an ip for the gateway

So in your example, you want 60 hosts :

32-log2(60+2)=26.04... so /26
198.1.1.0 is ok as a prefix for a /26 (see others posts on the topic)

so 198.1.1.0/26 = 198.1.1.0/255.255.255.192

Golgot
  • 427
  • 2
  • 10