Iftab

From Christoph's Personal Wiki
Jump to: navigation, search

iftab - static information about the network interfaces. The file /etc/iftab contains descriptive information about the various network interfaces. iftab is only used by the program ifrename to assign a consistent network interface name to each network interface. Note: /etc/iftab is not used (by default) in all Linux distros.

/etc/iftab defines a set of mappings. Each mapping contains an interface name and a set of selectors. The selectors allow ifrename to identify each network interface on the system. If a network interface matches all descriptors of a mapping, ifrename attempt to change the name of the interface to the interface name given by the mapping.

Mappings

Each mapping is described on a separate line, it starts with an interface name, and contains a set of descriptors, separated by space or tabs.

The relationship between descriptors of a mapping is a logical and. A mapping matches a network interface only is all the descriptors match. If a network interface does not support a specific descriptor, it won't match any mappings using this descriptor.

If you want to use alternate descriptors for an interface name (logical or), specify two different mappings with the same interface name (one on each line). ifrename always use the first matching mapping starting from the end of iftab, therefore more restrictive mapping should be specified last.

Interface name

The first part of each mapping is an interface name. If a network interface matches all descriptors of a mapping, ifrename attempt to change the name of the interface to the interface name given by the mapping.

The interface name of a mapping is either a plain interface name (such as eth2 or wlan0) or a interface name pattern containing a single wildcard (such as eth* or wlan*). In case of wildcard, the kernel replace the '*' with the lowest available integer making this interface name unique.

Descriptors

Each descriptor is composed of a descriptor name and descriptor value. Descriptors specify a static attribute of a network interface, the goal is to uniquely identify each piece of hardware.

Most users will only use the mac selector, other selectors are for more specialized setup.

mac mac address 
matches the MAC Address of the interface with the specified MAC address. The MAC address of the interface can be shown using ifconfig(8) or ip(8). The specified MAC address may contain a '*' for wildcard matching. This is the most common selector, as most interfaces have a unique MAC address allowing to identify network interfaces without ambiguity.
arp arp type 
matches the ARP Type (also called Link Type) of the interface with the specified ARP type. The ARP Type of the interface can be shown using ifconfig(8) or ip(8). This selector is useful when a driver create multiple network interfaces for a single network card.
driver driver name 
matches the Driver Name of the interface with the specified driver name. The Driver Name of the interface can be shown using ethtool -i(8).
businfo bus information 
matches the Bus Information of the interface with the specified bus information. The Bus Information of the interface can be shown using ethtool -i(8).
baseaddress base address 
matches the Base Address of the interface with the specified base address. The Base Address of the interface can be shown using ifconfig(8). Because most cards use dynamic allocation of the Base Address, this selector is only useful for ISA and EISA cards.
irq irq line 
matches the IRQ Line (interrupt) of the interface with the specified IRQ line. The IRQ Line of the interface can be shown using ifconfig(8). Because there are IRQ Lines may be shared, this selector is usually not sufficient to uniquely identify an interface.
iwproto wireless protocol 
matches the Wireless Protocol of the interface with the specified wireless protocol. The Wireless Protocol of the interface can be shown using iwconfig(8). This selector is only supported on wireless interfaces and is not sufficient to uniquely identify an interface.

Examples

# This is a comment
eth2  mac 00:00:00:00:00:00
eth3  driver wavelan interrupt 15 baseaddress 0x390
eth4  driver pcnet32 businfo 0000:02:05.0
air*  mac 00:07:0E:* arp 1
#~OR~
% arp -n
  Address                  HWtype  HWaddress           Flags Mask            Iface
  xx.x.xx.xxx              ether   00:00:00:00:00:00   C                     eth0

udev

Note: Not all distributions use /etc/iftab. For an example, openSUSE uses the following file.

  • /etc/udev/rules.d/70-persistent-net.rules, which looks something like the following:
# PCI device 0x1039:0x0900 (sis900)
SUBSYSTEM=="net", DRIVERS=="?*", ATTR{address}=="00:00:00:00:00:00", NAME="eth0"

# PCI device 0x1814:0x0201 (rt2500pci)
SUBSYSTEM=="net", DRIVERS=="?*", ATTR{address}=="00:00:00:00:00:00", ATTR{type}=="1", NAME="wlan0"

Source

  • Jean Tourrilhes

See also

  • ifrename(8), ifconfig(8), ip(8), iwconfig(8).
  • arp — manipulate the system ARP cache
  • arping — end ARP REQUEST to a neighbour host
  • tracepath(8), traceroute(8)
  • udev(7) — dynamic device management
  • ethtool