Changeset c62aadc for BOOK


Ignore:
Timestamp:
Aug 7, 2006, 8:05:06 AM (18 years ago)
Author:
Chris Staub <chris@…>
Branches:
clfs-1.2, clfs-2.1, clfs-3.0.0-systemd, clfs-3.0.0-sysvinit, master, systemd, sysvinit
Children:
794a8ea
Parents:
8253243
Message:

Updated udev text

Location:
BOOK
Files:
1 added
12 edited

Legend:

Unmodified
Added
Removed
  • BOOK/bootscripts/alpha-chapter.xml

    r8253243 rc62aadc  
    2424  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/hostname.xml"/>
    2525  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/hosts.xml"/>
     26  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/symlinks.xml"/>
    2627  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/network.xml"/>
    2728
  • BOOK/bootscripts/common/network.xml

    r8253243 rc62aadc  
    2525
    2626  <sect2>
     27    <title>Creating stable names for network interfaces</title>
     28
     29    <para>Instructions in this section are optional if you have only one
     30    network card.</para>
     31
     32    <para>With Udev and modular network drivers, the network interface numbering
     33    is not persistent across reboots by default, because the drivers are loaded
     34    in parallel and, thus, in random order. For example, on a computer having
     35    two network cards made by Intel and Realtek, the network card manufactured
     36    by Intel may become <filename class="devicefile">eth0</filename> and the
     37    Realtek card becomes  <filename class="devicefile">eth1</filename>. In some
     38    cases, after a reboot the cards get renumbered the other way around. To
     39    avoid this, create Udev rules that assign stable names to network cards
     40    based on their MAC addresses or bus positions.</para>
     41
     42    <para>If you are going to use MAC addresses to identify your network
     43    cards, find the addresses with the following command:</para>
     44
     45<screen role="nodump"><userinput>grep -H . /sys/class/net/*/address</userinput></screen>
     46
     47    <para>For each network card (but not for the loopback interface),
     48    invent a descriptive name, such as <quote>realtek</quote>, and create
     49    Udev rules similar to the following:</para>
     50
     51<screen role="nodump"><userinput>cat &gt; /etc/udev/rules.d/26-network.rules &lt;&lt; EOF
     52<literal>ACTION=="add", SUBSYSTEM=="net", SYSFS{address}=="<replaceable>00:e0:4c:12:34:56</replaceable>", \
     53    NAME="<replaceable>realtek</replaceable>"
     54ACTION=="add", SUBSYSTEM=="net", SYSFS{address}=="<replaceable>00:a0:c9:78:9a:bc</replaceable>", \
     55    NAME="<replaceable>intel</replaceable>"</literal>
     56EOF</userinput></screen>
     57
     58<!-- Yes, I know that VLANs are beyond BLFS. This is not the reason to get them
     59     incorrect by default when every distro does this right. -->
     60
     61    <note>
     62      <para>Although the examples in this book work properly, be aware
     63      that Udev does not recognize the backslash for line continuation.
     64      If modifying Udev rules with an editor, be sure to leave each rule
     65      on one physical line.</para>
     66    </note>
     67
     68    <para>If you are going to use the bus position as a key, create
     69    Udev rules similar to the following:</para>
     70
     71<screen role="nodump"><userinput>cat &gt; /etc/udev/rules.d/26-network.rules &lt;&lt; EOF
     72<literal>ACTION=="add", SUBSYSTEM=="net", BUS=="<replaceable>pci</replaceable>", ID=="<replaceable>0000:00:0c.0</replaceable>", \
     73    NAME="<replaceable>realtek</replaceable>"
     74ACTION=="add", SUBSYSTEM=="net", BUS=="<replaceable>pci</replaceable>", ID=="<replaceable>0000:00:0d.0</replaceable>", \
     75    NAME="<replaceable>intel</replaceable>"</literal>
     76EOF</userinput></screen>
     77
     78    <para>These rules will always rename the network cards to
     79    <quote>realtek</quote> and <quote>intel</quote>, independently
     80    of the original numbering provided by the kernel (i.e.: the original
     81    <quote>eth0</quote> and <quote>eth1</quote> interfaces will no longer
     82    exist, unless you put such <quote>descriptive</quote> names in the NAME
     83    key). Use the descriptive names from the Udev rules instead
     84    of <quote>eth0</quote> in the network interface configuration files
     85    below.</para>
     86
     87    <para>Note that the rules above don't work for every setup. For example,
     88    MAC-based rules break when bridges or VLANs are used, because bridges and
     89    VLANs have the same MAC address as the network card. One wants to rename
     90    only the network card interface, not the bridge or VLAN interface, but the
     91    example rule matches both. If you use such virtual interfaces, you have two
     92    potential solutions. One is to add the DRIVER=="?*" key after
     93    SUBSYSTEM=="net" in MAC-based rules which will stop matching the virtual
     94    interfaces.  This is known to fail with some older Ethernet cards because
     95    they don't have the DRIVER variable in the uevent and thus the rule does
     96    not match with such cards. Another solution is to switch to rules that use
     97    the bus position as a key.</para>
     98
     99    <para>The second known non-working case is with wireless cards using the
     100    MadWifi or HostAP drivers, because they create at least two interfaces with
     101    the same MAC address and bus position. For example, the Madwifi driver
     102    creates both an athX and a wifiX interface where X is a digit.  To
     103    differentiate these interfaces, add an appropriate KERNEL parameter such as
     104    KERNEL=="ath*" after SUBSYSTEM=="net".</para>
     105
     106    <para>There may be other cases where the rules above don't work. Currently,
     107    bugs on this topic are still being reported to Linux distributions, and no
     108    solution that covers every case is available.</para>
     109
     110  </sect2>
     111
     112  <sect2>
    27113    <title>Creating Network Interface Configuration Files</title>
    28114
     
    33119    configured, such as <filename>ifconfig.xyz</filename>, where
    34120    <quote>xyz</quote> is a network interface name. Inside this directory
    35     would be files defining the attributes to this interface, such as its
    36     IP address(es), subnet masks, and so forth.</para>
     121    would be files defining the attributes to this interface, such as its IP
     122    address(es), subnet masks, and so forth.</para>
    37123
    38124    <para>The following command creates a sample <filename>ipv4</filename>
    39     file for the <filename class="devicefile">eth0</filename> device:</para>
     125    file for the <emphasis>eth0</emphasis> device:</para>
    40126
    41127<screen><userinput>cd /etc/sysconfig/network-devices &amp;&amp;
     
    50136EOF</userinput></screen>
    51137
    52     <para>The values of these variables must be changed in every file to
    53     match the proper setup. If the <envar>ONBOOT</envar> variable is
    54     set to <quote>yes</quote> the network script will bring up the
    55     Network Interface Card (NIC) during booting of the system. If set
    56     to anything but <quote>yes</quote> the NIC will be ignored by the
    57     network script and not brought up.</para>
     138    <para>The values of these variables must be changed in every file to match
     139    the proper setup. If the <envar>ONBOOT</envar> variable is set to
     140    <quote>yes</quote> the network script will bring up the Network Interface
     141    Card (NIC) during booting of the system. If set to anything but
     142    <quote>yes</quote> the NIC will be ignored by the network script and not
     143    be brought up.</para>
    58144
    59145    <para>The <envar>SERVICE</envar> variable defines the method used for
     
    61147    assignment format, and creating additional files in the <filename
    62148    class="directory">/etc/sysconfig/network-devices/services</filename>
    63     directory allows other IP assignment methods. This is commonly used
    64     for Dynamic Host Configuration Protocol (DHCP), which is addressed in
    65     the BLFS book.</para>
     149    directory allows other IP assignment methods. This is commonly used for
     150    Dynamic Host Configuration Protocol (DHCP), which is addressed in the
     151    BLFS book.</para>
    66152
    67153    <para>The <envar>GATEWAY</envar> variable should contain the default
     
    69155    variable entirely.</para>
    70156
    71     <para>The <envar>PREFIX</envar> variable needs to contain the number
    72     of bits used in the subnet. Each octet in an IP address is 8 bits.
    73     If the subnet's netmask is 255.255.255.0, then it is using the first
    74     three octets (24 bits) to specify the network number. If the netmask
    75     is 255.255.255.240, it would be using the first 28 bits. Prefixes
    76     longer than 24 bits are commonly used by DSL and cable-based Internet
    77     Service Providers (ISPs). In this example (PREFIX=24), the netmask is
    78     255.255.255.0. Adjust the <envar>PREFIX</envar> variable according to
    79     your specific subnet.</para>
     157    <para>The <envar>PREFIX</envar> variable needs to contain the number of
     158    bits used in the subnet. Each octet in an IP address is 8 bits. If the
     159    subnet's netmask is 255.255.255.0, then it is using the first three octets
     160    (24 bits) to specify the network number. If the netmask is 255.255.255.240,
     161    it would be using the first 28 bits.  Prefixes longer than 24 bits are
     162    commonly used by DSL and cable-based Internet Service Providers (ISPs).
     163    In this example (PREFIX=24), the netmask is 255.255.255.0. Adjust the
     164    <envar>PREFIX</envar> variable according to your specific subnet.</para>
    80165
    81166  </sect2>
     
    89174
    90175    <para>If the system is going to be connected to the Internet, it will
    91     need some means of Domain Name Service (DNS) name resolution to resolve
    92     Internet domain names to IP addresses, and vice versa. This is best
    93     achieved by placing the IP address of the DNS server, available from
    94     the ISP or network administrator, into <filename>/etc/resolv.conf</filename>.
    95     Create the file by running the following:</para>
     176    need some means of Domain Name Service (DNS) name resolution to
     177    resolve Internet domain names to IP addresses, and vice versa. This is
     178    best achieved by placing the IP address of the DNS server, available
     179    from the ISP or network administrator, into
     180    <filename>/etc/resolv.conf</filename>. Create the file by running the
     181    following:</para>
    96182
    97183<screen><userinput>cat &gt; /etc/resolv.conf &lt;&lt; "EOF"
  • BOOK/bootscripts/common/udev.xml

    r8253243 rc62aadc  
    22<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
    33  "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
    4   <!ENTITY % general-entities SYSTEM "../general.ent">
     4  <!ENTITY % general-entities SYSTEM "../../general.ent">
    55  %general-entities;
    66]>
     
    99  <?dbhtml filename="udev.html"?>
    1010
    11   <title>Device and Module Handling on an LFS System</title>
     11  <title>Device and Module Handling on a CLFS System</title>
    1212
    1313  <indexterm zone="ch-scripts-udev">
     
    131131      determined by rules specified in the files within the <filename
    132132      class="directory">/etc/udev/rules.d/</filename> directory. These are
    133       numbered in a similar fashion to the LFS-Bootscripts package. If
     133      numbered in a similar fashion to the CLFS-Bootscripts package. If
    134134      <command>udevd</command> can't find a rule for the device it is creating,
    135135      it will default permissions to <emphasis>660</emphasis> and ownership to
     
    155155      might contain the string
    156156      <quote>pci:v00001319d00000801sv00001319sd00001319bc04sc01i00</quote>.
    157       The rules that LFS installs will cause <command>udevd</command> to call
     157      The rules that CLFS installs will cause <command>udevd</command> to call
    158158      out to <command>/sbin/modprobe</command> with the contents of the
    159159      <envar>MODALIAS</envar> uevent environment variable (that should be the
     
    281281      <systemitem class="filesystem">sysfs</systemitem> attribute and appending
    282282      it to the <filename>/etc/udev/rules.d/10-wait_for_sysfs.rules</filename>
    283       file. Please notify the LFS Development list if you do so and it
     283      file. Please notify the CLFS Development list if you do so and it
    284284      helps.</para>
    285285
  • BOOK/bootscripts/mips-chapter.xml

    r8253243 rc62aadc  
    2424  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/hostname.xml"/>
    2525  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/hosts.xml"/>
     26  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/symlinks.xml"/>
    2627  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/network.xml"/>
    2728
  • BOOK/bootscripts/mips64-chapter.xml

    r8253243 rc62aadc  
    2424  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/hostname.xml"/>
    2525  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/hosts.xml"/>
     26  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/symlinks.xml"/>
    2627  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/network.xml"/>
    2728
  • BOOK/bootscripts/ppc-chapter.xml

    r8253243 rc62aadc  
    2424  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/hostname.xml"/>
    2525  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/hosts.xml"/>
     26  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/symlinks.xml"/>
    2627  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/network.xml"/>
    2728
  • BOOK/bootscripts/ppc64-chapter.xml

    r8253243 rc62aadc  
    2424  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/hostname.xml"/>
    2525  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/hosts.xml"/>
     26  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/symlinks.xml"/>
    2627  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/network.xml"/>
    2728
  • BOOK/bootscripts/sparc-chapter.xml

    r8253243 rc62aadc  
    2424  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/hostname.xml"/>
    2525  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/hosts.xml"/>
     26  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/symlinks.xml"/>
    2627  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/network.xml"/>
    2728
  • BOOK/bootscripts/sparc64-chapter.xml

    r8253243 rc62aadc  
    2424  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/hostname.xml"/>
    2525  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/hosts.xml"/>
     26  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/symlinks.xml"/>
    2627  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/network.xml"/>
    2728
  • BOOK/bootscripts/x86-chapter.xml

    r8253243 rc62aadc  
    2424  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/hostname.xml"/>
    2525  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/hosts.xml"/>
     26  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/symlinks.xml"/>
    2627  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/network.xml"/>
    2728
  • BOOK/bootscripts/x86_64-chapter.xml

    r8253243 rc62aadc  
    2424  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/hostname.xml"/>
    2525  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/hosts.xml"/>
     26  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/symlinks.xml"/>
    2627  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/network.xml"/>
    2728
  • BOOK/introduction/common/changelog.xml

    r8253243 rc62aadc  
    3838
    3939    <listitem>
     40      <para>August 7, 2006</para>
     41      <itemizedlist>
     42        <listitem>
     43          <para>[Chris] - Updated udev explanatory text in the book and added
     44          "Custom Symlinks" page, taken from LFS. Thanks to Alexander Patrakov
     45          for the updated text (fixes ticket #75).</para>
     46        </listitem>
     47      </itemizedlist>
     48    </listitem>
     49
     50    <listitem>
    4051      <para>August 3, 2006</para>
    4152      <itemizedlist>
Note: See TracChangeset for help on using the changeset viewer.