2
$\begingroup$

I'm having trouble understanding the point of Subnet Masks.

I was reading a nice article on Tech-FAQ on the topic, but it has left me a bit confused.

When I first heard about Subnets, it was explained to me that these are small independent networks connected to the main internet at one point. For example in an office building there would be a subnet for the thousand computers there, instead of wasting a thousand regular IP addresses.

However, from this article it seems a subnet is a collection of computers with similar IP addresses and a subnet mask is used to describe which bits are the ones in range of your subnetwork.

Example from the article:

Subnet Mask demo

So what's the point of this? We still don't save IP addresses and if I want to contact Dave at Company X and Bill at the same Company X I still have to send messages to 105.23.44.89 and 105.23.44.90.

How do subnets make life any easier or contribute anything?

$\endgroup$
4
$\begingroup$

The main benefit is in the size of routing tables. Instead of having to store an entry for every machine on the network, you only need to store an entry for the particular subnet.

For example ISP might have X.Y.Z.W/16 and anyone sending a packet from the outside to any machine in this subnet only needs to know the route to their border. Their border router has a more fine grained view of the subnet (which is probably further split into many more subnets) and then knows which router on their network to send the packet to based on which smaller subnet it belongs to. Thus, subnets provides a level of abstraction to the OUTSIDE. Not the INSIDE which you seemed to have expected.

EDIT: Here's a simplified example. Assume that some large ISP has the network 1.0.0.0/8. Within this large network there are two smaller networks 1.0.1.0/24 and 1.0.2.0/24. To reach a system on either of the two smaller networks a system outside of 1.0.0.0/8 only needs to know the address of the border router of 1.0.0.0/8. Once the packet reaches the router managing 1.0.0.0/8, that router will know how to get to 1.0.1.0/24 or 1.0.2.0/24. Finally, your home router does not even need to know the address of the router of 1.0.0.0/8. It will just blindly send all your packets to a router on your home ISP assuming that this larger router will know how to get to 1.0.0.0/8 (this is what's typically called the default route/gw).

Here's a way to think about this. Think about being on a train station and having to get from city A to B. When you look at the map at the train station in city A it will tell you what trains to take to get to city B. However, that map will not tell you how to get you to your final destination in city B. However, in city B you can probably find a more detailed map that will tell you how to get you to your final destination within city B, but you don't need to have access to that map while still in city A.

$\endgroup$
  • $\begingroup$ So every router outside my office building knows my office building's subnet mask? $\endgroup$ – CodyBugstein Jun 9 '14 at 8:46
  • $\begingroup$ No. If you think about it for a moment it means that your home DSL/Cable router would need to know the address of every office building's subnet. This would not fit into their memory and also looking anything up from such a large table would be too slow. $\endgroup$ – Edvard Fagerholm Jun 9 '14 at 20:25
  • $\begingroup$ So how does my home router find my office building's router? $\endgroup$ – CodyBugstein Jun 9 '14 at 20:58
  • 1
    $\begingroup$ It sends the data to its default gateway, which is a router at your ISP. This router will check whether or not it knows how to get there, if not, it will send it to its default gateway. At some point you either reach the destination or you reach some backbone router, which keeps track of the global routing tables (autonomous systems) of the internet and sends the packet to whatever transit ISP or peering point that takes you to the ISP of your office building. Once the packet is at your office's ISP they will route it to your office network. Look into BGP4 and AS's if you want to know more. $\endgroup$ – Edvard Fagerholm Jun 9 '14 at 21:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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