Subject: Re: simple-minded configuration for rc?
To: Marshall Rose <email@example.com>
From: Richard Rauch <firstname.lastname@example.org>
Date: 12/14/2002 12:50:34
I faced a similar problem with my laptop. What I did was write an
rc.d/networkprobe script that uses ping to check for known combinations of
hardwired network environments. (Actually, I only had 2 such
environments, and no DHCP normally.) What I came up with was:
# PROVIDE: networkprobe
# REQUIRE: network
# This really should walk through a set of alternative config.
# files, rather than being hard-coded in a shell function as
# I currently do.
echo "Probing network."
if /sbin/ping -h ricegate -qQ -w 1 -c 1 >/dev/null; then
# nothing to do; we are rauch.math.rice.edu
echo " (office)"
/sbin/ifconfig ne0 inet odysseus netmask 255.255.255.248 >/dev/null
/sbin/route change default prodigy-gate
if /sbin/ping -h prometheus -qQ -w 1 -c 1 >/dev/null; then
echo " (home)"
echo " (unknown)"
# Nothing to do, really.
Where "ricegate", "odysseus" and "prodigy-gate" are in my /etc/hosts.
The "office" environment's nameservers worked from other locations, so I
kept just one resolv.conf.
The system was basically hardwired for my office as the first default
(using standard config. mechanisms) and then would *check* if that was
correct; if not, it would retarget, using the above script.
The up side is that this would automatically configure itself. Of course,
it would only do that at boot time, and each failed ping-probe, above,
adds about 1 second. I found it very convenient.
``I probably don't know what I'm talking about.'' --email@example.com