Le 22/08/2017 à 15:09, Hendrik Boom a écrit :
>> Note that a similar problem with disks has been solved elegantly by
>> referencing disks by their uuid or label in /etc/fstab. Maybe
>> /etc/network/interface could specify the MAC address as a hook. This would
>> only suppose that the hotplugger creates a symlink to the interface in some
>> /dev/net/by-address/ subdirectory. With this solution, it is up to the admin
>> to decide if s?he wants a simple configuration based on interface name
>> (eth0) or a secured one alla "Address=a0:d3:c1:9d:a5:86".
> It turns out that something like this already exists. The ifrename command
> renames interfaces using a /etc/iftab file. But it is not installed
> by default.
The problem is the rename, because of the race condition. In
comparison, here is a citation of the mount man page:
The device indication.
Most devices are indicated by a file name (of a block
special
device), like /dev/sda1, but there are other
possibilities. For
example, in the case of an NFS mount, device may
look like
knuth.cwi.nl:/dir. It is possible to indicate a block
special
device using its volume LABEL or UUID (see the -L and -U
options
below).
See the option to use uuid? Mount doesn't require that /dev/sda1 be
*renamed*; it just can find the block special device itself, given the
uuid. The randomness of disk naming is solved without messing with those
names. It doesn't seem a problem to offer a similar option in the ip (or
ifconfig) command.
The advantage of supporting an option like
"hwaddr=a0:d3:c1:9d:a5:86" is that the admin is free to specify
interfaces by names or by MAC address. Of course, there is now the
possibility to change the MAC address of an interface, but this is a
case of severe hacking where the admin has to understand what s?he does.
Didier