Home » Questions » Computers [ Ask a new question ]

What is a subnet mask, and the difference between a subnet mask of 255.255.255.0 and 255.0.0.0?

What is a subnet mask, and the difference between a subnet mask of 255.255.255.0 and 255.0.0.0?

My DSL/WiFi router provided by my ISP has an internal IP address of 10.0.0.138, the addresses provided by DHCP are in the format of 10.0.0.xxx.

Asked by: Guest | Views: 498
Total answers/comments: 3
Guest [Entry]

"The zero in the subnet mask will correspond to the xxx of your IP address. If you need more than 255 different addresses, you'll have to change the DHCP IP's to 10.0.xxx.xxx (broadcast IP of 10.0.255.255) and the subnet mask to 255.255.0.0.

Theoretically, 255.0.0.0 is a valid subnet mask for 10.0.0.0 to 10.255.255.255 addresses. This wikipedia article shows the valid addresses for private networks.

But in your case (10.0.0.xxx), you should use 255.255.255.0."
Guest [Entry]

"The netmask is used to identify which portion of the IP address represents the network address and which portion represents the machine address*.

Consider the class A network 10.0.0.0 to 10.255.255.255 (this is the designated ""private"" class A block i.e. packets destined for these addresses will not be routed). In binary the addresses are: 00001010.00000000.00000000.00000000 through to 00001010.11111111.11111111.11111111. The netmask is generated by assigning a 1 for each bit in these addresses that does not change IE:

00001010.00000000.00000000.00000000
00001010.11111111.11111111.11111111
-----------------------------------
11111111.00000000.00000000.00000000

Which converts to 255.0.0.0, the classic class A netmask.

* Actually, to get the network address given an IP address, you just do a logical AND. For example, for the netmask 255.0.0.0 and the IP address 10.0.0.1:

00001010.00000000.00000000.00000001
11111111.00000000.00000000.00000000
-----------------------------------
00001010.00000000.00000000.00000000

And 00001010.00000000.00000000.00000000 translates to 10.0.0.0 which is indeed the network address.

Note that you usually don't need a class A network for a home network (do you need more than 255 addresses?) and can thus use 255.255.255.0 as netmask and/or use a class C network (e.g. 192.168.1.0)."
Guest [Entry]

"I'll answer the practical question. You should always use the ""correct"" subnet mask, unless you are either the network administrator or you understand the bitwise math well.

Since you are probably not using a ""real"" DCHP server, you should use the subnet mask given out by you DHCP server for all systems, including the static addresses. You should also make sure your static numbers are not going to be in the space that your DHCP server allocates out of.

If you provide your OS, I'm sure we can give you the right command to display your current subnet mask on a DHCP client system.

Ideally, you'd be using 255.0.0.0, because for 10.0.0.0, if you used 255.255.255.0, you could only have a 256 addresses space (not a big deal, but who knows, you said you were using .138), PLUS it should provide routing to the other 10.0.0.0 subnets (and I bet it doesn't).

This might matter to some people with unusual work-from-home configurations, like ssh tunnels."