multiple interfaces on same subnet?

Malcolm Kay malcolm.kay at
Tue Aug 1 23:37:35 UTC 2006

On Tue, 1 Aug 2006 05:10 am, Joseph Gleason wrote:
> Is it possible to reach two hosts via two interfaces that are
> both on the same subnet?
> Example:
> em0:
> em1:
> And I want to reach via em0 and via em1.
> From 'netstat -nr' I see a line like this:
> 172.20/14          link#1             UC          0        0  
>  em0
> This seems to say that anything on 172.20/14 should be reached
> on em0. Is it possible to add a rule that says that
> should be reachable on em1?

I have no personal experience of doing this, but it seems to me 
you should be able to achieve your objective by using a specific 
netmask with ifconfig rather than the CIDR / notation: -> netmask -> netmask

Then as I understand it odd numbered addresses should be reached 
via and even numbered addresses via

> I only care about the path of outbound packets.  I don't care
> which interface inbound traffic comes on.
> I am well aware that this is a fairly strange thing to do.
> My objective is to have a FreeBSD box balance outbound traffic
> between two NICs, while being able to select from among many
> routers that could be the default gateway and having the two
> NICs connect to different switches for fault tolerance. (I
> would do the fault tolerance via a watchdog script of some
> sort)
> If it weren't for the many routers aspect, it would be
> reasonable to create separate subnets.  I need to be able to
> select from a group of around 10 possible default gateways and
> some of those routers I do not control so adding a subnet
> would be trouble.

I would expect that subnets in the routers would not be an issue 
so long as they encompass those set in ifconfig.


More information about the freebsd-questions mailing list