Re: Resolvconf -- a package to manage /etc/resolv.conf
On Sep 28, Manoj Srivastava (srivasta@debian.org) wrote:
> On Fri, 26 Sep 2003 21:37:21 +0200, Thomas Hood <jdthood@yahoo.co.uk> said:
>
> > On Fri, 2003-09-26 at 20:25, Manoj Srivastava wrote:
> >> I have a laptop that sometimes is on fixed ip wireless
> >> networks. Since dhcp is not involved, there is nothing that updates
> >> resolvconf, which could be pointing to an inaccurate set of
> >> servers.
>
> > If you bring the interface up with ifup then the solution is to put
> > the nameserver address on a "dns-nameservers" line in the interface
> > definition stanza. E.g.,
>
> I use that for my non-pcmcia interface.
>
> > You must be referring to /etc/pcmcia/network.opts here. Hmm, yes.
> > If you are using the /etc/pcmcia/ stuff to configure PCMCIA network
> > interfaces then this is a sensible thing to do.
>
> Well, I've been using pcmcia way before there was hotplug, but
> I'm willing to learn.
>
>
> > My own preference is to disable everything in
> > /etc/pcmcia/network.opts and set things up so that hotplug does ifup
> > and ifup configures the interface in the standard way. Then I can
> > use dns-nameservers lines for PCMCIA network interfaces too.
>
> I would be interested in knowing how you set it up equivalent
> to cardctl scheme allows me to set up pcmcia networks. Please mail e
> offlist if you wish.
I switched from using cardctl to hotplug earlier this year. I didn't care to
use any of the packages that do automatic detection of the network, so I set
up a system just like cardctl scheme that allows me to choose which scheme to
use manually. I no longer have pcmcia-cs installed at all. I just execute
"hpscheme default" or "hpscheme bs9" and then plug the card in. It works from
there (don't expect any beeps, though).
I put this in /etc/network/interfaces:
------------------------------------------------------------------------
mapping hotplug
script /usr/local/bin/map-scheme
iface default inet static
address ppp.ppp.ppp.ppp
netmask 255.255.255.0
gateway qqq.qqq.qqq.qqq
iface bs9 inet static
address nnn.nnn.nnn.nnn
netmask 255.255.255.128
gateway mmm.mmm.mmm.mmm
iface dhcp inet dhcp
------------------------------------------------------------------------
The "mapping" stanza is what figures out which interface to associate with
eth0, i.e., default, bs9, or dhcp. Here is the script
/usr/local/bin/map-scheme:
------------------------------------------------------------------------
#!/bin/bash
# Used with /etc/network/interfaces mapping function, which passes the
# interface name as the first argument.
/usr/local/bin/hpscheme get
------------------------------------------------------------------------
Here is the script /usr/local/bin/hpscheme:
------------------------------------------------------------------------
#!/bin/bash -e
# Set or display a scheme, used by my hotplug setup to choose network settings
# for PCMCIA card. Similar to what 'cardctl scheme' did in old pcmcia-cs pkg.
DIR=/var/lib/hpscheme
FL=${DIR}/scheme
[ -d ${DIR} ] || mkdir -p ${DIR}
[ -f ${FL} ] || echo default>${FL}
USAGE="USAGE: $(basename $0) {get|put <scheme>}"
if [ $# -lt 1 ]; then
echo "$USAGE"
exit 1
elif [ "$1" = "get" ]; then
cat ${FL}
elif [ "$1" = "put" ]; then
echo "Current scheme is '$(cat ${FL})'; setting to '$2'" && echo $2>${FL}
else
echo "$USAGE"
exit 1
fi
------------------------------------------------------------------------
You can also add dns-search and dns-nameservers lines to the stanzas in
/etc/network/interfaces if you are using resolvconf, or add scripts to
if-up.d/ and if-down.d/ to muck about with resolv.conf, or whatever you like.
I've done both, though I just switched to resolvconf (thanks, Thomas!).
In addition, of course, you need to set up hotplug, i.e., compile your kernel
with the appropriate options and drivers, etc.
--
Neil Roeth
Reply to: