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 a FreeBSD 8.0 virtual box with two ethernet interfaces, em0 and em1. em0 is and em1 is Both are "Attached to: Bridged Adapter".

When both are up, if I say

# route add default
# netstat -rn
# default          UGS         1        6    em0

So far so good. It picked em0.

# ifconfig em0 down
# route delete
# route add default
# netstat -rn
# default          UGS         1        6    *em0*

Ok. So it still picks em0 (it must really like it) even if it's down. I have tested and if I pick another ip (say for em0 it pickes em1 for the route.

This leaves me wondering: how can I make freebsd choose em1 as the outgoing interface ? In linux I remember we could do it with the dev argument.

P.S. I did try using the -interface option - no luck. I tried

# route add default -interface
# route add default -interface em1

The result was        US          0        0    em0 =>

I am using FreeBSD 8.0-STABLE. Any help will be appreciated.

EDIT: On Debian Lenny the same suite of operations correctly picks the interface that is up as outgoing interface. When both are up

route add default gw

picks eth2 route add default gw dev eth0 picks eth0

So there must be a way to achieve this on FreeBSD, right ?

share|improve this question
up vote 1 down vote accepted

It sounds like you want two IPs and redundant connections. If that's the case you want to create a LAGG adapter, attach it to the two NICs, and put the IPs on the LAGG interface.

If that's not the case can you describe exactly what you're trying to accomplish?

share|improve this answer
While this is quite sensible, it doesn't answer my question. For some obscure reason I want to choose the outgoing interface. Perhaps I like one of them better. Perhaps there is an actual pertinent reason I can;t think of right now. – nc3b Aug 6 '10 at 20:14
Well start with why you have two NICs that are both attached to the same network?? What you're asking for amounts to a configuration that was never meant to be supported. – Chris S Aug 6 '10 at 20:24
So having an interface down (em0) with an ip in that subnet and an interface up (em1) with an ip in the same subnet is not supported ? – nc3b Aug 6 '10 at 20:31
Having two NICs connected to the exact same network and wanting to configure them totally independently is unsupported, yes. While it will obviously work for a great many things, it's not recommended, and you'll run into odd problems, as you already have. There is no reason to configure it this way. – Chris S Aug 6 '10 at 20:43
OK, so the last word is that this it can't be done ? I don't mean to be rude but I believe it can be done and it is simply a bug in route that it's not allowing it. (Not a very good argument but: if the linux crowd supports it I belive someone in some dark corner of the internet once needed it). – nc3b Aug 6 '10 at 20:50

You need to use -ifp flag, not -interface.

share|improve this answer
Could you expand on that a bit please ? – Iain Oct 4 '12 at 6:50
This! I'm using a Mac and this works for me. According to man route(8), -ifp specifies the interface name. – Overmind Jiang Oct 6 '14 at 7:08

You should take a look at the "Link Aggregation and Failover" in the FreeBSD Handbook here

share|improve this answer

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.