Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Possible Duplicate:
How does Subnetting Work?

I watched some videos about subnet masks and ip addresses, but I have a question that I couldnt find an answer for it, how to approach this question?

A PC’s IP-address inside a subnet is 203.34.27.1. Inside the subnet a maximum of 30 ‘legal’ (end)systems is allowed to be connected. What subnetmask (in dotted notation) is used?

That 30 makes it difficult to solve, If it was 32 then I would say 2^5 = 32 but since its 30 I have no idea how to solve

share|improve this question

marked as duplicate by voretaq7 Jun 27 '12 at 19:21

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3  
Looks like homework to me. –  Safado Jun 27 '12 at 18:48
1  
Then you didn't really understand the video as the first and last addresses are the network and broadcast which aren't usable for host addresses. –  Iain Jun 27 '12 at 18:59
    
..."I watched some videos"?!? –  Massimo Jun 27 '12 at 19:01
4  
Please see the question that this is now closed as a duplicate of. Read all the answers. Enlightenment will be achieved :) –  voretaq7 Jun 27 '12 at 19:27
add comment

4 Answers

up vote 2 down vote accepted

30 end systems + 2 unused addresses (network and broadcast) = 32

Since the network address is the .0 address, we can subtract it from our count: 32 - 1 = 31

31 = 11111 (5 bits)

Xor that to 255 (11111111 = 8 bits), and it gives you 11100000 = 224

So the mask should be 255.255.255.224

share|improve this answer
add comment

An easy way for me to do this is like so..

We know that 255.255.255.0 (/24) has 256 address.

We know that 255.255.255.128 (/25) has 2 groups of 128 addresses.

We know that 255.255.255.192 (/26) has 4 groups of 64 addresses.

We know that 255.255.255.224 (/27) has 8 groups of 32 addresses.

We know that 255.255.255.240 (/28) has 16 groups of 16 addresses.

We know that 255.255.255.248 (/29) has 32 groups of 8 addresses.

We know that 255.255.255.252 (/30) has 64 groups of 4 addresses.

So in this case, your subnet has 32 IP addresses (30 usable, because one is the subnet ID and the other is the broadcast). So in this case, your subnet is 255.255.255.224 or /27 in CIDR notation.

share|improve this answer
add comment

From http://www.subnet-calculator.com/cidr.php

203.34.27.0/27
255.255.255.224

Which will give you 32 IPs, 30 usable plus network and broadcast addresses.

share|improve this answer
add comment

Maybe this is cheating, but I use http://www.subnetmask.info/ for network calculations when it's not obvious. The charts at http://www.skullbox.net/subnetcalculator.php are also helpful.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.