[3f8be484] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[aa18ac0] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
[0b9e109] | 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
[3f8be484] | 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
| 7 |
|
---|
[0b9e109] | 8 | <sect1 id="ch-network-hosts">
|
---|
[3f8be484] | 9 | <?dbhtml filename="hosts.html"?>
|
---|
| 10 |
|
---|
[8a74dc5] | 11 | <title>Customizing the /etc/hosts File</title>
|
---|
[3f8be484] | 12 |
|
---|
[0b9e109] | 13 | <indexterm zone="ch-network-hosts">
|
---|
[3f8be484] | 14 | <primary sortas="e-/etc/hosts">/etc/hosts</primary>
|
---|
| 15 | </indexterm>
|
---|
| 16 |
|
---|
[0b9e109] | 17 | <indexterm zone="ch-network-hosts">
|
---|
[3f8be484] | 18 | <primary sortas="d-localnet">localnet</primary>
|
---|
| 19 | <secondary>/etc/hosts</secondary></indexterm>
|
---|
| 20 |
|
---|
[0b9e109] | 21 | <indexterm zone="ch-network-hosts">
|
---|
[3f8be484] | 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,
|
---|
[99f8c39] | 26 | fully-qualified domain name (FQDN), and possible aliases for use in the
|
---|
[3f8be484] | 27 | <filename>/etc/hosts</filename> file. The syntax is:</para>
|
---|
| 28 |
|
---|
| 29 | <screen><IP address> myhost.example.org aliases</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—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 |
|
---|
[99f8c39] | 37 | <screen><literal>Private Network Address Range Normal Prefix
|
---|
| 38 | 10.0.0.1 - 10.255.255.254 8
|
---|
| 39 | 172.x.0.1 - 172.x.255.254 16
|
---|
| 40 | 192.168.y.1 - 192.168.y.254 24</literal></screen>
|
---|
| 41 |
|
---|
| 42 | <para>x can be any number in the range 16-31. y can be any number in the
|
---|
| 43 | range 0-255.</para>
|
---|
[3f8be484] | 44 |
|
---|
| 45 | <para>A valid IP address could be 192.168.1.1. A valid FQDN for this
|
---|
[99f8c39] | 46 | IP could be <uri>www.cross-lfs.org</uri> (not recommended
|
---|
[3f8be484] | 47 | because this is a valid registered domain address and could cause
|
---|
| 48 | domain name server issues).</para>
|
---|
| 49 |
|
---|
[99f8c39] | 50 | <para>Even if not using a network card, a valid FQDN is still required.
|
---|
[3f8be484] | 51 | This is necessary for certain programs to operate correctly.</para>
|
---|
| 52 |
|
---|
[99f8c39] | 53 | <para>Create the <filename>/etc/hosts</filename> file by running:</para>
|
---|
[3f8be484] | 54 |
|
---|
[819ba78] | 55 | <screen role="nodump"><userinput>cat > /etc/hosts << "EOF"
|
---|
[3f8be484] | 56 | <literal># Begin /etc/hosts (network card version)
|
---|
| 57 |
|
---|
| 58 | 127.0.0.1 localhost
|
---|
[99f8c39] | 59 | <replaceable>[192.168.1.1]</replaceable> <replaceable>[<HOSTNAME>.example.org]</replaceable> <replaceable>[HOSTNAME]</replaceable> <replaceable>[alias ...]</replaceable>
|
---|
[3f8be484] | 60 |
|
---|
| 61 | # End /etc/hosts (network card version)</literal>
|
---|
| 62 | EOF</userinput></screen>
|
---|
| 63 |
|
---|
| 64 | <para>The <replaceable>[192.168.1.1]</replaceable> and
|
---|
| 65 | <replaceable>[<HOSTNAME>.example.org]</replaceable>
|
---|
| 66 | values need to be changed for specific users or requirements (if
|
---|
| 67 | assigned an IP address by a network/system administrator and the
|
---|
[99f8c39] | 68 | machine will be connected to an existing network). The optional
|
---|
| 69 | alias name(s) can be omitted.</para>
|
---|
[3f8be484] | 70 |
|
---|
| 71 | <para>If a network card is not going to be configured, create the
|
---|
| 72 | <filename>/etc/hosts</filename> file by running:</para>
|
---|
| 73 |
|
---|
[819ba78] | 74 | <screen role="nodump"><userinput>cat > /etc/hosts << "EOF"
|
---|
[3f8be484] | 75 | <literal># Begin /etc/hosts (no network card version)
|
---|
| 76 |
|
---|
| 77 | 127.0.0.1 <replaceable>[<HOSTNAME>.example.org]</replaceable> <replaceable>[HOSTNAME]</replaceable> localhost
|
---|
| 78 |
|
---|
| 79 | # End /etc/hosts (no network card version)</literal>
|
---|
| 80 | EOF</userinput></screen>
|
---|
| 81 |
|
---|
| 82 | </sect1>
|
---|