0

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 255.255.255.255, while others say to use the regular netmask of the network, i.e. 255.255.0.0 in my case. Which is correct, and more importantly why?

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

1
  • 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 192.168.254.42 /24 as an IP address on the interface and you wanted to add another IP address in network 192.168.254.0 as an alias it should also have a /24. /32 wouldn't be a good practice.
    – dbasnett
    Oct 7, 2010 at 14:58

3 Answers 3

1

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.

2
  • I agree even though it's not the cleanest solution :) Oct 7, 2010 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.
    – user15590
    Oct 7, 2010 at 16:12
0

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.

1
  • 1
    sorry, this is just untrue. not being a hater, but /32 on an aliased IP works just fine.
    – user15590
    Oct 7, 2010 at 16:01
0

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?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .