Changeset ba40e32


Ignore:
Timestamp:
09/14/2023 08:50:37 AM (8 months ago)
Author:
Xi Ruoyao <xry111@…>
Branches:
12.1, 12.1-rc1, multilib, trunk, xry111/arm64, xry111/clfs-ng, xry111/loongarch, xry111/loongarch-12.1, xry111/mips64el, xry111/update-glibc
Children:
2df066c9, d269e20, dc39c7b
Parents:
efd1113
git-author:
Xi Ruoyao <xry111@…> (09/14/2023 08:48:46 AM)
git-committer:
Xi Ruoyao <xry111@…> (09/14/2023 08:50:37 AM)
Message:

systemd: Use NSS modules provided by systemd in nsswitch.conf

It allows a simplification to /etc/hosts. Also correct some info about
FQDN in both sysv and systemd.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • chapter08/glibc.xml

    refd1113 rba40e32  
    321321    following:</para>
    322322
    323 <screen><userinput>cat &gt; /etc/nsswitch.conf &lt;&lt; "EOF"
     323<screen revision='sysv'><userinput>cat &gt; /etc/nsswitch.conf &lt;&lt; "EOF"
    324324<literal># Begin /etc/nsswitch.conf
    325325
     
    329329
    330330hosts: files dns
     331networks: files
     332
     333protocols: files
     334services: files
     335ethers: files
     336rpc: files
     337
     338# End /etc/nsswitch.conf</literal>
     339EOF</userinput></screen>
     340
     341<screen revision='systemd'><userinput>cat &gt; /etc/nsswitch.conf &lt;&lt; "EOF"
     342<literal># Begin /etc/nsswitch.conf
     343
     344passwd: files systemd
     345group: files systemd
     346shadow: files systemd
     347
     348hosts: mymachines resolve [!UNAVAIL=return] files myhostname dns
    331349networks: files
    332350
  • chapter09/network.xml

    refd1113 rba40e32  
    179179     </indexterm>
    180180
    181      <para>Decide on the IP address, fully-qualified domain name (FQDN), and
    182      possible aliases for use in the <filename>/etc/hosts</filename> file. The
    183      syntax is:</para>
     181     <para>Decide on a fully-qualified domain name (FQDN), and possible aliases
     182     for use in the <filename>/etc/hosts</filename> file. If using static IP
     183     addresses, you'll also need to decide on an IP address. The syntax
     184     for a hosts file entry is:</para>
    184185
    185186<screen><literal>IP_address myhost.example.org aliases</literal></screen>
     
    198199     range 0-255.</para>
    199200
    200      <para>A valid private IP address could be 192.168.1.1. A valid FQDN for
    201      this IP could be lfs.example.org.</para>
    202 
    203      <para>Even if not using a network card, a valid FQDN is still required.
    204      This is necessary for certain programs to operate correctly.</para>
     201     <para>A valid private IP address could be 192.168.1.1.</para>
     202
     203     <para>If the computer is to be visible to the Internet, a valid FQDN
     204     can be the domain name itself, or a string resulted by concatenating a
     205     prefix (often the hostname) and the domain name with a <quote>.</quote>
     206     character.  And, you need to contact the domain provider to resolve the
     207     FQDN to your public IP address.</para>
     208
     209     <para>Even if the computer is not visible to the Internet, a FQDN is
     210     still needed for certain programs, such as MTAs, to operate properly.
     211     A special FQDN, <literal>localhost.localdomain</literal>, can be used
     212     for this purpose.</para>
    205213
    206214     <para>Create the  <filename>/etc/hosts</filename> file by running:</para>
  • chapter09/networkd.xml

    refd1113 rba40e32  
    317317     range 0-255.</para>
    318318
    319      <para>A valid private IP address could be 192.168.1.1. A valid FQDN for
    320      this IP could be lfs.example.org.</para>
    321 
    322      <para>Even if not using a network card, a valid FQDN is still required.
    323      This is necessary for certain programs, such as MTAs, to operate properly.</para>
    324 
    325 <!--
    326      <para>Create the /etc/hosts file using the following command:</para>
    327 
    328 <screen role="nodump"><userinput>cat &gt; /etc/hosts &lt;&lt; "EOF"
     319     <para>A valid private IP address could be 192.168.1.1.</para>
     320
     321     <para>If the computer is to be visible to the Internet, a valid FQDN
     322     can be the domain name itself, or a string resulted by concatenating a
     323     prefix (often the hostname) and the domain name with a <quote>.</quote>
     324     character.  And, you need to contact the domain provider to resolve the
     325     FQDN to your public IP address.</para>
     326
     327     <para>Even if the computer is not visible to the Internet, a FQDN is
     328     still needed for certain programs, such as MTAs, to operate properly.
     329     A special FQDN, <literal>localhost.localdomain</literal>, can be used
     330     for this purpose.</para>
     331
     332     <para>Create the <filename>/etc/hosts</filename> file using the following
     333     command:</para>
     334
     335<screen><userinput>cat &gt; /etc/hosts &lt;&lt; "EOF"
    329336<literal># Begin /etc/hosts
    330337
    331 127.0.0.1 localhost.localdomain localhost
    332 127.0.1.1 <replaceable>&lt;FQDN&gt;</replaceable> <replaceable>&lt;HOSTNAME&gt;</replaceable>
    333 ::1       localhost ip6-localhost ip6-loopback
     338<replaceable>&lt;192.168.0.2&gt;</replaceable> <replaceable>&lt;FQDN&gt;</replaceable> <replaceable>[alias1] [alias2] ...</replaceable>
     339::1       ip6-localhost ip6-loopback
    334340ff02::1   ip6-allnodes
    335341ff02::2   ip6-allrouters
     
    337343# End /etc/hosts</literal>
    338344EOF</userinput></screen>
    339 -->
    340 
    341      <para>Create the <filename>/etc/hosts</filename> file using the following
    342      command:</para>
    343 
    344 <screen><userinput>cat &gt; /etc/hosts &lt;&lt; "EOF"
    345 <literal># Begin /etc/hosts
    346 
    347 127.0.0.1 localhost.localdomain localhost
    348 127.0.1.1 <replaceable>&lt;FQDN&gt;</replaceable> <replaceable>&lt;HOSTNAME&gt;</replaceable>
    349 <replaceable>&lt;192.168.0.2&gt;</replaceable> <replaceable>&lt;FQDN&gt;</replaceable> <replaceable>&lt;HOSTNAME&gt;</replaceable> <replaceable>[alias1] [alias2] ...</replaceable>
    350 ::1       localhost ip6-localhost ip6-loopback
    351 ff02::1   ip6-allnodes
    352 ff02::2   ip6-allrouters
    353 
    354 # End /etc/hosts</literal>
    355 EOF</userinput></screen>
    356 
    357      <para>The <replaceable>&lt;192.168.0.2&gt;</replaceable>,
    358      <replaceable>&lt;FQDN&gt;</replaceable>, and
    359      <replaceable>&lt;HOSTNAME&gt;</replaceable> values need to be
     345
     346     <para>The <replaceable>&lt;192.168.0.2&gt;</replaceable> and
     347     <replaceable>&lt;FQDN&gt;</replaceable> values need to be
    360348     changed for specific uses or requirements (if assigned an IP address by a
    361349     network/system administrator and the machine will be connected to an
    362350     existing network). The optional alias name(s) can be omitted, and the
    363351     <replaceable>&lt;192.168.0.2&gt;</replaceable> line can be omitted if you
    364      are using a connection configured with DHCP or IPv6 Autoconfiguration.</para>
     352     are using a connection configured with DHCP or IPv6 Autoconfiguration,
     353     or using <literal>localhost.localdomain</literal> as the FQDN.</para>
     354
     355     <para>The <filename>/etc/hostname</filename> does not contain entries
     356     for <literal>localhost</literal>,
     357     <literal>localhost.localdomain</literal>, or the hostname (without a
     358     domain) because they are handled by the
     359     <systemitem class='library'>myhostname</systemitem> NSS module, read
     360     the man page <filename>nss-myhostname(8)</filename> for details.</para>
    365361
    366362     <para>The ::1 entry is the IPv6 counterpart of 127.0.0.1 and represents
    367      the IPv6 loopback interface. 127.0.1.1 is a loopback entry reserved
    368      specifically for the FQDN.</para>
     363     the IPv6 loopback interface.</para>
    369364
    370365   </sect2>
Note: See TracChangeset for help on using the changeset viewer.