source: chapter07/hosts.xml@ ddd5542

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 6.3 6.4 6.5 6.6 6.7 6.8 7.0 7.1 7.2 7.3 7.4 7.5 7.5-systemd 7.6 7.6-systemd 7.7 7.7-systemd 7.8 7.8-systemd 7.9 7.9-systemd 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since ddd5542 was f76cde8, checked in by Ken Moffat <ken@…>, 18 years ago

Move creation of /etc/hosts in Perl, to remove another ICA difference.

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@7258 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 2.9 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
3 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../general.ent">
5 %general-entities;
6]>
7
8<sect1 id="ch-scripts-hosts">
9 <?dbhtml filename="hosts.html"?>
10
11 <title>Customizing the /etc/hosts File</title>
12
13 <indexterm zone="ch-scripts-hosts">
14 <primary sortas="e-/etc/hosts">/etc/hosts</primary>
15 </indexterm>
16
17 <indexterm zone="ch-scripts-hosts">
18 <primary sortas="d-localnet">localnet</primary>
19 <secondary>/etc/hosts</secondary></indexterm>
20
21 <indexterm zone="ch-scripts-hosts">
22 <primary sortas="d-network">network</primary>
23 <secondary>/etc/hosts</secondary></indexterm>
24
25 <para>If a network card is to be configured, decide on the IP address,
26 FQDN, and possible aliases for use in the
27 <filename>/etc/hosts</filename> file. The syntax is:</para>
28
29<screen><literal>&lt;IP address&gt; myhost.example.org aliases</literal></screen>
30
31 <para>Unless the computer is to be visible to the Internet (i.e.,
32 there is a registered domain and a valid block of assigned IP
33 addresses&mdash;most users do not have this), make sure that the IP
34 address is in the private network IP address range. Valid ranges
35 are:</para>
36
37<screen><literal> Class Networks
38 A 10.0.0.0
39 B 172.16.0.0 through 172.31.0.255
40 C 192.168.0.0 through 192.168.255.255</literal></screen>
41
42 <para>A valid IP address could be 192.168.1.1. A valid FQDN for this
43 IP could be www.linuxfromscratch.org (not recommended because this is
44 a valid registered domain address and could cause domain name server
45 issues).</para>
46
47 <para>Even if not using a network card, an FQDN is still required.
48 This is necessary for certain programs to operate correctly.</para>
49
50 <para>Create the <filename>/etc/hosts</filename> file by running:</para>
51
52<screen><userinput>cat &gt; /etc/hosts &lt;&lt; "EOF"
53<literal># Begin /etc/hosts (network card version)
54
55127.0.0.1 localhost
56<replaceable>[192.168.1.1]</replaceable> <replaceable>[&lt;HOSTNAME&gt;.example.org]</replaceable> <replaceable>[HOSTNAME]</replaceable>
57
58# End /etc/hosts (network card version)</literal>
59EOF</userinput></screen>
60
61 <para>The <replaceable>[192.168.1.1]</replaceable> and
62 <replaceable>[&lt;HOSTNAME&gt;.example.org]</replaceable>
63 values need to be changed for specific users or requirements (if
64 assigned an IP address by a network/system administrator and the
65 machine will be connected to an existing network).</para>
66
67 <para>If a network card is not going to be configured, create the
68 <filename>/etc/hosts</filename> file by running:</para>
69
70<screen role="nodump"><userinput>cat &gt; /etc/hosts &lt;&lt; "EOF"
71<literal># Begin /etc/hosts (no network card version)
72
73127.0.0.1 <replaceable>[&lt;HOSTNAME&gt;.example.org]</replaceable> <replaceable>[HOSTNAME]</replaceable> localhost
74
75# End /etc/hosts (no network card version)</literal>
76EOF</userinput></screen>
77
78</sect1>
Note: See TracBrowser for help on using the repository browser.