How exactly do subnet masks work in terms of how packets are delivered?

278 viewsOtherTechnology

I’m studying for a certification at the moment so I know a medium amount about the structure of subletting. The one thing my courses don’t explain very well is the actual function/process of how this works.

Specifically one thing I learned really upended my understanding. The example was if you have a host with the address 10.1.16.42/24 and a host with the address 10.1.16.200/16 would they need a router to communicate?

From my understanding they would, the first host is on the network 10.1.16 and the host section is 42. The second one is on 10.1 and the host section is 16.200. Since their network sections are different why do they not need a router to communicate if their network id’s aren’t the same?

In: Technology

6 Answers

Anonymous 0 Comments

“Mask” is a binary bit term – the mask is combined bitwise with the address to determine if the destination is local or remote.

Let’s say you have a network address of [192.168.25.0/24](http://192.168.25.0/24), whose mask [255.255.255.0](http://255.255.255.0) when written out in dotted quad. In binary that’s:

`Network: 11000000.10101000.00011001.00000000`

`Mask: 11111111 11111111 11111111 00000000`

So if we have another address (say, 192.168.25.8), and we want to know if it’s within the network above. To do so, we write the address in binary, and do a binary AND with the network mask.

`Address: 11000000.10101000.00011001.00001000`
`Mask: 11111111.11111111.11111111.00000000`
`Result: 11000000.10101000.00011001.00000000`

You’ll notice that the result is the same as the original network address, which means that [192.168.25.8](http://192.168.25.8) is within the [192.168.25.0/24](http://192.168.25.0/24) network. This means that if your host has an address within the same subnet, the address is a local destination. If the result did *not* match, the host would then look up its routing table for an appropriate forwarding next-hop (usually a default gateway).

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