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>cd /etc/network.d &&
|
---|
33 | cat > /etc/network.d/interface.eth0 << "EOF"
|
---|
34 | <literal># /etc/network.conf
|
---|
35 | # Global Networking Configuration
|
---|
36 | # interface configuration is in /etc/network.d/
|
---|
37 |
|
---|
38 | # set to yes to enable networking
|
---|
39 | NETWORKING=yes
|
---|
40 |
|
---|
41 | # set to yes to set default route to gateway
|
---|
42 | USE_GATEWAY=no
|
---|
43 |
|
---|
44 | # set to gateway IP address
|
---|
45 | GATEWAY=192.168.0.1</literal>
|
---|
46 | EOF</userinput></screen>
|
---|
47 |
|
---|
48 | <para>The <envar>GATEWAY</envar> variable should contain the default
|
---|
49 | gateway IP address, if one is present. If not, then comment out the
|
---|
50 | variable entirely.</para>
|
---|
51 |
|
---|
52 | <para>The following command creates a sample <filename>interface.eth0</filename>
|
---|
53 | file for the <emphasis>eth0</emphasis> device:</para>
|
---|
54 |
|
---|
55 | <screen><userinput>cd /etc/network.d &&
|
---|
56 | cat > /etc/network.d/interface.eth0 << "EOF"
|
---|
57 | <literal># Network Interface Configuration
|
---|
58 |
|
---|
59 | # network device name
|
---|
60 | INTERFACE=eth0
|
---|
61 |
|
---|
62 | # set to yes to use DHCP instead of the settings below
|
---|
63 | DHCP=no
|
---|
64 |
|
---|
65 | # IP address
|
---|
66 | IPADDRESS=192.168.1.2
|
---|
67 |
|
---|
68 | # netmask
|
---|
69 | NETMASK=255.255.255.0
|
---|
70 |
|
---|
71 | # broadcast address
|
---|
72 | BROADCAST=192.168.1.255</literal>
|
---|
73 | EOF</userinput></screen>
|
---|
74 |
|
---|
75 | <para>The <envar>INTERFACE</envar> variable should contain the name of
|
---|
76 | the interface interface.</para>
|
---|
77 |
|
---|
78 | <para>The <envar>DHCP</envar> variable if set to yes will allow you to
|
---|
79 | use dhcp. If set to no, you will need to configure the rest of the options.</para>
|
---|
80 |
|
---|
81 | <para>The <envar>IPADDRESS</envar> variable should contain the default
|
---|
82 | IP address for this interface.</para>
|
---|
83 |
|
---|
84 | <para>The <envar>NETMASK</envar> variable should contain the default
|
---|
85 | Subnet Mask for the IP address for this interface.</para>
|
---|
86 |
|
---|
87 | <para>The <envar>BROADCAST</envar> variable should contain the default
|
---|
88 | Broadcast Address for the Subnet Mask of the IP Range being used on
|
---|
89 | this interface.</para>
|
---|
90 |
|
---|
91 | </sect2>
|
---|
92 |
|
---|
93 | <sect2 id="resolv.conf">
|
---|
94 | <title>Creating the /etc/resolv.conf File</title>
|
---|
95 |
|
---|
96 | <indexterm zone="resolv.conf">
|
---|
97 | <primary sortas="e-/etc/resolv.conf">/etc/resolv.conf</primary>
|
---|
98 | </indexterm>
|
---|
99 |
|
---|
100 | <para>If the system is going to be connected to the Internet, it will
|
---|
101 | need some means of Domain Name Service (DNS) name resolution to
|
---|
102 | resolve Internet domain names to IP addresses, and vice versa. This is
|
---|
103 | best achieved by placing the IP address of the DNS server, available
|
---|
104 | from the ISP or network administrator, into
|
---|
105 | <filename>/etc/resolv.conf</filename>. Create the file by running the
|
---|
106 | following:</para>
|
---|
107 |
|
---|
108 | <screen><userinput>cat > /etc/resolv.conf << "EOF"
|
---|
109 | <literal># Begin /etc/resolv.conf
|
---|
110 |
|
---|
111 | domain <replaceable>[Your Domain Name]</replaceable>
|
---|
112 | nameserver <replaceable>[IP address of your primary nameserver]</replaceable>
|
---|
113 | nameserver <replaceable>[IP address of your secondary nameserver]</replaceable>
|
---|
114 |
|
---|
115 | # End /etc/resolv.conf</literal>
|
---|
116 | EOF</userinput></screen>
|
---|
117 |
|
---|
118 | <para>Replace <replaceable>[IP address of the nameserver]</replaceable>
|
---|
119 | with the IP address of the DNS most appropriate for the setup. There will
|
---|
120 | often be more than one entry (requirements demand secondary servers for
|
---|
121 | fallback capability). If you only need or want one DNS server, remove the
|
---|
122 | second <emphasis>nameserver</emphasis> line from the file. The IP address
|
---|
123 | may also be a router on the local network.</para>
|
---|
124 |
|
---|
125 | </sect2>
|
---|
126 |
|
---|
127 | </sect1>
|
---|