Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Aug 2024 08:40:38 -0700
From:      Freddie Cash <fjwcash@gmail.com>
To:        "yann.masson@thehomecave.fr" <yann.masson@thehomecave.fr>
Cc:        freebsd-net@freebsd.org
Subject:   Re: wait link up before route configuration
Message-ID:  <CAOjFWZ4onB9SGbYNdcxLVdSptZ4Hc=d6JPFw30zwY0=L4FjqfQ@mail.gmail.com>
In-Reply-To: <d6e0e453-4322-4d57-9fbe-4b23b80ebfe9@thehomecave.fr>
References:  <d6e0e453-4322-4d57-9fbe-4b23b80ebfe9@thehomecave.fr>

next in thread | previous in thread | raw e-mail | index | archive | help
--000000000000b4bb1a0620c02e48
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Wed, Aug 28, 2024 at 1:21=E2=80=AFAM 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 'carri=
er
> up' of the interface before route reconfiguration? My use case is a serve=
r
> with 2 Mellanox and a Lagg. The 2 mce interfaces are UP in milliseconds b=
ut
> 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=3D"lagg0"
> ifconfig_mce0=3D"up" ifconfig_mce1=3D"up" ifconfig_lagg0=3D"laggproto lac=
p
> laggport mce0 laggport mce1 198.51.100.1 netmask 255.255.255.255 mtu 1500=
"
> # /etc/rc.conf.d/routing route_defaultgw=3D"-host 203.0.113.1 -link
> -interface lagg0" defaultrouter=3D"203.0.113.1" static_routes=3D"defaultg=
w" 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).

--=20
Freddie Cash
fjwcash@gmail.com

--000000000000b4bb1a0620c02e48
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr">On Wed, Aug 28, 2024 at 1:21=E2=80=AFAM <=
a href=3D"mailto:yann.masson@thehomecave.fr">yann.masson@thehomecave.fr</a>=
 &lt;<a href=3D"mailto:yann.masson@thehomecave.fr">yann.masson@thehomecave.=
fr</a>&gt; wrote:<br></div><div class=3D"gmail_quote"><blockquote class=3D"=
gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(20=
4,204,204);padding-left:1ex"><u></u>

 =20

   =20
 =20
  <div>
    <p><span style=3D"color:rgb(209,210,211);font-family:Monaco,Menlo,Conso=
las,&quot;Courier New&quot;,monospace;font-size:12px;font-style:normal;font=
-variant-ligatures:none;font-variant-caps:normal;font-weight:400;letter-spa=
cing:normal;text-align:left;text-indent:0px;text-transform:none;word-spacin=
g:0px;white-space:pre-wrap;background-color:rgba(232,232,232,0.04);text-dec=
oration-style:initial;text-decoration-color:initial;float:none;display:inli=
ne">After configuring interfaces and routes, and triggering a &#39;service =
netif restart &amp;&amp; service routing restart&#39;
is there a way to wait for the &#39;carrier up&#39; of the interface before=
 route reconfiguration?

My use case is a server with 2 Mellanox and a Lagg. The 2 mce interfaces ar=
e UP in milliseconds but
the lagg interface takes a few seconds to be UP, and the routing service sa=
ys &#39;Network unreachable&#39;.
The subnet is a /32 and the gateway need a static route like:

# /etc/rc.conf.d/netif
cloned_interfaces=3D&quot;lagg0&quot;
ifconfig_mce0=3D&quot;up&quot;
ifconfig_mce1=3D&quot;up&quot;
ifconfig_lagg0=3D&quot;laggproto lacp laggport mce0 laggport mce1 198.51.10=
0.1 netmask 255.255.255.255 mtu 1500&quot;

# /etc/rc.conf.d/routing
route_defaultgw=3D&quot;-host 203.0.113.1 -link -interface lagg0&quot;
defaultrouter=3D&quot;203.0.113.1&quot;
static_routes=3D&quot;defaultgw&quot;

If I run &#39;service netif restart &amp;&amp; sleep 5 &amp;&amp; service r=
outing restart&#39;, everything is ok.

I didn&#39;t find any options for that, and was thinking about a patch in t=
he routing script.

Thanks</span></p>
  </div>

</blockquote></div>Read through the comments in /etc/rc.d/netwait as that s=
hould do what you&#39;re looking for (wait until the interface is active or=
 wait until you get a ping response from an IP before continuing with netwo=
rk configuration).<br clear=3D"all"><div><br></div><span class=3D"gmail_sig=
nature_prefix">-- </span><br><div dir=3D"ltr" class=3D"gmail_signature">Fre=
ddie Cash<br><a href=3D"mailto:fjwcash@gmail.com" target=3D"_blank">fjwcash=
@gmail.com</a></div></div>

--000000000000b4bb1a0620c02e48--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOjFWZ4onB9SGbYNdcxLVdSptZ4Hc=d6JPFw30zwY0=L4FjqfQ>