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 two NICs on my FreeBSD server, which are set up like this in rc.conf:

ifconfig_em0="    netmask"        # LAN NIC
ifconfig_em1="DHCP"                                     # WAN NIC

This setup doesn't give any default route, only (assuming is the WAN IP of em1):         ---> em0  ---> em1

When I try to ping WAN IPs like, I get No route to host. (Why? Doesn't mean almost the same as default?) Anyway, I can run add route default -iface em1, and then WAN IPs are directed through em1, as they should.

How do I make interface em1 the default, reboot-persistent route for my system? I.e., how can I say add route default -iface em1 in rc.conf? (I have to make the route interface-specific and not specific to the interface's IP, because the IP of em1 is dynamically given by my ISP.)

I've tried the following without success:

route_mydefault="default -iface em1"


defaultrouter="-iface em1"
share|improve this question
Is it possible for you to switch NIC's so that em0 would be the one who use DHCP and em1 is the one with the static IP? That would probably solve this in a easy way. – pauska Feb 1 '12 at 19:00
@pauska Really?! em0 is considered as default before em1? Sounds like a tempting, easy answer to this nuisance. Anyways, I'd like to know if there's a solution without switching roles of the two NICs. – poplitea Feb 1 '12 at 19:04
re "Doesn't mean almost the same as default?" No. The default is The /32 means narrowing to one host only. – kubanczyk Feb 1 '12 at 22:28
Did you check, that your ISP sends a Defaultgw with DHCP? Do you use any custom dhclient configuration? try to run dhclient manually and see what happens. – arved Feb 3 '12 at 10:18
up vote 3 down vote accepted

Gah - totally rewritten because I misread the question!

It sounds like your route may not be coming up because em1 isn't up and ready when the rc scripts go to set the default router. You can use the defaultroute_delay option in rc.conf to make the system wait a while before bringing up the default routes.

Also like @arved said you may want to make sure your ISP is sending the router information in their DHCP leases -- If you want to use their gateway they should be specifying one, otherwise you will only be able to reach devices on the subnet they specify.

share|improve this answer
Thanks for the defaultroute_delay-tip! I'll check that one out. – poplitea Feb 14 '12 at 19:44

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.