- Timestamp:
- Jan 23, 2014, 11:46:09 AM (11 years ago)
- Branches:
- clfs-3.0.0-systemd, clfs-3.0.0-sysvinit, master, systemd, sysvinit
- Children:
- 4112469
- Parents:
- 05d3e34
- Location:
- BOOK/network/common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
BOOK/network/common/hosts.xml
r05d3e34 r99f8c39 24 24 25 25 <para>If a network card is to be configured, decide on the IP address, 26 FQDN, and possible aliases for use in the26 fully-qualified domain name (FQDN), and possible aliases for use in the 27 27 <filename>/etc/hosts</filename> file. The syntax is:</para> 28 28 … … 35 35 are:</para> 36 36 37 <screen><literal> Class Networks 38 A 10.0.0.0 39 B 172.16.0.0 through 172.31.0.255 40 C 192.168.0.0 through 192.168.255.255</literal></screen> 37 <screen><literal>Private Network Address Range Normal Prefix 38 10.0.0.1 - 10.255.255.254 8 39 172.x.0.1 - 172.x.255.254 16 40 192.168.y.1 - 192.168.y.254 24</literal></screen> 41 42 <para>x can be any number in the range 16-31. y can be any number in the 43 range 0-255.</para> 41 44 42 45 <para>A valid IP address could be 192.168.1.1. A valid FQDN for this 43 IP could be <uri>www. linuxfromscratch.org</uri> (not recommended46 IP could be <uri>www.cross-lfs.org</uri> (not recommended 44 47 because this is a valid registered domain address and could cause 45 48 domain name server issues).</para> 46 49 47 <para>Even if not using a network card, a nFQDN is still required.50 <para>Even if not using a network card, a valid FQDN is still required. 48 51 This is necessary for certain programs to operate correctly.</para> 49 52 50 <para>Create the 53 <para>Create the <filename>/etc/hosts</filename> file by running:</para> 51 54 52 55 <screen><userinput>cat > /etc/hosts << "EOF" … … 54 57 55 58 127.0.0.1 localhost 56 <replaceable>[192.168.1.1]</replaceable> <replaceable>[<HOSTNAME>.example.org]</replaceable> <replaceable>[HOSTNAME]</replaceable> 59 <replaceable>[192.168.1.1]</replaceable> <replaceable>[<HOSTNAME>.example.org]</replaceable> <replaceable>[HOSTNAME]</replaceable> <replaceable>[alias ...]</replaceable> 57 60 58 61 # End /etc/hosts (network card version)</literal> … … 63 66 values need to be changed for specific users or requirements (if 64 67 assigned an IP address by a network/system administrator and the 65 machine will be connected to an existing network). </para>66 68 machine will be connected to an existing network). The optional 69 alias name(s) can be omitted.</para> 67 70 68 71 <para>If a network card is not going to be configured, create the -
BOOK/network/common/static.xml
r05d3e34 r99f8c39 23 23 address(es), subnet masks, and so forth.</para> 24 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 25 35 <para>The following command creates a sample <filename>ipv4</filename> 26 36 file for the <emphasis>eth0</emphasis> device:</para> 27 37 28 38 <screen><userinput>cd /etc/sysconfig/network-devices && 29 mkdir -v ifconfig.eth0 && 30 cat > ifconfig.eth0/ipv4 << "EOF" 31 <literal>ONBOOT="yes" 39 cat > ifconfig.eth0 << "EOF" 40 <literal>IFACE="eth0" 32 41 SERVICE="ipv4-static" 33 42 IP="192.168.1.1" … … 37 46 EOF</userinput></screen> 38 47 39 <para os="var-ob">The values of these variables must be changed in every file to match 40 the proper setup. If the <envar>ONBOOT</envar> variable is set to 41 <quote>yes</quote> the network script will bring up the Network Interface 42 Card (NIC) during booting of the system. If set to anything but 43 <quote>yes</quote> the NIC will be ignored by the network script and not 44 be brought up.</para> 48 <para os="var-ob">The values of these variables must be changed in every 49 file to match the proper setup.</para> 45 50 46 <para os="var-s">The <envar>SERVICE</envar> variable defines the method used for 47 obtaining the IP address. The CLFS-Bootscripts package has a modular IP 48 assignment format, and creating additional files in the <filename 49 class="directory">/etc/sysconfig/network-devices/services</filename> 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> 50 59 directory allows other IP assignment methods.</para> 51 60 … … 63 72 <envar>PREFIX</envar> variable according to your specific subnet.</para> 64 73 74 <para>For more information see the <command>ifup</command> man page.</para> 75 65 76 <para>To configure another DHCP Interface, Follow <xref linkend="ch-network-dhcp"/>.</para> 66 77 67 78 </sect2> 68 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 69 104 </sect1>
Note:
See TracChangeset
for help on using the changeset viewer.