source: BOOK/network/common/sysconfig-network.xml@ 12fa208

systemd
Last change on this file since 12fa208 was 1ecf563, checked in by Chris Staub <chris@…>, 10 years ago

Use nodump to prevent jhalfs from processing network config commands

  • Property mode set to 100644
File size: 4.3 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-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</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 role="nodump"><userinput>mkdir -pv /etc/sysconfig &amp;&amp;
39cd /etc/sysconfig &amp;&amp;
40cat &gt; ifconfig.eth0 &lt;&lt; "EOF"
41<literal>IFACE="eth0"
42SERVICE="ipv4-static"
43IP="192.168.1.1"
44GATEWAY="192.168.1.2"
45PREFIX="24"
46BROADCAST="192.168.1.255"</literal>
47EOF</userinput></screen>
48
49 <para os="var-ob">The values of these variables must be changed in every
50 file to match the proper setup.</para>
51
52 <para os="var-i">The <envar>IFACE</envar> variable defines the interface
53 name, for example, eth0. It is required for all network device configuration
54 files.</para>
55
56 <para os="var-s">The <envar>SERVICE</envar> variable defines the method used
57 for obtaining the IP address. The CLFS-Network-Scripts package has a modular
58 IP assignment format, and creating additional files in the <filename
59 class="directory">/lib/services</filename>
60 directory allows other IP assignment methods.</para>
61
62 <para>The <envar>GATEWAY</envar> variable should contain the default
63 gateway IP address, if one is present. If not, then comment out the
64 variable entirely.</para>
65
66 <para>The <envar>PREFIX</envar> variable needs to contain the number of
67 bits used in the subnet. Each octet in an IP address is 8 bits. If the
68 subnet's netmask is 255.255.255.0, then it is using the first three octets
69 (24 bits) to specify the network number. If the netmask is 255.255.255.240,
70 it would be using the first 28 bits. Prefixes longer than 24 bits are
71 commonly used by DSL and cable-based Internet Service Providers (ISPs).
72 In this example (PREFIX=24), the netmask is 255.255.255.0. Adjust the
73 <envar>PREFIX</envar> variable according to your specific subnet.</para>
74
75 <para>For more information see the <command>ifup</command> man page.</para>
76
77 <para>To configure another DHCP Interface, Follow <xref linkend="ch-network-dhcpcd"/>.</para>
78
79 </sect2>
80
81 <sect2>
82 <title>Configuring the Network Interface at boot</title>
83
84 <para>Enabling of the Network Interface configuration is
85 done per interface. To enable Network Interface
86 configuration at boot, run:</para>
87
88<screen role="nodump"><userinput>systemctl enable ifupdown@eth0</userinput></screen>
89
90 <para>To disable previously enabled Network Interface
91 configuration at boot, run:</para>
92
93<screen role="nodump"><userinput>systemctl disable ifupdown@eth0</userinput></screen>
94
95 <para>To manually start the Network Interface configuration,
96 run:</para>
97
98<screen role="nodump"><userinput>systemctl start ifupdown@eth0</userinput></screen>
99
100 <para>Replace eth0 with the correct Network Interface
101 name as described on the beginning of this page.</para>
102
103 </sect2>
104
105</sect1>
Note: See TracBrowser for help on using the repository browser.