[3f8be484] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[aa18ac0] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
[0b9e109] | 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
[3f8be484] | 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
| 7 |
|
---|
[593f554e] | 8 | <sect1 id="ch-network-static">
|
---|
| 9 | <?dbhtml filename="network-static.html"?>
|
---|
[3f8be484] | 10 |
|
---|
[593f554e] | 11 | <title>Static Networking Configuration</title>
|
---|
[3f8be484] | 12 |
|
---|
| 13 | <sect2>
|
---|
[593f554e] | 14 | <title>Creating the Static Network Interface Configuration Files</title>
|
---|
[3f8be484] | 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
|
---|
[c62aadc] | 22 | would be files defining the attributes to this interface, such as its IP
|
---|
| 23 | address(es), subnet masks, and so forth.</para>
|
---|
[3f8be484] | 24 |
|
---|
[99f8c39] | 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 |
|
---|
[3f8be484] | 35 | <para>The following command creates a sample <filename>ipv4</filename>
|
---|
[c62aadc] | 36 | file for the <emphasis>eth0</emphasis> device:</para>
|
---|
[3f8be484] | 37 |
|
---|
| 38 | <screen><userinput>cd /etc/sysconfig/network-devices &&
|
---|
[99f8c39] | 39 | cat > ifconfig.eth0 << "EOF"
|
---|
| 40 | <literal>IFACE="eth0"
|
---|
[71544ee] | 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>
|
---|
[3f8be484] | 46 | EOF</userinput></screen>
|
---|
| 47 |
|
---|
[99f8c39] | 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>
|
---|
[572d0a6] | 59 | directory allows other IP assignment methods.</para>
|
---|
[3f8be484] | 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 |
|
---|
[c62aadc] | 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>
|
---|
[3f8be484] | 73 |
|
---|
[99f8c39] | 74 | <para>For more information see the <command>ifup</command> man page.</para>
|
---|
| 75 |
|
---|
[593f554e] | 76 | <para>To configure another DHCP Interface, Follow <xref linkend="ch-network-dhcp"/>.</para>
|
---|
[3f8be484] | 77 |
|
---|
| 78 | </sect2>
|
---|
| 79 |
|
---|
[99f8c39] | 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 |
|
---|
[3f8be484] | 104 | </sect1>
|
---|