Possible Duplicate:
How does Subnetting Work?

Hi all!
I need to determine the new subnet mask showing it in dotted decimal and as a binary field, calculate the actual numbers of subnets and host in each subnet, determine if the company can subnet as desired.

Example:Company ABC has a class C IP address. It wants to have 5 subnets with a max of 25 computers on each subnet.

My solution: The default mask for the class C IP address is
There are 8 bits in the host address field: 11111111
Company ABC wants 5 subnets. The nearest possible value is 2^3 – 2 = 6.
Therefore, we take 3 top bits for the subnet field and remaining 5 bits for the host address field: ssshhhhh.
The subnet mask in our case is: 11111111 11111111 11111111 11100000
The subnet mask in dotted-decimal:
(since the corresponding bit pattern, 11100000, equates to 2^7 + 2^6+ 2^5= 128 + 64 + 32 = 224)
Actual number of subnets = 2^((number of subnet bits taken from the host) ) – 2 = 2^3– 2 = 6.
Number of hosts in each subnet = 2^((number of remaining bits in the host) ) – 2 = 2^5– 2 = 30.

Company ABC can subnet as desired.

Is it correct?

marked as duplicate by Zypher, Chris S, Zoredache, John Gardeniers, Warner Aug 5 '10 at 13:12

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.

  • You don't subtract the 2 in the subnet calculation. 3 bits of subnet gives you 8 subnets. You only do that for hosts because every subnet must have a broadcast and a network ID. Also, every network must have a gateway (to be accessible to other networks) so it's common to subtract 3. – Chris S Aug 5 '10 at 1:40
  • Isn't it true that network and broadcast addresses cannot be used for subnet and host addresses? – user50263 Aug 5 '10 at 1:50
  • 1
    You have A.B.C.0/27, A.B.C.32/27, A.B.C.64/27, A.B.C.96/27, A.B.C.128/27, A.B.C.160/27, A.B.C.192/27, A.B.C.224/27. Why wouldn't you be able use A.B.C.0/27 or A.B.C.224/27? (hint: You can; there is no reason not to) – Slartibartfast Aug 5 '10 at 7:02
  • The network and broadcast IDs are specific to each subnet, they will no longer apply to the original subnet you're pulling the smaller subsets from. For instance, you started with a /24 and divided it into 8 /27s; there is no network that uses the /24 anymore (except external routing tables, but we're not concerned with them here). – Chris S Aug 5 '10 at 12:28

Chris S is correct where the subnetting yields 8 subnetted networks of 29 usable IPs (1 for NetID, 1 for IP Broadcast and 1 for the each network's gateway - router IP).

  • The gateway is just another node and must be counted accordingly, not subtracted from the number of host addresses in a subnet. – John Gardeniers Aug 5 '10 at 7:53
  • @John, while it's true the gateway is a host, I've seen a number of management level discussions not count it as it's not a client and commonly not a server. I think it depends on your audience; unless you're explicitly counting all hosts. – Chris S Aug 5 '10 at 12:25