Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

Now, I want to start using static IP addresses on my local network, and I don't know what to provide for the subnet mask.

What is a subnet mask?

Should I be using 255.255.255.0 or 255.0.0.0 as my subnet mask? What is the difference?

share|improve this question
3  
So essentially the "subnet mask" indicates which part of the IP number are relevant. Since I'm only using the last triplet, I would use 255.255.255.0 to mask out the first three triplets. Thanks for your answers! –  Torben Gundtofte-Bruun Oct 13 '09 at 13:55
    
correct. For your private network it doesn't matter though. It only matters if you want to separate different parts of your network. –  StampedeXV Oct 13 '09 at 14:03
1  
It doesn't exactly "mask out" any of the octets (in fact it doesn't have to provide an 8-bit boundary at all). It just designates which part of the IP is the network identifier and which part is the host identifier. –  MDMarra Oct 13 '09 at 14:04
    
Over-simplifying a bit: Anything with the same subnet mask can talk to each other directly without going through a router (in fact, a router must NOT be used). Anything that wants to talk to a host with a different subnet mask needs to go through a router (or the IP that is the default gateway) to get to that host. –  ultrasawblade Sep 16 '12 at 14:17

6 Answers 6

up vote 21 down vote accepted

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.

share|improve this answer

Most probably, you are after a subnet mask of 255.255.255.0.

A subnet mask refers to the practice of subnetting, which is, from my understanding of it, a way of dividing one network into smaller logical networks. A subnet mask is used to tell the network devices (whether it be the computer or any routers, modems, etc.) what addresses are local (belongs to this network), and what addresses are remote (belongs to that network).

So, if a computer's IP address is 192.168.1.104, and its subnet mask is 255.255.255.0, then the computer (and every other device attached to the same network) will assume that every IP on that computer's local network will be in the format 192.168.1.xxx, with xxx being the only part that would vary. Likewise, if the subnet mask is 255.255.0.0, then the computer will assume that every IP address in its local network will be in the format of 192.168.xxx.*xxx*.

Subnetting a network is not really useful in a home network, such as yours. It is mainly used on larger networks (with 255+ computers) to reduce unnecessary network activity. MarkM provided this in the comments:

One of the biggest advantages of subnetting in a large network is to reduce the broadcast traffic. If you have thousands of hosts on a single subnet, your switches will be choking on ARP, DHCP, and other broadcasts. In a home network usually there isn't much of a need unless you want something like a guest wireless LAN that doesn't have any routing available to your main home network.

This explanation is very rough and sketchy, so please forgive me if I have made a mistake or two.

share|improve this answer
1  
One of the biggest advantages of subnetting in a large network is to reduce the broadcast traffic. If you have thousands of hosts on a single subnet, your switches will be choking on ARP, DHCP, and other broadcasts. In a home network usually there isn't much of a need unless you want something like a guest wireless LAN that doesn't have any routing available to your main home network. –  MDMarra Oct 13 '09 at 14:08

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.

share|improve this answer
3  
There's no real reason to use an 8 bit netmask there. There's nothing wrong with it, but it's bad form. You can use a 23 bit netmask (255.255.254.0) and have an additional 254 addresses available. There aren't 256 addresses on a /24 subnet because .0 and .255 are both reserved for network identifier and broadcast address respectively. –  MDMarra Oct 13 '09 at 20:24

Since torbengb's ISP gave him a router (or told him to configure his router) with the address 10.0.0.138, it leads me to suspect that this ISPs customers share the 10.0.0.0 address space; otherwise most poeple would configure the router at 10.0.0.1 or 192.168.0.1 or similar.

In that case, it's important that he use the netmask his ISP gave him, or he may trample on addresses the ISP is handing out to other users.

If he's sure his router is doing NAT, then he can probably use anything from /8 to /24.

Without knowing the details of the connection and ISP config, it's hard to give a definitive answer.

The netmask DOES separate your addresses into the network portion and the host portion, but the practical reason is so your router, and the routing code in your hosts, can know which destination addresses are on your local network and which need to have their packets sent through the router's uplink.

share|improve this answer

In more technical terms, the subnet mask helps machines identify the network number associated with a given IP address. The 255 represents all 1's for that byte of the address and when you perform a bit-wise AND between the address and the mask, you get the network number back. What's left is the machine number

So

IP Address 192.168.1.1
Subnet mask 255.255.255.0
Network Number 192.168.1.0
Host Number 1
Address Range 192.168.1.1 to 192.168.1.255

Alternately,

IP Address 192.168.1.0
Subnet mask 255.255.254.0
Network Number 192.168.0.0
Host Number 1
Address Range 192.168.0.1 to 192.168.1.255

This second configuration leaves 9 bits for the host number (in an instance where you would have more than 255 hosts). Adjusting the subnet mask gives you more host addresses and less networks or vice versa depending on whether you add or remove 1's

share|improve this answer
    
It may be more helpful to show available address ranges in your example as well. 192.168.1.1-192.168.1.254 and 192.168.0.1-192.168.1.254 –  MDMarra Oct 13 '09 at 20:28
    
Good call, done. I probably should have chosen a more obvious example, this might be a little to subtle... –  Chris Thompson Oct 13 '09 at 21:27

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).

share|improve this answer
    
Argh! Not binary! slits wrist –  David Pearce Oct 13 '09 at 15:03
5  
In practice no one uses classes anymore. It's usually only taught as a history lesson. CIDR is used instead now en.wikipedia.org/wiki/Classless_Inter-Domain_Routing –  MDMarra Oct 13 '09 at 15:08
    
don't know that CIDR is any simpler to understand... :) –  quack quixote Oct 13 '09 at 15:44
2  
You can still operate on the Class boundaries and have your network function normally but it is antiquated. CIDRs of /8 /16 and /24 represent what Class A, B and C used to. –  MDMarra Oct 13 '09 at 18:32
1  
This should help out your subnet calculating fears :) subnet-calculator.com/cidr.php –  MDMarra Oct 13 '09 at 23:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.