[e0f737f] | 1 | <sect1 id="ch07-hosts">
|
---|
[b08f409] | 2 | <title>Creating the /etc/hosts file</title>
|
---|
[e12115e] | 3 | <?dbhtml filename="hosts.html" dir="chapter07"?>
|
---|
[b08f409] | 4 |
|
---|
[fa914e5] | 5 | <para>If a network card is to be configured, you have to decide on the
|
---|
[9762eb7] | 6 | IP-address, FQDN and possible aliases for use in the /etc/hosts file. The
|
---|
| 7 | syntax is:</para>
|
---|
[b822811] | 8 |
|
---|
[a3be86d] | 9 | <para><screen><IP address> myhost.mydomain.org aliases</screen></para>
|
---|
[b822811] | 10 |
|
---|
[fa914e5] | 11 | <para>You should made sure that the IP-address is in the private network
|
---|
[b822811] | 12 | IP-address range. Valid ranges are:</para>
|
---|
| 13 |
|
---|
| 14 | <para><screen> Class Networks
|
---|
[b08f409] | 15 | A 10.0.0.0
|
---|
| 16 | B 172.16.0.0 through 172.31.0.0
|
---|
[b822811] | 17 | C 192.168.0.0 through 192.168.255.0</screen></para>
|
---|
| 18 |
|
---|
| 19 | <para>A valid IP address could be 192.168.1.1. A valid FQDN for this IP could
|
---|
[335838c] | 20 | be www.linuxfromscratch.org.</para>
|
---|
[b822811] | 21 |
|
---|
[fa914e5] | 22 | <para>If you aren't going to use a network card, you still need to
|
---|
[9762eb7] | 23 | come up with a FQDN. This is necessary for certain programs to operate
|
---|
| 24 | correctly.</para>
|
---|
[b822811] | 25 |
|
---|
[9762eb7] | 26 | <para>If a network card is not going to be configured, create the
|
---|
| 27 | <filename>/etc/hosts</filename> file by running:</para>
|
---|
[b822811] | 28 |
|
---|
| 29 | <para><screen><userinput>cat > /etc/hosts << "EOF"</userinput>
|
---|
[b08f409] | 30 | # Begin /etc/hosts (no network card version)
|
---|
| 31 |
|
---|
[140190c0] | 32 | 127.0.0.1 <value of HOSTNAME>.mydomain.com <value of HOSTNAME> localhost
|
---|
[b08f409] | 33 |
|
---|
| 34 | # End /etc/hosts (no network card version)
|
---|
[b822811] | 35 | <userinput>EOF</userinput></screen></para>
|
---|
| 36 |
|
---|
[9762eb7] | 37 | <para>If a network card is to be configured, create the
|
---|
| 38 | <filename>/etc/hosts</filename> file by running:</para>
|
---|
[b822811] | 39 |
|
---|
| 40 | <para><screen><userinput>cat > /etc/hosts << "EOF"</userinput>
|
---|
[b08f409] | 41 | # Begin /etc/hosts (network card version)
|
---|
| 42 |
|
---|
| 43 | 127.0.0.1 localhost.localdomain localhost
|
---|
[140190c0] | 44 | 192.168.1.1 <value of HOSTNAME>.mydomain.org <value of HOSTNAME>
|
---|
[b08f409] | 45 |
|
---|
| 46 | # End /etc/hosts (network card version)
|
---|
[b822811] | 47 | <userinput>EOF</userinput></screen></para>
|
---|
[b08f409] | 48 |
|
---|
[140190c0] | 49 | <para>Of course, the 192.168.1.1 and <value of HOSTNAME>.mydomain.org
|
---|
| 50 | have to be changed to your liking (or requirements if assigned an IP-address
|
---|
| 51 | by a network/system administrator and this machine is planned to be connected
|
---|
| 52 | to an existing network).</para>
|
---|
[b08f409] | 53 |
|
---|
| 54 | </sect1>
|
---|
| 55 |
|
---|