Date: Wed, 28 Aug 2024 18:33:23 +0200 From: "yann.masson@thehomecave.fr" <yann.masson@thehomecave.fr> To: Freddie Cash <fjwcash@gmail.com> Cc: freebsd-net@freebsd.org Subject: Re: wait link up before route configuration Message-ID: <203f3066-af9e-40f9-bef3-89dd7b636dc7@thehomecave.fr> 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
This is a multi-part message in MIME format. --------------0qB0u0yPc0p76cb4o3xmB0uH Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit /etc/rc.d/netwait dependencies are # PROVIDE: netwait # REQUIRE: devd ipfw pf routing [truncated] rcorder -p /etc/rc.d/* /etc/rc.d/netif /etc/rc.d/routing /etc/rc.d/netwait I've tested netwait. It doesn't work If i configure routing like that: # /etc/rc.conf.d/routing route_defaultgw="-host 203.0.113.1 -link -interface lagg0" route_default="-net 0.0.0.0/0 -interface lagg0 203.0.113.1" static_routes="defaultgw default" It works, but the routing table went from # netstat -rn Routing tables Internet: Destination Gateway Flags Netif Expire default 203.0.113.1 UGS lagg0 198.51.100.1 link#10 UH lo0 203.0.113.1 link#10 UHS lagg0 127.0.0.1 link#3 UHS lo0 to Internet: Destination Gateway Flags Netif Expire default link#10 US lagg0 198.51.100.1 link#10 UH lo0 203.0.113.1 link#10 UHS lagg0 127.0.0.1 link#3 UHS lo0 I don't know if it's good or not. On 8/28/24 17: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). > > -- > Freddie Cash > fjwcash@gmail.com --------------0qB0u0yPc0p76cb4o3xmB0uH Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body> <p>/etc/rc.d/netwait dependencies are<br> # PROVIDE: netwait<br> # REQUIRE: devd ipfw pf routing<br> <br> [truncated] rcorder -p /etc/rc.d/*<br> /etc/rc.d/netif<br> /etc/rc.d/routing<br> /etc/rc.d/netwait</p> <p>I've tested netwait. It doesn't work<br> </p> <p><br> If i configure routing like that:<br> <span style="color:rgb(209,210,211);font-family:Monaco,Menlo,Consolas,"Courier New",monospace;font-size:12px;font-style:normal;font-variant-ligatures:none;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;word-spacing:0px;white-space:pre-wrap;background-color:rgba(232,232,232,0.04);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"># /etc/rc.conf.d/routing route_defaultgw="-host 203.0.113.1 -link -interface lagg0" route_default="-net 0.0.0.0/0 -interface lagg0 203.0.113.1" static_routes="defaultgw default"</span></p> <div class="moz-cite-prefix">It works, but the routing table went from</div> <div class="moz-cite-prefix"><span style="color: rgb(209, 210, 211); font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12px; font-style: normal; font-variant-ligatures: none; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: pre-wrap; background-color: rgba(232, 232, 232, 0.04); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"># netstat -rn Routing tables Internet: Destination Gateway Flags Netif Expire default 203.0.113.1 UGS lagg0 198.51.100.1 link#10 UH lo0 203.0.113.1 link#10 UHS lagg0 127.0.0.1 link#3 UHS lo0</span></div> <div class="moz-cite-prefix"><br> </div> <div class="moz-cite-prefix">to</div> <div class="moz-cite-prefix"><span style="color: rgb(209, 210, 211); font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12px; font-style: normal; font-variant-ligatures: none; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: pre-wrap; background-color: rgba(232, 232, 232, 0.04); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">Internet: Destination Gateway Flags Netif Expire default link#10 US lagg0 198.51.100.1 link#10 UH lo0 203.0.113.1 link#10 UHS lagg0 127.0.0.1 link#3 UHS lo0</span></div> <div class="moz-cite-prefix"><br> </div> <div class="moz-cite-prefix">I don't know if it's good or not.<br> <br> </div> <div class="moz-cite-prefix"><br> </div> <div class="moz-cite-prefix"><br> </div> <div class="moz-cite-prefix">On 8/28/24 17:40, Freddie Cash wrote:<br> </div> <blockquote type="cite" cite="mid:CAOjFWZ4onB9SGbYNdcxLVdSptZ4Hc=d6JPFw30zwY0=L4FjqfQ@mail.gmail.com"> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <div dir="ltr"> <div dir="ltr">On Wed, Aug 28, 2024 at 1:21 AM <a href="mailto:yann.masson@thehomecave.fr" moz-do-not-send="true" class="moz-txt-link-freetext">yann.masson@thehomecave.fr</a> <<a href="mailto:yann.masson@thehomecave.fr" moz-do-not-send="true" class="moz-txt-link-freetext">yann.masson@thehomecave.fr</a>> wrote:<br> </div> <div class="gmail_quote"> <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <div> <p><span style="color:rgb(209,210,211);font-family:Monaco,Menlo,Consolas,"Courier New",monospace;font-size:12px;font-style:normal;font-variant-ligatures:none;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;word-spacing:0px;white-space:pre-wrap;background-color:rgba(232,232,232,0.04);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">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</span></p> </div> </blockquote> </div> 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).<br clear="all"> <div><br> </div> <span class="gmail_signature_prefix">-- </span><br> <div dir="ltr" class="gmail_signature">Freddie Cash<br> <a href="mailto:fjwcash@gmail.com" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">fjwcash@gmail.com</a></div> </div> </blockquote> </body> </html> --------------0qB0u0yPc0p76cb4o3xmB0uH--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?203f3066-af9e-40f9-bef3-89dd7b636dc7>