MTD 248-645A Manual de usuario Pagina 217

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 347
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 216
Linux From Scratch - Version 7.0
197
With Udev and modular network drivers, the network interface numbering is not persistent across reboots by default,
because the drivers are loaded in parallel and, thus, in random order. For example, on a computer having two network
cards made by Intel and Realtek, the network card manufactured by Intel may become eth0 and the Realtek card
becomes eth1. In some cases, after a reboot the cards get renumbered the other way around. To avoid this, Udev
comes with a script and some rules to assign stable names to network cards based on their MAC address.
Pre-generate the rules to ensure the same names get assigned to the same devices at every boot, including the first:
for NIC in /sys/class/net/* ; do
INTERFACE=${NIC##*/} udevadm test --action=add $NIC
done
Now, inspect the /etc/udev/rules.d/70-persistent-net.rules file, to find out which name was
assigned to which network device:
cat /etc/udev/rules.d/70-persistent-net.rules
The file begins with a comment block followed by two lines for each NIC. The first line for each NIC is a commented
description showing its hardware IDs (e.g. its PCI vendor and device IDs, if it's a PCI card), along with its driver
in parentheses, if the driver can be found. Neither the hardware ID nor the driver is used to determine which name
to give an interface; this information is only for reference. The second line is the Udev rule that matches this NIC
and actually assigns it a name.
All Udev rules are made up of several keys, separated by commas and optional whitespace. This rule's keys and an
explanation of each of them are as follows:
SUBSYSTEM=="net" - This tells Udev to ignore devices that are not network cards.
ACTION=="add" - This tells Udev to ignore this rule for a uevent that isn't an add ("remove" and "change"
uevents also happen, but don't need to rename network interfaces).
DRIVERS=="?*" - This exists so that Udev will ignore VLAN or bridge sub-interfaces (because these sub-
interfaces do not have drivers). These sub-interfaces are skipped because the name that would be assigned would
collide with their parent devices.
ATTR{address} - The value of this key is the NIC's MAC address.
ATTR{type}=="1" - This ensures the rule only matches the primary interface in the case of certain wireless
drivers, which create multiple virtual interfaces. The secondary interfaces are skipped for the same reason that
VLAN and bridge sub-interfaces are skipped: there would be a name collision otherwise.
KERNEL=="eth*" - This key was added to the Udev rule generator to handle machines that have multiple
network interfaces, all with the same MAC address (the PS3 is one such machine). If the independent interfaces
have different basenames, this key will allow Udev to tell them apart. This is generally not necessary for most
Linux From Scratch users, but does not hurt.
NAME - The value of this key is the name that Udev will assign to this interface.
The value of NAME is the important part. Make sure you know which name has been assigned to each of your network
cards before proceeding, and be sure to use that NAME value when creating your configuration files below.
7.2.2. Creating Network Interface Configuration Files
Which interfaces are brought up and down by the network script depends on the files in /etc/sysconfig/.
This directory should contain a file for each interface to be configured, such as ifconfig.xyz, where “xyz” is
meaningful to the administrator such as the device name (e.g. eth0). Inside this file are attributes to this interface,
such as its IP address(es), subnet masks, and so forth. It is necessary that the stem of the filename be ifconfig.
Vista de pagina 216
1 2 ... 212 213 214 215 216 217 218 219 220 221 222 ... 346 347

Comentarios a estos manuales

Sin comentarios