Date: Thu, 29 Aug 2024 18:06:21 +0200 From: Baptiste Daroussin <bapt@freebsd.org> To: Freddie Cash <fjwcash@gmail.com> Cc: "yann.masson@thehomecave.fr" <yann.masson@thehomecave.fr>, freebsd-net@freebsd.org Subject: Re: wait link up before route configuration Message-ID: <qzj7nbrl4eoqfcwngrnokjxgihzwhy4rqpdb6yqd5qfzepl5rb@o5djjjy33jbm> In-Reply-To: <CAOjFWZ4onB9SGbYNdcxLVdSptZ4Hc=d6JPFw30zwY0=L4FjqfQ@mail.gmail.com> References: <d6e0e453-4322-4d57-9fbe-4b23b80ebfe9@thehomecave.fr> <CAOjFWZ4onB9SGbYNdcxLVdSptZ4Hc=d6JPFw30zwY0=L4FjqfQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed 28 Aug 08:40, Freddie Cash wrote: > On Wed, Aug 28, 2024 at 1:21 AM yann.masson@thehomecave.fr < > yann.masson@thehomecave.fr> wrote: > > > After configuring interfaces and routes, and triggering a 'service netif > > restart && service routing restart' is there a way to wait for the 'carrier > > up' of the interface before route reconfiguration? My use case is a server > > with 2 Mellanox and a Lagg. The 2 mce interfaces are UP in milliseconds but > > the lagg interface takes a few seconds to be UP, and the routing service > > says 'Network unreachable'. The subnet is a /32 and the gateway need a > > static route like: # /etc/rc.conf.d/netif cloned_interfaces="lagg0" > > ifconfig_mce0="up" ifconfig_mce1="up" ifconfig_lagg0="laggproto lacp > > laggport mce0 laggport mce1 198.51.100.1 netmask 255.255.255.255 mtu 1500" > > # /etc/rc.conf.d/routing route_defaultgw="-host 203.0.113.1 -link > > -interface lagg0" defaultrouter="203.0.113.1" static_routes="defaultgw" If > > I run 'service netif restart && sleep 5 && service routing restart', > > everything is ok. I didn't find any options for that, and was thinking > > about a patch in the routing script. Thanks > > > Read through the comments in /etc/rc.d/netwait as that should do what > you're looking for (wait until the interface is active or wait until you > get a ping response from an IP before continuing with network > configuration). > The problem is the route (set by routing rc script) is not reachable until the lagg is ready/up but there is 0 mecanism in the routing script to to an equivalent of netwait. In my opinion we should implement in routing_netwait_if or routing_netwait_ip to make routing wait on some iface to be ready, it can be useful for cases like lagg, but could also be useful for cases like wireguard (when setup only via netif). But I am not sure we haven't missed something obvious. Best regards, Bapt
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?qzj7nbrl4eoqfcwngrnokjxgihzwhy4rqpdb6yqd5qfzepl5rb>