Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

From FreeBSD handbook on the topic of virtual hosts:

For a given interface, there must be one address which correctly represents the network's netmask. Any other addresses which fall within this network must have a netmask of all 1s (expressed as either 255.255.255.255 or 0xffffffff).

Can anybody explain why this is the case?

share|improve this question

3 Answers 3

up vote 1 down vote accepted

In fact you can set the netmask you think is useful.

But, if you change the netmask from /32 you will also need to set a route. If you follow the recommendation you can omit setting a route.

share|improve this answer

Well the FreeBSD manpage on ifconfig is not very helpful:

If the address is on the same subnet as the first network address for this interface, a non-conflicting netmask must be given. Usually 0xffffffff is most appropriate.

But what the above means is that a /32 mask makes this a specific network (The simplest network, a single host, is described by a /32 mask). Having the same netmask as the physical interface does not do any harm, as they are two interfaces on the same network.

Now imagine the alias having a mask that describes a superset network than that of the physical interface, e.g. the physical being 192.168.0.1/25 and the alias 192.168.0.2/24. Is 192.168.0.200 on the network and what does this mean for your alias interface?

share|improve this answer

This page contains a good explanation imho:

Since aliases are, in a sense, duplicate tags, the system needs to know whether the subnet represented by the tag is new, and this is indicated by the netmask. With a "normal" netmask, the system is told this is a new subnet, and it can then set up internal tables correctly. If the subnet is not new, the tables will get set up incorrectly if the netmask is "normal".

With a netmask of 255.255.255.255, the system knows this is a duplicate of an existing subnet, and therefore will assign the address as if it were assigned to the loopback interface, with the "point-to-point" mask.

Assigning a netmask of 255.255.255.0 will, in most cases, appear to work. However, the internal tables will not be set up correctly, and if the alias is removed, problems may ensue. This can be overcome by adding appropriate host routes when the alias is added, and removing the routes when the alias is removed. However, the system works correctly with the "point-to-point" netmask, and maintenance is easier.

share|improve this answer
    
However a "point-to-point" address is a /31 or a /30. A /32 describes a single host. –  adamo Nov 8 '10 at 13:19
    

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.