10.9 Multi-stage mapping
Suppose your network adapters are hotplugged and you enable automatic
configuration as described in
hotplug, Section 10.8.2. Suppose
further that you need to map logical interfaces to "physical"
interfaces depending both on the adapter underlying the physical interface (as
Dealing with inconsistent naming of
interfaces by the kernel, Section 10.7) and on the network connected to the
interface (as described, for example, in
interface selection using
guessnet, Section 10.6.3.1). You
can accomplish this with multi-stage mapping.
The first mapping stage takes the hotplug group name and outputs
the kernel-assigned interface name if the interface is to be hot plugged. The
second mapping stage takes a kernel-assigned interface name and outputs an
adapter name. The third mapping stage maps adapter names to logical interface
names based on the network environment.
# Allow hotplug to bring up interfaces
# Determine whether interface is wired or Wi-Fi
map 02:23:45:3C:45:3C wired
map 00:A3:03:63:26:93 wifi
# Detect which wired network is available
# Detect which Wi-Fi network is available
iface work-wired inet static