I am running FreeBSD 8.1 and configuring static routes. What is the route command to set the gateway to link#1 and not an IP address?

I tried route add default link#1 but FreeBSD doesn't take it. With Cisco IOS it's possible to route to a next-hop gateway this way with ip route. For example, Cisco IOS will take ip route Serial 0/0. What is the equivalent UNIX command to do the same?

I statically configured netif em0 to The state of my FreeBSD instance shows link#1 exactly once as follows.

Destination     Gateway
localhost      link#3    UH   ...    lo0     link#1    U    ...    em0


You need to stop, take 10 giant steps back from the machine, and read the FreeBSD handbook section on networking (specifically the section on Gateways and Routes).

. . . go ahead, this answer will still be here when you're done. . . .

You read it? Good.
Now you understand that what you're asking to do makes no sense, right?

FreeBSD generally handles routes two ways:

  1. I am connected to this network directly, via a NIC (interface, link)
    The system knows this because when you configure an interface you provide an IP address and a netmask. Any machines on the subnet specified by that combination are reachable over that link.

  2. I can reach this network via a gateway machine with a specific IP address
    The system knows this because you configure a route to a specific destination (a single address, a subnet, or the "default" route for any destination not otherwise specified), and tell it which machine (address) will be the gateway that it should send traffic to in order to reach that destination.
    Implicit in this is that you must be able to reach this gateway (either via a link as in (1) above, or via another gateway.

You cannot configure a link as a gateway - doing so makes no sense as any network(s) reachable via a specific link will be automatically configured for you when you configure the interface.

You can do other things (like simply spew traffic onto a serial line), which are all documented in the handbook if you're actually in one of the rare situations where you would need to, but you've given no indication that you're in such a situation.

  • while overall helpful. your second link may as well be a "link to RTFM". which page? – T. Webster Apr 13 '13 at 16:57
  • @T.Webster The. Whole. Thing. (No, I'm not being facetious.) You are expected as a professional to read all the relevant documentation. If you're administering FreeBSD systems the whole handbook is relevant, and you should be at least familiar with its entire breadth of contents so you know where to look...) – voretaq7 Apr 15 '13 at 16:17

Actually you can only add "interface" routes on cisco with point-to-point interfaces, not multiple access ones like FastEthernet.

So, to make a default route with ethernet on cisco you should use "next hop" address like this:

ip route FastEthernet0/0

Same things with BSD box. But if you only like to add network route as "ip route Serial 0/0" with FBSD, you can do something about:

route add -iface em0


You know, I added a second interface and configured it with an internal IP address ( and was expecting to see a route to to show up on link#4 or whatever this interface ended up being, but it wasn't there. Thus it brought me to this question. In the end, I rebooted pfSense out of desperation and BAM, there it was and things started working the way I needed. Maybe this will not answer your exact question, but it answered mine.

In my situation I did have to do one more thing though to get it working: enable Hybrid outbound NAT and setup an outbound rule so that when traffic came into my server (TrueNAS in this case, FreeBSD) it appeared to be coming from the pfSense firewall itself ( and could easily route it back on the correct interface:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.