Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 May 2020 15:54:04 -0700
From:      Scott Gasch <scott.gasch@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   Persistent static route not present after reboot
Message-ID:  <CABYAQkSDGnX6VnTmy1NtprQ+YNX3scdVH8MmHv=B43AFU7+pww@mail.gmail.com>

Next in thread | Raw E-Mail | Index | Archive | Help
Hi,

I'm trying to add a persistent static route to a freebsd machine:

# uname -a
FreeBSD backup 12.1-RELEASE-p2 FreeBSD 12.1-RELEASE-p2 GENERIC  amd64

I've done this by adding these lines to rc.conf per this doc
<https://www.freebsd.org/doc/handbook/network-routing.html>;
:

defaultrouter="10.0.0.1"
static_routes="vpn"
route_vpn="-net 192.168.0.0/24
 10.0.0.18"

When I reboot the machine, the route is not there:
# netstat -rn
Routing tables
Internet:
Destination        Gateway            Flags     Netif Expire
default            10.0.0.1           UGS         em0
10.0.0.0/24
        link#1             U           em0
10.0.0.33          link#1             UHS         lo0
127.0.0.1          link#4             UH          lo0
However if I run "service routing restart" the route is added.  Why isn't
this happening at boot time?

# service routing restart
Doing route _loopback
delete host 127.0.0.1
: gateway lo0
Doing route vpn
route: route has not been found
delete net 192.168.0.0
: gateway 10.0.0.18 fib 0: not in table.   // <--- not there to tear down
Doing route _default
delete net default: gateway 10.0.0.1
delete host ::1: gateway lo0
delete net fe80::: gateway ::1
delete net ff02::: gateway ::1
delete net ::ffff:0.0.0.0
: gateway ::1
delete net ::0.0.0.0
: gateway ::1
Doing route _loopback
add host 127.0.0.1
: gateway lo0
Doing route vpn
add net 192.168.0.0
: gateway 10.0.0.18.    // <--- but happy to add it now.
Doing route _default
add net default: gateway 10.0.0.1
add host ::1: gateway lo0
add net fe80::: gateway ::1
add net ff02::: gateway ::1
add net ::ffff:0.0.0.0
: gateway ::1
add net ::0.0.0.0
: gateway ::1

Thx,
Scott



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?CABYAQkSDGnX6VnTmy1NtprQ+YNX3scdVH8MmHv=B43AFU7+pww>