OSDN Git Service

3e6b8a0fb3a278e0b1bd3e8714cab5aba2f01d91
[android-x86/external-wireless-tools.git] / wireless_tools / IFRENAME-VS-XXX.txt
1                 Network interface renaming comparison
2                 -------------------------------------
3
4 INTRODUCTION
5 ------------
6         The Wireless Tools package includes 'ifrename', a tool to
7 rename network interfaces. However, this is not the only solution to
8 the problem of renaming network interfaces. This document explain the
9 differences between ifrename and the various alternatives.
10             The subject of interface renaming may look simple at first
11 glance, and is simple in 95% of the cases, however there are many
12 complex scenario and those tools have many features, which explain why
13 we need to go in more details than just saying 'tool X is better'.
14
15 NAMEIF
16 ------
17         The tool 'nameif' was designed to rename network
18 interfaces. It either loads mapping from the file /etc/mactab or
19 accept mapping on the command line.
20         It is part of the net-tools package :
21                 http://www.tazenda.demon.co.uk/phil/net-tools/
22
23         Advantages over 'ifrename' :
24                 + More widespread, available in very old distributions
25                 + simpler/smaller
26         Drawbacks compared to 'ifrename' :
27                 - Only support MAC address selector
28                 - Does not support hotplug invocation
29                 - Does not support module on-demand loading
30         Comments :
31                 o The fact that nameif does not support selector other
32 than the MAC address is problematic, as USB-NET devices may not have
33 MAC addresses and some ethernet/wireless drivers can't query the MAC
34 address before 'ifconfig up'.
35                 o 'ifrename' was designed as a better 'nameif', and
36 its concept is very similar.
37
38 IPROUTE
39 -------
40         The tool 'ip' can rename network interfaces with the following
41 syntax :
42                 > ip link set <oldname> name <newname>
43         It is part of the 'iproute' package :
44                 http://developer.osdl.org/dev/iproute2/
45
46         Advantages over 'ifrename' :
47                 + integrated in 'iproute', which most people need anyway
48         Drawbacks compared to 'ifrename' :
49                 - Do not support any selector, must use old interface name
50                 - No 'batch' mode, must rename each interface manually
51         Comments :
52                 o 'ip' only provide the most basic facility. To use it
53 automatically, like in init/hotplug scripts, wrappers adding some
54 rules/selector must be written.
55
56 DRIVER MODULE PARAMETERS
57 ------------------------
58         Some network driver have module parameters enabling to specify
59 the network name of all the devices created by the driver. This is
60 driver specific, so you will need to check your driver.
61
62         Advantages over 'ifrename' :
63                 + very simple to get configured and running
64         Drawbacks compared to 'ifrename' :
65                 - Not universally supported : few drivers do it
66                 - Fragmented : each driver does it differently
67                 - The only selector available is the driver
68         Comments :
69                 o This method was never popular with the kernel
70 people, and this feature is being removed from driver that use to
71 include it.
72
73 UDEV
74 ----
75         The package 'udev' include facility to rename network
76 interfaces, with rules such as :
77                 KERNEL="eth*", SYSFS{address}="00:52:8b:d5:04:48", NAME="lan"
78         This is part of the udev package :
79                 http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html
80
81         Advantages over 'ifrename' :
82                 + integrated into 'udev'
83                 + simpler to setup if 'udev' is already properly setup
84         Drawbacks compared to 'ifrename' :
85                 - Less selectors that 'ifrename'
86                 - Require kernel 2.6.X or later with sysfs support
87                 - Do no support non-hotplug interfaces
88                 - Require 'udev', not everybody uses it (static /dev, devfs)
89                 - Does not support module on-demand loading
90         Comments :
91                 o 'udev' support many selectors, basically all those
92 present in 'sysfs', even if the documentation only show instructions
93 to use the MAC address (which is problematic with virtual devices some
94 drivers - see above). 'ifrename' can also use all selectors present in
95 'sysfs' (like 'udev'), plus some other selectors not present in sysfs
96 that were found to be useful.
97                 o Not all interfaces are managed by hotplug. All
98 virtual devices, such as tunnels and loopbacks, are not associated
99 with a hardware bus, and therefore are not managed by hotplug. All
100 driver compiled statically into the kernel are not managed by
101 hotplug. 'udev' can't deal with those devices.
102                 o It is common practice on embedded system to use a
103 static /dev and not 'udev' to save space and boot time. And to not use
104 hotplug for the same reasons.
105                 o 'ifrename' could be better integrated in 'udev', I don't foresee any technical issues.
106
107 SELECTOR AWARE NETWORK SCRIPTS
108 ------------------------------
109         Another method is to not rename the interface at all, and make
110 the various network script selector aware. The basic idea is to simply
111 ignore the interface name and have all the network scripts based on
112 selectors.
113         The main example is the original Pcmcia network scripts. They
114 allow you to configure an interface directly based on MAC address and
115 Pcmcia socket. Another example is the script get-mac-address.sh used
116 as a mapping in some Debian configuration. On the other hand, Red-Hat
117 and Fedora scripts don't apply, as they wrap around 'nameif'.
118
119         Advantages over 'ifrename' :
120                 + usually simpler to setup and understand
121         Drawbacks compared to 'ifrename' :
122                 - Less selectors that 'ifrename'
123                 - Only work for the scripts, other tools left confused
124         Comments :
125                 o This method is conceptually simpler, and works
126 well. It eliminates the two steps process of other methods (renaming ;
127 configuring).
128                 o Unfortunately, this method only apply to the
129 specific scripts, and not to the majority of the networking tools
130 which are still based on interface name. This means that when the user
131 use those other tools, he is left guessing which interface is which.
132                 o Distributions never never really embraced this
133 method, as they all replaced the original Pcmcia scripts with one
134 using the interfacename.
135
136         Have fun...
137
138         Jean
139