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-network">
|
---|
9 | <?dbhtml filename="network.html"?>
|
---|
10 |
|
---|
11 | <title>Configuring the network Script</title>
|
---|
12 |
|
---|
13 | <indexterm zone="ch-scripts-network">
|
---|
14 | <primary sortas="d-network">network</primary>
|
---|
15 | <secondary>configuring</secondary></indexterm>
|
---|
16 |
|
---|
17 | <sect2>
|
---|
18 | <title>Creating Network Interface Configuration Files</title>
|
---|
19 |
|
---|
20 | <para>Which interfaces are brought up and down by the network script
|
---|
21 | depends on the files and directories in the <filename
|
---|
22 | class="directory">/etc/network.d</filename> hierarchy.
|
---|
23 | This directory should contain a file for each interface to be
|
---|
24 | configured, such as <filename>interface.xyz</filename>, where
|
---|
25 | <quote>xyz</quote> is a network interface name. Inside this file we
|
---|
26 | would be defining the attributes to this interface, such as its IP
|
---|
27 | address(es), subnet masks, and so forth.</para>
|
---|
28 |
|
---|
29 | <para>The following command creates the <filename>network.conf</filename>
|
---|
30 | file for use by the entire system:</para>
|
---|
31 |
|
---|
32 | <screen><userinput>cat > ${CLFS}/etc/network.conf << "EOF"
|
---|
33 | <literal># /etc/network.conf
|
---|
34 | # Global Networking Configuration
|
---|
35 | # interface configuration is in /etc/network.d/
|
---|
36 |
|
---|
37 | # set to yes to enable networking
|
---|
38 | NETWORKING=yes
|
---|
39 |
|
---|
40 | # set to yes to set default route to gateway
|
---|
41 | USE_GATEWAY=no
|
---|
42 |
|
---|
43 | # set to gateway IP address
|
---|
44 | GATEWAY=192.168.0.1</literal>
|
---|
45 | EOF</userinput></screen>
|
---|
46 |
|
---|
47 | <para>The <envar>GATEWAY</envar> variable should contain the default
|
---|
48 | gateway IP address, if one is present. If not, then comment out the
|
---|
49 | variable entirely.</para>
|
---|
50 |
|
---|
51 | <para>The following command creates a sample <filename>interface.eth0</filename>
|
---|
52 | file for the <emphasis>eth0</emphasis> device:</para>
|
---|
53 |
|
---|
54 | <screen><userinput>mkdir ${CLFS}/etc/network.d &&
|
---|
55 | cat > ${CLFS}/etc/network.d/interface.eth0 << "EOF"
|
---|
56 | <literal># Network Interface Configuration
|
---|
57 |
|
---|
58 | # network device name
|
---|
59 | INTERFACE=eth0
|
---|
60 |
|
---|
61 | # set to yes to use DHCP instead of the settings below
|
---|
62 | DHCP=no
|
---|
63 |
|
---|
64 | # IP address
|
---|
65 | IPADDRESS=192.168.1.2
|
---|
66 |
|
---|
67 | # netmask
|
---|
68 | NETMASK=255.255.255.0
|
---|
69 |
|
---|
70 | # broadcast address
|
---|
71 | BROADCAST=192.168.1.255</literal>
|
---|
72 | EOF</userinput></screen>
|
---|
73 |
|
---|
74 | <para>The <envar>INTERFACE</envar> variable should contain the name of
|
---|
75 | the interface interface.</para>
|
---|
76 |
|
---|
77 | <para>The <envar>DHCP</envar> variable if set to yes will allow you to
|
---|
78 | use dhcp. If set to no, you will need to configure the rest of the options.</para>
|
---|
79 |
|
---|
80 | <para>The <envar>IPADDRESS</envar> variable should contain the default
|
---|
81 | IP address for this interface.</para>
|
---|
82 |
|
---|
83 | <para>The <envar>NETMASK</envar> variable should contain the default
|
---|
84 | Subnet Mask for the IP address for this interface.</para>
|
---|
85 |
|
---|
86 | <para>The <envar>BROADCAST</envar> variable should contain the default
|
---|
87 | Broadcast Address for the Subnet Mask of the IP Range being used on
|
---|
88 | this interface.</para>
|
---|
89 |
|
---|
90 | </sect2>
|
---|
91 |
|
---|
92 | <sect2 id="resolv.conf">
|
---|
93 | <title>Creating the ${CLFS}/etc/resolv.conf File</title>
|
---|
94 |
|
---|
95 | <indexterm zone="resolv.conf">
|
---|
96 | <primary sortas="e-/etc/resolv.conf">/etc/resolv.conf</primary>
|
---|
97 | </indexterm>
|
---|
98 |
|
---|
99 | <para>If the system is going to be connected to the Internet, it will
|
---|
100 | need some means of Domain Name Service (DNS) name resolution to
|
---|
101 | resolve Internet domain names to IP addresses, and vice versa. This is
|
---|
102 | best achieved by placing the IP address of the DNS server, available
|
---|
103 | from the ISP or network administrator, into
|
---|
104 | <filename>/etc/resolv.conf</filename>. Create the file by running the
|
---|
105 | following:</para>
|
---|
106 |
|
---|
107 | <screen><userinput>cat > ${CLFS}/etc/resolv.conf << "EOF"
|
---|
108 | <literal># Begin /etc/resolv.conf
|
---|
109 |
|
---|
110 | domain <replaceable>[Your Domain Name]</replaceable>
|
---|
111 | nameserver <replaceable>[IP address of your primary nameserver]</replaceable>
|
---|
112 | nameserver <replaceable>[IP address of your secondary nameserver]</replaceable>
|
---|
113 |
|
---|
114 | # End /etc/resolv.conf</literal>
|
---|
115 | EOF</userinput></screen>
|
---|
116 |
|
---|
117 | <para>Replace <replaceable>[IP address of the nameserver]</replaceable>
|
---|
118 | with the IP address of the DNS most appropriate for the setup. There will
|
---|
119 | often be more than one entry (requirements demand secondary servers for
|
---|
120 | fallback capability). If you only need or want one DNS server, remove the
|
---|
121 | second <emphasis>nameserver</emphasis> line from the file. The IP address
|
---|
122 | may also be a router on the local network.</para>
|
---|
123 |
|
---|
124 | </sect2>
|
---|
125 |
|
---|
126 | </sect1>
|
---|