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

ifupdown0.6



Hello world,

In incoming atm is a new ifupdown0.6 .deb, which is a beta of the next
version of ifupdown. It's packaged separately for two reasons:

	1) I've reworked lots of code, and I'm not sure I haven't introduced
	   some stupid bugs

	2) the format of /etc/network/interfaces has changed slightly

There are two incompatabilities in /etc/network/interfaces. The only one that
should affect people is that what used to be:

	iface lo inet loopback

	iface eth0 inet dhcp
		noauto

is now:

	auto lo

	iface lo inet loopback

	iface eth0 inet dhcp

Before updating ifupdown.deb I'll write some perl or something to
automatically convert the former to the latter, but I haven't done
that yet.

The other change is that schemes no longer work. Since I never documented
them except in the code, didn't provide any examples, and didn't talk
about them much, that shouldn't cause anyone any problems. And anyone who
figured out how to use them can probably cope with fixing it themselves
anyway.

What schemes were originally meant to do was handle mobile machines
that might need one configuration at home (a static IP on a private
subnet that's masqueraded to the internet, maybe) and another at work
(dhcp, say).

That's still a useful thing to do, and the way the new ifupdown copes
with it is via "mapping" stanzas. That is, if you're on a laptop that
gets plugged in both at work and at home, you might have an interfaces
file that looks like:

	auto lo eth0

	iface lo inet loopback

	mapping eth0
		script /usr/local/sbin/work-out-where-i-am
		map am-i-at-home home
		map am-i-at-work work

	iface home inet static
		address 192.168.1.10
		netmask 255.255.255.0
		gateway 192.168.1.1

	iface work inet dhcp

/usr/local/sbin/work-out-where-i-am is some clever script that can determine
where you're meant to be: possibly by querying a file that netenv leaves
around, or possibly by uping eth0 as various things and seeing what it can
ping or what arp requests it sees, or heck, maybe even by querying a GPS
unit attached to the machine and working out where it is [0].

Furhter to this, ifupdown also supports having generic
pre-up/up/down/post-down scripts run whenever an interface is up'ed or
down'ed. Putting a script in /etc/network/if-{pre-up,up,down,post-down}.d/
will get it run at the appropriate time with no arguments and an
environment containing:

MODE=start or MODE=stop (so you can use the same script for -up and -down)
IFACE=eth0 (or lo, or whatever. *not* "home")

IF_ADDRESS=192.168.1.10
IF_NETMASK=255.255.255.0
IF_GATEWAY=192.168.1.1
	(ie, each option, uppercased, prefixed with IF_ and -'s converted
	to _'s)

Anyway, that should be enough to get people started a little. Writing
mapping scripts is currently something of a black art (ie, completely
undocumented) but you can probably reverse engineer it without too
much trouble.

Have fun.

Cheers,
aj

[0] If you'd like to help make this a reality rather than a cute
    hypothetical and you're anywhere near Palo Alto, donations of or
    suggestions of where I can get a cheap GPS unit that'll hook up to
    a serial/parallel/USB port would be helpful...


-- 
Anthony Towns <aj@humbug.org.au> <http://azure.humbug.org.au/~aj/>
I don't speak for anyone save myself. GPG signed mail preferred.

  ``We reject: kings, presidents, and voting.
                 We believe in: rough consensus and working code.''
                                      -- Dave Clark

Attachment: pgp3wPYSqsanC.pgp
Description: PGP signature


Reply to: