source: chapter07/hosts.xml@ ce5ebe1

7.5-systemd 7.6-systemd 7.7-systemd 7.8-systemd 7.9-systemd
Last change on this file since ce5ebe1 was 0cda898, checked in by Bruce Dubbs <bdubbs@…>, 13 years ago

Rewrite bootscripts and Chaper 7

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

  • Property mode set to 100644
File size: 3.1 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/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 fully-qualified domain name (FQDN), and possible aliases for use in the
27 <filename>/etc/hosts</filename> file. The syntax is:</para>
28
29<screen><literal>IP_address 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>Private Network Address Range Normal Prefix
3810.0.0.1 - 10.255.255.254 8
39172.x.0.1 - 172.x.255.254 16
40192.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
43 the range 0-255.</para>
44
45 <para>A valid private IP address could be 192.168.1.1. A valid FQDN for this
46 IP could be lfs.example.org.</para>
47
48 <para>Even if not using a network card, a valid FQDN is still required.
49 This is necessary for certain programs to operate correctly.</para>
50
51 <para>Create the <filename>/etc/hosts</filename> file by running:</para>
52
53<screen><userinput>cat &gt; /etc/hosts &lt;&lt; "EOF"
54<literal># Begin /etc/hosts (network card version)
55
56127.0.0.1 localhost
57<replaceable>&lt;192.168.1.1&gt;</replaceable> <replaceable>&lt;HOSTNAME.example.org&gt;</replaceable> <replaceable>[alias1] [alias2 ...]</replaceable>
58
59# End /etc/hosts (network card version)</literal>
60EOF</userinput></screen>
61
62 <para>The <replaceable>&lt;192.168.1.1&gt;</replaceable> and
63 <replaceable>&lt;HOSTNAME.example.org&gt;</replaceable>
64 values need to be changed for specific uses or requirements (if
65 assigned an IP address by a network/system administrator and the
66 machine will be connected to an existing network). The optional alias
67 name(s) can be omitted.</para>
68
69 <para>If a network card is not going to be configured, create the
70 <filename>/etc/hosts</filename> file by running:</para>
71
72<screen role="nodump"><userinput>cat &gt; /etc/hosts &lt;&lt; "EOF"
73<literal># Begin /etc/hosts (no network card version)
74
75127.0.0.1 <replaceable>&lt;HOSTNAME.example.org&gt;</replaceable> <replaceable>&lt;HOSTNAME&gt;</replaceable> localhost
76
77# End /etc/hosts (no network card version)</literal>
78EOF</userinput></screen>
79
80</sect1>
Note: See TracBrowser for help on using the repository browser.