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 have an interface with an IP in a class B subnet. I want to add another IP in the came class B as an alias on the same interface. What netmask should I use? Some people say to use, while others say to use the regular netmask of the network, i.e. in my case. Which is correct, and more importantly why?

In case it matters, I'm using Linux (CentOS 5)

share|improve this question
Assuming you mean /16 when you say Class B... The mask tells an interface the two parts of an address, network and host. So if you had /24 as an IP address on the interface and you wanted to add another IP address in network as an alias it should also have a /24. /32 wouldn't be a good practice. – dbasnett Oct 7 '10 at 14:58

I've seen it done both ways on a lot of servers, either way works just fine in practice. As long as your normal routing is correct and the network is going out the right gateway and device, a /32 will work just as well as a /24 or /16 on an aliased IP.

share|improve this answer
I agree even though it's not the cleanest solution :) – Antoine Benkemoun Oct 7 '10 at 15:22
I agree - I prefer to match the netmask of the primary IP myself, but technically if they're in the same subnet a /32 will work. Not everyone cares about crossing their Ts and dotting their Is like we do. – troyengel Oct 7 '10 at 16:12

Since both IPs are on the same interface, I don't see how there would be any practical differences between using /16 and /32.

Care to elaborate on what you're trying to achieve?

share|improve this answer

It should be the same netmask as the regular network connection. It's just another IP sitting on the same wire, it needs to have a matching netmask. if you did /32 it wouldn't be able to talk to anything and everything would be a foreign host to it.

share|improve this answer
sorry, this is just untrue. not being a hater, but /32 on an aliased IP works just fine. – troyengel Oct 7 '10 at 16:01

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.