Hello one and all.
It has been a long time since my last post. So here is another to review.
Now this post is less broadcast news and views. More of a networking type post.
I wonder how many of you actually pay attention to the network infrastructure in your home or workplace. Not many I bet :) You may not need to care, and are happy just plugging in a cable to a socket and for everything to be working. But what if everything is not aright? Plus you may want to understand how your network hangs together.
Today I wanted to pass along some knowledge and tips and for working out your sub networks and hosts in IPV4. It is fair to say that at home you are probably (99.99% sure) using a Class C Private IP address, starting 192.168.x.x with a CIDR of /24? Am I right? Now in the home using a class c ip address and a /24 is fine, so long as you only need to have 254 devices, maximum, connected to your home network. Now you think, actually I am never going to need to that many IP addresses in my home, so no worries.
Lets count the ones we have now on a typical home network:
Network 192.168.1.0 /24
Well, I am counting up to around 20 devices that require an IP address, that is before your friends and family come over with their phones and tablets grabbing your bandwidth........
So in hindsight I think I am OK to use a Class C IP address and 255.255.255.0 subnet. Even if the Fridge, Microwave and Vacuum all need a connection in the future I think we will be OK.
So what are this classes and subnets that I mention.
Well lets start on the class. An IP address is made up from 4 Octects x.x.x.x each Octect will have 8 bits of either 0 or 1.
Now these address are split into classes. If we look at the first Octect we can tell the class.
1 - 126
Class A
128 -
192 Class B
192
- 223 Class C
Plus we have some others kicking around near the end here
224 - 239 Class D reserved for Multicasting
240 - 255 Class E reserved for future = Experimental
Address
The default sub net masks for these networks are
Class A -
/8 8 network bits 24 host bits.
Class B -
/16
Class C -
/24
Within our home and office environment, we will be using Private IP address. Ranges of address that can be used within your environment. These are
Class A 10.0.0.0 -
10.255.255.255 (10/8
prefix)
Class B 172.16.0.0 -
172.31.255.255 (172.16/12
prefix)
Class C 192.168.0.0 -
192.168.255.255 (192.168/16 prefix)
Lets look at how we can sub net our home network, not something you will or want to do, but you will gain an understanding of what is occurring.
Our current configuration is a CIDR / 24 sub net, or a 255.255.255.0, Lets work out what that gives us :
Our Network ID is 192.168.1.0
The first host IP is 192.168.1.1 (generally your home router.)
Our last host IP on this network is 192.168.1.254
And our broadcast address on this network is 192,168.1.255
Right, now I have work out that I only have the need to have 20 to 25 devices connected to my network so i do not need a /24 subnet.
Lets work out what we do to achieve a subnet that would fit this number of devices into a sub network of a smaller size than 254 hosts.
Note a 1 in the Octect is a Network Bit and a 0 represents a host bit.
To work this out we review the last Octect, which currently set to
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
Giving us 254 hosts.
But if we change the network and host bits in this Octect to this
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
1 |
1 |
1 |
0 |
0 |
0 |
0 |
0 |
Giving us an Octect 224 value or this can be shown as /27
We can work out the following
How many hosts will this give us?
Well using this formula we can say 2 to the power of 5 (5 Zeros, or host bits) = 32 - 2 = 30.
How many Subnetworks will we get?
2 to the power of 3 = 8, we will get 8 sub networks using this mask in this class c example.
What are these valid subnets ?
256 - 224 = 32, so every 32 we have a new sub network.
What is the host range?
Well that will be 192.168.1.1 to 192.168.1.30 with a Network ID of 192.168.1.0 and a broadcast address of 192.168.1.31.
The sub networks would be overall :
Network ID |
192.168.1.0 |
192.168.1.32 |
192.168.1.64 |
192.168.1.96 |
192.168.1.128 |
192.168.1.160 |
192.168.1.192 |
192.168.1.224 |
1st host |
192.168.1.1 |
192.168.1.33 |
192.168.1.65 |
192.168.1.97 |
192.168.1.129 |
192.168.1.161 |
192.168.1.193 |
192.168.1.225 |
last host |
192.168.1.30 |
192.168.1.62 |
192.168.1.94 |
192.168.1.126 |
192.168.1.158 |
192.168.1.190 |
192.168.1.222 |
192.168.1.254 |
Broadcast |
192.168.1.31 |
192.168.1.63 |
192.168.1.95 |
192.168.1.127 |
192.168.1.159 |
192.168.1.191 |
192.168.1.223 |
192.168.1.255 |
I hope that this makes sense, if you have never come across networking before I hope that you learned something. If you are not new to networking you should know this already, but you may have worked out your sub nets in a differing manner.