Best way to make a machine boot with or without a Internet connection

Polytropon freebsd at edvax.de
Fri Aug 7 19:19:51 UTC 2020


On Fri, 7 Aug 2020 14:54:13 -0400, Aryeh Friedman wrote:
> On Fri, Aug 7, 2020 at 1:24 PM Mario Lobo <lobo at bsd.com.br> wrote:
> 
> > On Thu, Aug 6, 2020 at 6:20 PM Aryeh Friedman <aryeh.friedman at gmail.com>
> > wrote:
> >
> > > Due to storm related damage my ISP went out for a few (12) hours earlier
> > in
> > > the week and while I got it usable without a Internet connection by
> > putting
> > > everything in my LAN in /etc/hosts (I also run a local_unbound --> local
> > > bind9 on my file server which I have created a zone file for the LAN
> > > machines also), but it was very slow in booting due to ntpdate, tomcat
> > and
> > > sendmail not being to connect to the Internet for either forward or
> > reverse
> > > DNS.   I don't want to turn these services off, but I want to be able to
> > do
> > > a normal boot (no long hangs) if the ISP goes down again.   What is the
> > > best way to do this?
> > >
> > > --
> > > Aryeh M. Friedman, Lead Developer, http://www.PetiteCloud.org
> > > _______________________________________________
> > > freebsd-questions at freebsd.org mailing list
> > > https://lists.freebsd.org/mailman/listinfo/freebsd-questions
> > > To unsubscribe, send any mail to "
> > > freebsd-questions-unsubscribe at freebsd.org"
> > >
> >
> > This is a long shot but perhaps you could find a way to start these
> > services in the background (&).
> >
> 
> Given they are done by /etc/rc based on rc.onf not likely

The "problem" is that rc, in combination with rc.conf and
the responsible rc.d/ scripts, determines the order in which
certain services have to be started. A workaround would be
to use /etc/rc.local to manually do what rc would do with
its internal logic. Using this approach, you could set the
exact order as well as tests for "is currently connected
to the Internet", starting all subsequent tasks that do
require an online connection. You would put the first
steps into the background, using &, and you could then
even invoke "service netif start" (or parts thereof),
followed by your own services (such as ntp, webserver,
mailserver). Such a mechanism could be configured to
set a flag, for example stupidly simple as a "lock file",
and repeat to test for Internet availability until the
Internet becomes available - then stop. Some further
logic could be added to check if the connection stays
alive, and if it goes down, stop the services, remove
the lock file, and keep trying at a specified interval.

Of course, this is all manual stuff, nothing is provided
by the OS to handle this in an appropriate fashion and
doesn't even look right... ;-)



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list