Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Professor taught the following scenario. An organization has purchased a Class-C address 216.21.5.0 and would like to use it to address its offices at Arizona, Florida and California. It has the following network setup.

So, the total number of networks required is 5. So, subnet mask would be 255.255.255.224 or /27. Also, the lowest subnet bit was 32 and hence the increment value would be 32. So, we get a total of 8 network ranges as follows.

216.21.5.0 to 31
216.21.5.32 to 63
216.21.5.64 to 95
216.21.5.96 to 127
216.21.5.128 to 159
216.21.5.160 to 191
216.21.5.192 to 223
216.21.5.224 to 255

Thus, we get approximately 30 computers under each network range. That is, 30 in Arizona office, 30 in California office and 30 in Florida office.

Now, about my doubt.

  1. If we do the network subnetting as above, we are wasting large amounts of IP addresses for the intermediate links that do not have any systems connected to them.
  2. Also, if there are (say)90 computers in Arizona office and only 20 computers in Florida office, then according to this method, that would be impossible.

P.S. I'm very confused with this IP subnetting process. Please clear my doubts. Thanks!

share|improve this question
    
I just want to comment on the "approximately 30 computers under each network range". Is that 30 computers, plus a few printers, a scanner, a few mobile devices etc etc? Computers are not the only things who want one of more IPs. –  Hennes Aug 12 '13 at 13:02
1  
Just keep in mind that it's long since outdated. I remember back in something like 2002 when the company I worked for then was allocated an IPv4 /28. Better to just say /24 if that's what you mean; everyone who is seriously into networking will know exactly what it means, and no one will need to go into nitpicking mode @Hennes. –  Michael Kjörling Aug 12 '13 at 13:25
1  
They do that because sometimes you actually need a large number of publicly routable addresses. Yes, NAT and front-loading proxies and load balancers can do a lot to save on address space, but it doesn't solve everything and it also adds complexity. –  Michael Kjörling Aug 12 '13 at 13:38
1  
If you have a large datacenter providing multiple disparate services, you may want (some of) those to be individually addressable on the IP level. Obviously this depends heavily on what you are doing on your part of the Internet; that's the very reason why ISPs allocate large netblocks to some customers and small netblocks to other customers. It isn't (or at least shouldn't be) based on elitism, but reasonably proved need. –  Michael Kjörling Aug 12 '13 at 13:45
1  
In my point of view, the correct setup should be 3 different 192.168.xxx.xxx subnet (or 10.xxx.xxx.xxx) and then do NAT and VPN tunneling, while total 3 ( 6 including HA resilience gateway) public ip address is needed. –  Antony Lee Aug 14 '13 at 9:39

1 Answer 1

up vote 4 down vote accepted
  1. If we do the network subnetting as above, we are wasting large amounts of IP addresses for the intermediate links that do not have any systems connected to them.
  2. Also, if there are (say)90 computers in Arizona and only 20 computers in Florida, then according to this method, that would be impossible.

The answers to these two questions are basically the same: you don't have to slice a subnet into equal-size portions. This is the same as that a single ISP may allocate one customer a /22 and another customer might receive a /28, based on their respective addressing needs.

Let's say your subnet IP address allocation needs are 90, 50 and 30 addresses, respectively, and that you have a full IPv4 /24 (but nothing more) to play with. Let's see how we might allocate those subnets.

90 IP addresses fits nicely within a /25, so you allocate .0/25 for that which leaves you with a nice margin and .128/25 unassigned.

50 IP addresses needs a block of 64 (which translates to a /26), so you allocate .128/26 which leaves you with a bit of a margin and .192/26 unallocated.

30 IP addresses needs a block of 32 (a /27), so you allocate .192/27, which leaves you with almost no margin to grow in but .224/27 remains unallocated. 20 IP addresses would also require a /27 but leave you with a much larger margin. (If on the other hand you needed 35 IP addresses you'd need a /26, which leaves you with no remaining IP address space in your allocated netblock. In that case and if you need to run the point-to-point links within your allocated netblock but outside of the site subnets, you'd have to beg your ISP for a /23 instead and start over.)

The space .224/27 can be subdivided into /30s or /31s for the point-to-point links. Since you only really need two IP addresses (one for each endpoint) on each link, /31s should do, but sometimes a /30 is used to allow for a network and broadcast address as well. If you use /31s, you can squeeze 16 (2^(31-27)) point-to-point links in there without resorting to tricks like NAT or local addresses such as RFC 1918.

Hopefully I got the numbers right (I haven't double-checked), but you get the idea. The trick is to allocate the largest blocks first, and then continue with what remains, allocating the smallest blocks possible that will allow you the number of hosts you need on each subnet.

You might have other issues because absent special arrangements the overall /24 will almost certainly be going to one of the sites, but if you can live with that, a setup like the above should get you pretty close to an ideal (or least-bad) addressing situation.

It's also worth remembering that it's usually a bad idea to allocate a public, global IP address to each client host. Use a single NAT gateway in front of everything that doesn't require direct Internet access, and you can easily consolidate a few hundred clients onto a single global IP address, and in addition likely gain a bit of network security at the same time.

Thanks to @Kwaio, here's a diagram illustrating how such IP address allocations can be done.

share|improve this answer
    
I think this is for educational purposes only of explaining subnetting, but you're right about public addresses and NAT, which he may haven't learned yet. Mind if I make a little schema to add to your post ? –  Kwaio Aug 12 '13 at 13:15
    
@Kwaio If you think it'll help clarify the answer, by all means go ahead. I'm not in a position of being able to make any nice diagrams right now. I mention NAT as an aside because it is an address-conserving technique and many applications don't require direct global Internet access. –  Michael Kjörling Aug 12 '13 at 13:21
    
I would really appreciate if those who have downvoted this can take a moment to explain what's wrong with my answer (as opposed to the question, which is an entirely different kettle of fish). It seems to me a perfectly reasonable answer to a somewhat newbie-ish question. –  Michael Kjörling Aug 13 '13 at 20:23
    
@Kwaio I'm still a little skeptical, why would our professor teach such a technique which splits the range equally. It feels stupid! –  VISHNU VIVEK Aug 16 '13 at 13:33
1  
@VISHNUVIVEK It may be easier to explain, but I agree, it isn't a likely real-world scenario. If you want a real answer to that question, though, you'll have to ask your professor. By all means encourage him to have a look at this question and answer, or the Network Engineering Stack Exchange. In the meantime, if you feel that this answer properly answers your question, please do accept it. :) (I've seen answers with scores well into negative territory being accepted, believe it or not.) –  Michael Kjörling Aug 16 '13 at 13:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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