IFRENAME-VS-XXX.txt 5.7 KB

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