I have two NICs on my FreeBSD server, which are set up like this in rc.conf:
ifconfig_em0="10.0.0.1 netmask 255.255.255.0" # LAN NIC
ifconfig_em1="DHCP" # WAN NIC
This setup doesn't give any default route, only (assuming 123.123.123.123 is the WAN IP of em1):
10.0.0.0/24 ---> em0
123.123.123.123/32 ---> em1
When I try to ping WAN IPs like 8.8.8.8, I get No route to host. (Why? Doesn't 123.123.123.123/32 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:
static_routes="mydefault"
route_mydefault="default -iface em1"
and
defaultrouter="-iface em1"