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
  • It is not the duplicate of above question as I Don't have Netmask given. – Tom Aug 01 '18 at 20:38
  • If you carefully read the answer, it does explain how derive the mask from the required number of hosts. – Ron Maupin Aug 01 '18 at 20:40
  • The answer is very complex. I am new to this field not not be able to grasp all the concepts. I just answer in simple way. – Tom Aug 01 '18 at 20:43
  • The part about deriving the mask from the required number of hosts is actually a very simple formula, If you do not have the grounding in math, you need to get that before trying to do network engineering. Simple mathematical concepts and binary math are prerequisites. – Ron Maupin Aug 01 '18 at 20:49

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
  • 9
  • ... plus the /31 netmask which makes use of both IP addresses. – Zac67 Aug 01 '18 at 20:36
  • @Golgot I appreciate your effort. But I am not getting all the concepts of your answer.I am new to this filed. I don't know many concepts. Can you please explain your answer with some example or take my mentioned example?? – Tom Aug 01 '18 at 20:42
  • Just edited, hope this help – Golgot Aug 01 '18 at 20:47
  • I understand most of it. Thanks.Just one more question. In formula you are subtracting from 32 while in example, why you subtracted from 62? – Tom Aug 01 '18 at 20:58
  • My mistake, I updated the answer. – Golgot Aug 01 '18 at 21:04