Topic: Why do aliases have a different netmask

This is something where I understand the how, but have never understood the why.

Suppose I add an alias to a simple 192.168.1.0 network. The original network has the 24 bit mask, 255.255.255.0

Now, I add an alias.  Say the original interface is 192.168.1.20 and the alias is 192.168.1.21.  The netmask for the alias is 255.255.255.255 (or /32 or 0xffffffff). 

I know that this works, it's well documented in the FreeBSD ifconfig manpage, as well as in the OpenBSD faq.  We won't talk about the Linux ifconfig man page, which doesn't even mention alias save for some note about something about process accounting.  I'm not even sure if the netmask requirement is the same, but at any rate, it's not relevant here. 

In general, of course, two separate machines with different netmasks wouldn't be able to reach each other.  So, why is it done this way?

Thanks for any answers.

<@andre> i would be so much more efficient if i wasn't so stupid

Re: Why do aliases have a different netmask

This is mostly an educated guess: The netmask is used by the kernel for routing and broadcasts. The alias' /32 netmask marks it as an alias, and prevents things like duplicate broadcasts or routing confusion. I'd say this could have been done differently, but seems to have

Re: Why do aliases have a different netmask

Thanks--actually I saw that post in my search for the answer to this--I should have mentioned that I'd googled it but not come up with anything really helpful.

Re your BTW, yes, as I did remember to say, this would be for two addresses in the same subnet, e.g., 192.168.1.20 and 192.168.1.21.

Thanks

<@andre> i would be so much more efficient if i wasn't so stupid