Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I did a lot of searching, but there seems to be conflicting info on what the proper netmask for an aliased IP address should be. Some of the conflicting info seems to be FreeBSD-specific. I'm looking for the "most technically proper" answer, if there is one.

I've been assigned x.x.x.168/29.

Here is eth0:

address x.x.x.170
gateway x.x.x.169

So the proper eth0:0 netmask should be 255.255.255.something.

EDIT: Per the comment from Chris S, I am not using FreeBSD; I am using Debian. My understanding is that FreeBSD users should use .255 for aliases. But I could be wrong, so you should do your own research.

share|improve this question
It should be exactly the same as any other IP in that range, unless you have a specific reason to restrict it to a smaller subnet. – NickW Jun 14 '13 at 11:34
I assume you're not running one of the BSDs, it would be important to mention that in the question. The answer is not the same for all OSes, despite what several people apparently think. – Chris S Jun 14 '13 at 13:34
up vote 5 down vote accepted

Your eth0:0 subnet mask should be, unless you have some reason that you do not want eth0:0 to communicate directly with the rest of the hosts in the subnet. If you make it smaller, you will need a router to allow that IP to communicate with the rest of the network.

share|improve this answer
Thanks for the explanation. I'll leave this question open for a bit to see if anyone else wants to elaborate, but I have a feeling that's about all there is to say on the subject of "proper netmask definition." ;) – Jeff Jun 14 '13 at 11:49

The netmask is per network, not per IP, so as NickW says, it should be the same for all IPs in a given network. There are corner cases where you may restrict a given alias interface further, but those are exceedingly rare.

share|improve this answer

Nick W's answer is correct.

However well you understand the theory of these CIDR network specifications, working the numbers out by hand is tedious and error prone. I recommend a tool called ipcalc which is available in the software repositories associated with many of the major Free *nix distributions. It's good for getting the calculations right, and also as an educational tool, clarifying what the numbers represent, by showing you the binary representations.

me@mine$ ipcalc  
Address:            00000001.00000010.00000011.10101 000  
Netmask: = 29 11111111.11111111.11111111.11111 000  
Wildcard:              00000000.00000000.00000000.00000 111  
Network:         00000001.00000010.00000011.10101 000  
HostMin:            00000001.00000010.00000011.10101 001  
HostMax:            00000001.00000010.00000011.10101 110  
Broadcast:            00000001.00000010.00000011.10101 111  
Hosts/Net: 6                     Class A  
share|improve this answer

Depends on what do you need :

  • if you need the aliased IP to be used to communicate with the same network then you should use the same netmask

  • if you need the aliased IP to be used in another network (for examples, you don't want this IP to receive any broadcast or any packets from other networks, and dedicate it for a reason to another network) then assign to it the right netmask

For your information, the netmask is used to fragment your networks, so be careful not to overcross them, or you will have conflicts.

share|improve this answer

Your Answer


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.