[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: restarting pump (DHCP) automatically when network unavailable at boot time



On 2007-07-10 15:09:25 -0600, Bob Proulx wrote:
> > > but I think that maybe you simply need to remove all of the 'auto'
> > > and 'allow-hotplug' lines from the file. Then it won't be started
> > > automatically.
> > 
> > But I want it to be started automatically on some networks. This is
> > very important as I don't always have physical access to my machine.
> 
> Personally I think *only* starting it on networks that will use it
> makes more sense than *always* starting it and killing it off if the
> configuration decides this is not a dhcp network.

This is exactly what my interfaces file does:

auto eth0 eth1

mapping eth*
  script /usr/local/sbin/map-scheme

iface eth-casc inet static
  address 83.149.208.176
  netmask 255.255.255.192
  broadcast 83.149.208.191
  gateway 83.149.208.129

iface eth-dhcp inet dhcp

iface eth-ensl inet dhcp

iface eth-loria inet dhcp

iface eth-nerim inet static
  address 192.168.0.3
  netmask 255.255.255.0
  gateway 192.168.0.1

iface eth-uka inet static
  address 172.20.22.84
  netmask 255.255.248.0
  broadcast 172.20.23.255

The suffix (casc, dhcp, etc.) is obtained from netenv. On the other
networks (i.e. other suffixes), there's no mapping iface, i.e. the
Ethernet card is not used. (Note: I use "auto eth0 eth1" because the
device name depends on the kernel version, and the map-scheme script
looks at the MAC address to decide which one should be used.)

> > But if a DHCP client is still running (from the previous
> > environment), it reconfigures the network interface.  I've already
> > had this problem, so I know I must kill the DHCP client.
> 
> This sounds like new information.  I am used to always getting to a
> clean state and then moving through the state diagram to the desired
> state for that network.

Well, killing the DHCP client is a way to have a clean state before
reconfiguring the network.

> > Also, even if DHCP is always used, letting the network to be reconfigured
> > automatically when switching network may lead to lost mail for instance,
> > due to race condition. The correct steps are:
> > 
> > 1. Bring the network interface down.
> > 2. Update various configuration files (e.g. the new smarthost for the
> >    mail).
> > 3. Bring the network interface up.
> > 
> > in this order. If step 2 is done after step 3, problems can occur.
> 
> I believe that is fairly standard in Etch.  See the /etc/network/*.d/*
> files for postfix for example.

Unfortunately, exim4[*] doesn't have anything in these directories.
Now, I don't think they will solve the problem I've described: if
the DHCP client detects a different server and reconfigures the
interface, it will not run the scripts from the /etc/network/*.d/*
directories (because it works at another level), will it?

[*] which I use because this is (was) the default on Debian.

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)



Reply to: