Re: Custom static route not applied at reboot

From: Scott Gasch <scott.gasch_at_gmail.com>
Date: Tue, 30 Nov 2021 01:01:41 UTC
This worked really well, Joost.  Thank you.

I now have the static route defined in rc.conf and dhclient.conf.  The last
time I rebooted I was sitting at the console and saw a message that didn't
make it into dmesg saying something like "destination unreachable" when it
tried to add the static route the first time -- I assume from rc.conf.
When I got a login prompt and checked, though, the route was there (I
assume from the dhcp after actions).

Thx,
Scott


On Mon, Nov 29, 2021 at 10:08 AM Joost Bekkers <joost@jodocus.org> wrote:

> On 2021-11-27 05:24, Scott Gasch wrote:
> > Any suggested remedy other than a sleep 20; route add -net
> > 192.168.0.0/24
> > -gateway 10.0.0.225 in my rc.local?  There must be a less ugly way than
> > that, no?
> >
>
> Assuming using a static ip address is not an option, you could tell
> dhclient to add the route.
>
> The option classless-routes (#121, RFC3442) is not in the
> dhcp-options(5) man page, but is is implemented in the client.
>
> Your dhclient.conf would look something like this:
>
> interface "igb0" {
>    append classless-routes 24,192,168,0,10,0,0,225;
> }
>
> Please note: Because all relevant bytes of the network fit in the first
> 3 bytes (24/8 <= 3), you don't specify the fourth.
>
> I haven't tested if it works when specified in the .conf, but I've seen
> it work when the server sends it.
>
>
>
> Joost.
>
>