Re: The magical mystical changing ethernet interface order

Thomas Hood
2003-05-10T07:29:38Z

Ray Lee wrote:
> Jean Tourrilhes wrote:
>> My belief is that configuration scripts should be specified in
>> term of MAC address (or subset) and not in term of device name. Just
>> like the Pcmcia scripts are doing it.
>
> Debian already supports this, integrated into the normal scheme for
> dealing with interfaces.

Yes. Note that the names 'lan' and 'internet' in the example
are name of possible configurations, not "physical" interface names.
They are only used by the ifupdown package; they do not show up
in an "ifconfig" listing. Thus, doing "ifup eth0=home-wireless-1"
brings up interface eth0 in the home-wireless-1 configuration.
What implements the ability to work in terms of MAC addresses is the
mapping script /path/to/get-mac-addr.sh. When, e.g., eth0 comes up,
get-mac-addr.sh scans for the MAC address and outputs either the
name 'lan' or the name 'internet'; ifupdown then configures eth0
with either the "lan" configuration or the "internet" configuration.

(The configurations are called "logical interfaces" in the ifupdown
documentation.)

> auto eth0 eth1
> mapping eth0 eth1
> script /path/to/get-mac-addr.sh
> map 11:22:33:44:55:66 lan
> map AA:BB:CC:DD:EE:FF internet
> iface lan inet static
> address 192.168.42.1
> netmask 255.255.255.0
> pre-up /usr/local/sbin/enable-masq $IFACE
> iface internet inet dhcp
> pre-up /usr/local/sbin/firewall $IFACE

--
Thomas Hood <jdthood@yahoo.co.uk>