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-network-static">
|
---|
9 | <?dbhtml filename="network-static.html"?>
|
---|
10 |
|
---|
11 | <title>Static Networking Configuration</title>
|
---|
12 |
|
---|
13 | <sect2>
|
---|
14 | <title>Creating the Static Network Interface Configuration Files</title>
|
---|
15 |
|
---|
16 | <para>Which interfaces are brought up and down by the network script
|
---|
17 | depends on the files and directories in the <filename
|
---|
18 | class="directory">/etc/sysconfig/network-devices</filename> hierarchy.
|
---|
19 | This directory should contain a sub-directory for each interface to be
|
---|
20 | configured, such as <filename>ifconfig.xyz</filename>, where
|
---|
21 | <quote>xyz</quote> is a network interface name. Inside this directory
|
---|
22 | would be files defining the attributes to this interface, such as its IP
|
---|
23 | address(es), subnet masks, and so forth.</para>
|
---|
24 |
|
---|
25 | <note><para>Udev may assign random Network Card Interface names
|
---|
26 | for some network cards such as enp2s1. If you are not sure what
|
---|
27 | your Network Card Interface name is, you can always run
|
---|
28 | <command>ip l</command> after you have booted your system. Again,
|
---|
29 | it is important that <filename>ifconfig.xyz</filename> is named
|
---|
30 | after correct Network Card Interface name (e.g.
|
---|
31 | <filename>ifconfig.enp2s1</filename> or
|
---|
32 | <filename>ifconfig.eth0</filename>) or Systemd will fail to bring
|
---|
33 | up your network interface.</para></note>
|
---|
34 |
|
---|
35 | <para>The following command creates a sample <filename>ipv4</filename>
|
---|
36 | file for the <emphasis>eth0</emphasis> device:</para>
|
---|
37 |
|
---|
38 | <screen><userinput>cd /etc/sysconfig/network-devices &&
|
---|
39 | cat > ifconfig.eth0 << "EOF"
|
---|
40 | <literal>IFACE="eth0"
|
---|
41 | SERVICE="ipv4-static"
|
---|
42 | IP="192.168.1.1"
|
---|
43 | GATEWAY="192.168.1.2"
|
---|
44 | PREFIX="24"
|
---|
45 | BROADCAST="192.168.1.255"</literal>
|
---|
46 | EOF</userinput></screen>
|
---|
47 |
|
---|
48 | <para os="var-ob">The values of these variables must be changed in every
|
---|
49 | file to match the proper setup.</para>
|
---|
50 |
|
---|
51 | <para os="var-i">The <envar>IFACE</envar> variable defines the interface
|
---|
52 | name, for example, eth0. It is required for all network device configuration
|
---|
53 | files.</para>
|
---|
54 |
|
---|
55 | <para os="var-s">The <envar>SERVICE</envar> variable defines the method used
|
---|
56 | for obtaining the IP address. The CLFS-Network-Scripts package has a modular
|
---|
57 | IP assignment format, and creating additional files in the <filename
|
---|
58 | class="directory">/lib/services</filename>
|
---|
59 | directory allows other IP assignment methods.</para>
|
---|
60 |
|
---|
61 | <para>The <envar>GATEWAY</envar> variable should contain the default
|
---|
62 | gateway IP address, if one is present. If not, then comment out the
|
---|
63 | variable entirely.</para>
|
---|
64 |
|
---|
65 | <para>The <envar>PREFIX</envar> variable needs to contain the number of
|
---|
66 | bits used in the subnet. Each octet in an IP address is 8 bits. If the
|
---|
67 | subnet's netmask is 255.255.255.0, then it is using the first three octets
|
---|
68 | (24 bits) to specify the network number. If the netmask is 255.255.255.240,
|
---|
69 | it would be using the first 28 bits. Prefixes longer than 24 bits are
|
---|
70 | commonly used by DSL and cable-based Internet Service Providers (ISPs).
|
---|
71 | In this example (PREFIX=24), the netmask is 255.255.255.0. Adjust the
|
---|
72 | <envar>PREFIX</envar> variable according to your specific subnet.</para>
|
---|
73 |
|
---|
74 | <para>For more information see the <command>ifup</command> man page.</para>
|
---|
75 |
|
---|
76 | <para>To configure another DHCP Interface, Follow <xref linkend="ch-network-dhcp"/>.</para>
|
---|
77 |
|
---|
78 | </sect2>
|
---|
79 |
|
---|
80 | <sect2>
|
---|
81 | <title>Configuring the Network Interface at boot</title>
|
---|
82 |
|
---|
83 | <para>Enabling of the Network Interface configuration is
|
---|
84 | done per interface. To enable Network Interface
|
---|
85 | configuration at boot, run:</para>
|
---|
86 |
|
---|
87 | <screen><userinput>systemctl enable ifupdown@eth0</userinput></screen>
|
---|
88 |
|
---|
89 | <para>To disable previously enabled Network Interface
|
---|
90 | configuration at boot, run:</para>
|
---|
91 |
|
---|
92 | <screen><userinput>systemctl disable ifupdown@eth0</userinput></screen>
|
---|
93 |
|
---|
94 | <para>To manually start the Network Interface configuration,
|
---|
95 | run:</para>
|
---|
96 |
|
---|
97 | <screen><userinput>systemctl start ifupdown@eth0</userinput></screen>
|
---|
98 |
|
---|
99 | <para>Replace eth0 with the correct Network Interface
|
---|
100 | name as described on the beginning of this page.</para>
|
---|
101 |
|
---|
102 | </sect2>
|
---|
103 |
|
---|
104 | </sect1>
|
---|