1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 | <!DOCTYPE section [
|
---|
3 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
4 | %general-entities;
|
---|
5 | ]>
|
---|
6 | <section xmlns="http://docbook.org/docbook-ng"
|
---|
7 | xml:id="ch-scripts-network">
|
---|
8 | <info><title>Configuring the network script</title></info>
|
---|
9 | <?dbhtml filename="network.html"?>
|
---|
10 |
|
---|
11 | <indexterm zone="ch-scripts-network">
|
---|
12 | <primary sortas="d-network">network</primary>
|
---|
13 | <secondary>configuring</secondary></indexterm>
|
---|
14 |
|
---|
15 | <para>This section only applies if you're going to configure a network
|
---|
16 | card.</para>
|
---|
17 |
|
---|
18 | <para>If you don't have any network cards, you are most likely not going to
|
---|
19 | create any configuration files relating to network cards. If that is the
|
---|
20 | case, you must remove the <filename class="symlink">network</filename> symlinks from all the
|
---|
21 | run-level directories
|
---|
22 | (<filename class="directory">/etc/rc.d/rc*.d</filename>)</para>
|
---|
23 |
|
---|
24 | <section>
|
---|
25 | <info><title>Creating network interface configuration files</title></info>
|
---|
26 |
|
---|
27 | <para>Which interfaces are brought up and down by the network script depends on
|
---|
28 | the files in the <filename class="directory">/etc/sysconfig/network-devices</filename> directory. This
|
---|
29 | directory should contain subdirectories in the form of
|
---|
30 | <filename>ifconfig.xyz</filename>, where <quote>xyz</quote> is a network
|
---|
31 | interface name (such as eth0)</para>
|
---|
32 |
|
---|
33 | <para>If you decide to rename or move this
|
---|
34 | <filename class="directory">/etc/sysconfig/network-devices</filename> directory,
|
---|
35 | make sure you update the <filename>/etc/sysconfig/rc</filename> file as well and
|
---|
36 | update the <quote>network_devices</quote> by providing it with the new path.</para>
|
---|
37 |
|
---|
38 | <para>Now, new files are created in that directory. The following command
|
---|
39 | creates a sample <filename>ipv4</filename> file for the
|
---|
40 | <filename>eth0</filename> device:</para>
|
---|
41 |
|
---|
42 | <screen><userinput>cd /etc/sysconfig/network-devices &&
|
---|
43 | mkdir ifconfig.eth0 &&
|
---|
44 | cat > ifconfig.eth0/ipv4 << "EOF"
|
---|
45 | ONBOOT=yes
|
---|
46 | SERVICE=ipv4-static
|
---|
47 | IP=192.168.1.1
|
---|
48 | GATEWAY=192.168.1.2
|
---|
49 | PREFIX=24
|
---|
50 | BROADCAST=192.168.1.255
|
---|
51 | EOF</userinput></screen>
|
---|
52 |
|
---|
53 | <para>Of course, the values of those variables have to be changed in every file
|
---|
54 | to match the proper setup. If the ONBOOT variable is set to <quote>yes</quote>,
|
---|
55 | the network script will bring up the equivalent interface during the booting of
|
---|
56 | the system. If set to anything but <quote>yes</quote>, the equivalent interface
|
---|
57 | will be ignored by the network script and not brought up.</para>
|
---|
58 |
|
---|
59 | <para>The SERVICE entry defines the method of obtaining the IP address. The LFS
|
---|
60 | bootscripts have a modular IP assignment format, and by creating additional
|
---|
61 | files in
|
---|
62 | <filename class="directory">/etc/sysconfig/network-devices/services</filename>,
|
---|
63 | you can allow other IP assignment methods. This would commonly be used if you
|
---|
64 | need DHCP, which is addressed in the BLFS book.</para>
|
---|
65 |
|
---|
66 | <para>Of course, GATEWAY should contain the IP of your default gateway, if you
|
---|
67 | have one. If not, then don't include the GATEWAY line in the configuration
|
---|
68 | file.</para>
|
---|
69 |
|
---|
70 | </section>
|
---|
71 |
|
---|
72 | <section xml:id="resolv.conf">
|
---|
73 | <title>Creating the /etc/resolv.conf file</title>
|
---|
74 | <indexterm zone="resolv.conf"><primary sortas="e-/etc/resolv.conf">/etc/resolv.conf</primary></indexterm>
|
---|
75 |
|
---|
76 | <para>If you're going to be connected to the Internet then most likely you'll
|
---|
77 | need some means of DNS name resolution to resolve Internet domain names to IP
|
---|
78 | addresses. This is best achieved by placing the IP address of your assigned DNS
|
---|
79 | resolver, available from your ISP (Internet Service Provider) or network
|
---|
80 | administrator, into <filename>/etc/resolv.conf</filename>. Create the file by
|
---|
81 | running the following:</para>
|
---|
82 |
|
---|
83 | <screen><userinput>cat > /etc/resolv.conf << "EOF"
|
---|
84 | # Begin /etc/resolv.conf
|
---|
85 |
|
---|
86 | domain {<replaceable>[Your Domain Name]</replaceable>}
|
---|
87 | nameserver <replaceable>[IP address of your nameserver]</replaceable>
|
---|
88 |
|
---|
89 | # End /etc/resolv.conf
|
---|
90 | EOF</userinput></screen>
|
---|
91 |
|
---|
92 | <para>Of course, replace
|
---|
93 | <replaceable>[IP address of your nameserver]</replaceable> with the IP address
|
---|
94 | of the DNS resolver assigned for your use. There will often be more than one
|
---|
95 | entry (requirements demand secondary servers for fallback capability). The IP
|
---|
96 | address may even be a router on your local network.</para>
|
---|
97 |
|
---|
98 | </section>
|
---|
99 |
|
---|
100 | </section>
|
---|