Setting up a device on a home network sometimes requires that you manually enter an IP address.
However an IP address alone isn’t sufficient as you will also be require to enter a subnet mask.
So what is a subnet mask and what does it do? and is it important?
Before we look at subnet masks you first need to understand IP addresses.
IP Addresses and IP Address Structure
IPv4 uses 32 bits for addressing. These 32 bits are split into 4 bytes and each byte is separated by a dot(.). So it is of this form:
Where the value of a,b,c or d is between 0-255 decimal. A typical IP address appears like this:
An IP address has two components- A network component, and a node component.
As an Analogy if you think of the address of your house it is of the form
House Number + Street name e.g 22 queen Street.
For computer networks the network number is equivalent to the street name and the house number is the Node Address.
The purpose of the subnet mask is to split the IP address into the two components.
When you combine, using a logical AND, the IP address and the mask you reveal the network address.
So if you have an IP address of 192.168.1.254 and a mask of 255.255.255.0 the network address is 192.168.1 and the host or node is 254.
If we do some more examples:
!P address 10.0.1.1 mask 255.0.0.0
then network is 10 and host is 0.1.1
!P address 10.0.1.1 mask 255.255.0.0
then network is 10.0 and host is 1.1
Understanding The Importance Of the Subnet Mask
The mask is important as hosts on the same network can talk to each other without a router whereas if they are on a different network then they need a router.
So if we incorrectly configure two hosts which are on the same physical network with the following IP addresses and mask.
Host 1 IP= 192.168.1.1 Mask 255.255.255.0
Host 2 IP= 192.168.1.2 Mask 255.255.0.0
Then host 1 thinks it is on network 192.168.1 and host 2 thinks it is on the network 192.168.
So what will happen if host1 tries to talk a host3 with IP address 192.168.2.3?
Because host3 is on a different network to host1 it willl try to use a router to communicate, and will fail.
Default Mask on Home Networks
Even if you haven’t quite grasped the subnet mask it is important that you understand that the mask should be the same on all hosts on the same network.
Which on a home network is usually all hosts, as a home network isn’t subdivided into sub networks, and doesn’t use a router internally.
On a home network the only router used is the one that connects the home network to the Internet.
On a home network the mask 255.255.255.0 is almost always used.
Related Tutorials and Resources:
I think you introduced a new typo after you fixed the one highlighted in a previous comment:
“So if you have an IP address of 192.168.1.254 and a mask of 255.255.255.0 the network address is 192.168.0 and the host or node is 254”
Shouldn’t this read “…the network address is 192.168.1 and the host or node is 254”?
Correct tks for letting me know. I have corrected it.
I am going down a rabbit hole which started at TCP/IP protocol suite and has taken me to DNS, DHCP and now subnet masks. Your explanation is outstanding. I have watched several videos about subnet masks but your paragraph has trumped them all.
I can get my “external IP address” from the site http://www.whatsmyip.com.
Question is what is the subnet mask that goes with my “external IP address”?
You would get that from the router however min doesn’t display it so you can probably assume it is the default mask for that address class.
Ok, if I have two “networks” with 192.168.1 and 192.168.2 with both having sub net masks of 255.255.255.0 and put a computer in either subnet with with a sub net mask of 255.255.0.0 will it be able to communicate with all of the computers in both submets?
You haven’t said what Ip address the computer has. But probably not as the the two different subnets require a router. if you change the subnet on all to 255.255 then that should work.
So, if I have a “normal” Network with the mask 255.255.255.0 and a guest network on the same router, that I want to prevent from communicating with the “normal” network, the guest network should have it’s own mask, e.g 255.255.0.0?
The guest network should have its own network address it the separation is done by a router. Using a mask of 255.255.255.0 the 192.168.1.0 and 192.168.2.0 are two separate networks.
so if the mask is 255.255.0.0, your host is .0.0 right therefor if ip address is 192.168.1.1 your network component can be configured as 192.168.1.(2-254) or 192.168.(2-254).1 ?
Yes you host can be
It means that you have 16 bits for the host so around 64000 addresses
So if you have an IP address of 192.168.1.256 and a mask of 255.255.255.0 the network address is 192.168.1 and the host or node is 254.
i think you had a typo and and the IP ends with 254 or the host is 256
otherwise great explanation! tx
Sorry corrected host was 254.