What is a netmask? How does it work?

845 views

I kinda but not really get the super technical explanation of what it is

In: Technology

2 Answers

Anonymous 0 Comments

A netmask defines the range of addresses that are able to see each other on a network without using a router. Ok, but why ?
Internet is a (very very) large network, and you don’t want to get packets of everyone everywhere, because it’s expensive, and it’s not secure etc.
To avoid that, you have to find a way to learn your computers and routers a way to keep packets locally or send them away (by the good path !). It’s all the purpose of IP (like in TCP/IP).

IP creates a segmentation of internet with networks where addresses can talk to each others, and when networks have to exchange packets then come routers. Routers are no more than computers that have an address on two or more networks, are able to pass packet from on to another and are identified by other computers of the network to do this job.

Now, IP network is a rather simple concept, it is defined by the start of the ip address. For instance, at home you probably have a 192.168.0.x address with a [255.255.255.0](https://255.255.255.0) (or 24 bits) netmask, all addresses beginning by 192.168.0. is in this network. It tells every computers that if you want to talk to an ip that starts by this pattern you just have to send data locally (on wifi or ethernet for instance), but most importantly if you look for an ip starting by everything else, you have to talk to the internet box (a router) !
The netmask is no more than the length of digits you have to keep in an ip address to know which network we are talking about. I said earlier that [255.255.255.0](https://255.255.255.0) and 24 bits was equivalent, and that’s because in binary you can write 255 as 11111111, consequently, [255.255.255.0](https://255.255.255.0) can be written 11111111.11111111.11111111.0 that makes 24 ones digits…
if you write ip addresses in binary and compare only digits that are at the place of a one digit in the netmask, then you are doing the job to determine if these addresses are in the same network.

You are viewing 1 out of 2 answers, click here to view all answers.