[networking-guide] master: Improve: Using the Command Line Interface (0d70419)

stephenw at fedoraproject.org stephenw at fedoraproject.org
Fri Jan 2 07:54:20 UTC 2015


Repository : http://git.fedorahosted.org/cgit/docs/networking-guide.git

On branch  : master

>---------------------------------------------------------------

commit 0d704193c38d746099e99ac5fed04a4cff9be3ac
Author: Stephen Wadeley <swadeley at redhat.com>
Date:   Thu Jan 1 18:46:39 2015 +0100

    Improve: Using the Command Line Interface


>---------------------------------------------------------------

 en-US/Configure_Networking.xml |   71 ++++++++++++++++++++++++++++++---------
 1 files changed, 54 insertions(+), 17 deletions(-)

diff --git a/en-US/Configure_Networking.xml b/en-US/Configure_Networking.xml
index 5f04c3e..b19c415 100644
--- a/en-US/Configure_Networking.xml
+++ b/en-US/Configure_Networking.xml
@@ -1574,18 +1574,18 @@ See <citetitle pubwork="book">&MAJOROSVER; System Administrator's Guide</citetit
 <section id="sec-Configuring_a_Network_Interface_Using_ifcg_Files">
 <title>Configuring a Network Interface Using ifcfg Files</title>
     <para>
-      Interface configuration files control the software interfaces for individual network devices. As the system boots, it uses these files to determine what interfaces to bring up and how to configure them. These files are usually named <filename>ifcfg-<replaceable>name</replaceable></filename>, where the suffix <replaceable>name</replaceable> refers to the name of the device that the configuration file controls. By convention, the <filename>ifcfg</filename> file's suffix, <replaceable>ethX</replaceable>, is the same as the string given by the <command>DEVICE</command> directive in the configuration file itself.
+      Interface configuration files control the software interfaces for individual network devices. As the system boots, it uses these files to determine what interfaces to bring up and how to configure them. These files are usually named <filename>ifcfg-<replaceable>name</replaceable></filename>, where the suffix <replaceable>name</replaceable> refers to the name of the device that the configuration file controls. By convention, the <filename>ifcfg</filename> file's suffix is the same as the string given by the <command>DEVICE</command> directive in the configuration file itself.
     </para>
 <bridgehead id="bh-Static_Network_Settings">Static Network Settings</bridgehead>
 <para>
-  To configure an interface with static network settings using <filename>ifcfg</filename> files, for an interface with name <interface>eth0</interface>, create a file with name <filename>ifcfg-eth0</filename> in the <filename class="directory">/etc/sysconfig/network-scripts/</filename> directory as follows:
+  To configure an interface with static network settings using <filename>ifcfg</filename> files, for an interface with the name <interface>eth0</interface>, create a file with name <filename>ifcfg-eth0</filename> in the <filename class="directory">/etc/sysconfig/network-scripts/</filename> directory as follows:
         <programlisting>DEVICE=eth0
 BOOTPROTO=none
 ONBOOT=yes
 PREFIX=24
 IPADDR=10.0.1.27
-NM_CONTROLLED=no</programlisting>
-Optionally specify the hardware or MAC address using the <command>HWADDR</command> directive. Note that this will influence the device naming procedure as explained in <xref linkend="ch-Consistent_Network_Device_Naming" />. You do not need to specify the broadcast address as this is calculated automatically by <application>ipcalc</application>.
+</programlisting>
+Optionally specify the hardware or MAC address using the <command>HWADDR</command> directive. Note that this may influence the device naming procedure as explained in <xref linkend="ch-Consistent_Network_Device_Naming" />. You do not need to specify the network or broadcast address as this is calculated automatically by <application>ipcalc</application>.
 </para>
 
 <bridgehead id="bh-Dynamic_Network_Settings">Dynamic Network Settings</bridgehead>
@@ -1594,13 +1594,32 @@ Optionally specify the hardware or MAC address using the <command>HWADDR</comman
         <programlisting>DEVICE=em1
 BOOTPROTO=dhcp
 ONBOOT=yes
-NM_CONTROLLED=no</programlisting>
-Optionally specify the hardware or MAC address using the <command>HWADDR</command> directive. Note that this will influence the device naming procedure as explained in <xref linkend="ch-Consistent_Network_Device_Naming" />. You do not need to specify the broadcast address as this is calculated automatically by <application>ipcalc</application>.
+</programlisting>
+Optionally specify the hardware or MAC address using the <command>HWADDR</command> directive. Note that this may influence the device naming procedure as explained in <xref linkend="ch-Consistent_Network_Device_Naming" />. You do not need to specify the network or broadcast address as this is calculated automatically by <application>ipcalc</application>.
 </para>
+<para>
+   To configure an interface to send a different host name to the <systemitem class="protocol">DHCP</systemitem> server, add the following line to the <filename>ifcfg</filename> file.
+   <synopsis>DHCP_HOSTNAME=<replaceable>hostname</replaceable></synopsis>
+</para>
+<para>
+   To configure an interface to ignore routes sent by a <systemitem class="protocol">DHCP</systemitem> server, add the following line to the <filename>ifcfg</filename> file.
+   <synopsis>PEERDNS=no</synopsis>
+   This will prevent network service from updating <filename>/etc/resolv.conf</filename> with the <systemitem class="protocol">DNS</systemitem> servers received from a <systemitem class="protocol">DHCP</systemitem> server.
+</para>
+<para>
+  To configure an interface to use particular <systemitem class="protocol">DNS</systemitem> servers, set <command>PEERDNS=no</command> as described above and add lines as follows to the <filename>ifcfg</filename> file:
+  <programlisting>DNS1=<replaceable>ip-address</replaceable>
+DNS2=<replaceable>ip-address</replaceable></programlisting>
+  where <replaceable>ip-address</replaceable> is the address of a <systemitem class="protocol">DNS</systemitem> server. This will cause the network service to update <filename>/etc/resolv.conf</filename> with the <systemitem class="protocol">DNS</systemitem> servers specified.
+</para>
+    <para>
+      <application>NetworkManager</application> will by default call the <systemitem class="protocol">DHCP</systemitem> client, <application>dhclient</application>, when a profile has been set to obtain addresses automatically, or when an interface configuration file has BOOTPROTO set to <literal>dhcp</literal>. Where <systemitem class="protocol">DHCP</systemitem> is required, an instance of <systemitem class="service">dhclient</systemitem> is started for every Internet protocol, <systemitem class="protocol">IPv4</systemitem> and <systemitem class="protocol">IPv6</systemitem>, on an interface. Where <application>NetworkManager</application> is not running, or not managing an interface, then the legacy network service will call instances of <systemitem class="service">dhclient</systemitem> as required.
+    </para>
 
-      <para>
+
+      <!--<para>
        For a listing of the configurable parameters in an Ethernet interface configuration file see the <citetitle pubwork="book">&MAJOROSVER; System Administrator's Reference Guide</citetitle>.
-      </para>
+      </para>-->
       </section>
 
       <section id="sec-Configuring_a_Network_Interface_Using_ip_commands">
@@ -1651,7 +1670,7 @@ The address assignment of a specific device can be viewed as follows:
 <section id="sec-Static-Routes_and_the_Default_Gateway">
     <title>Static Routes and the Default Gateway</title>
     <para>
-    Static routes are for traffic that must not, or should not, go through the default gateway. Routing is usually handled by routing devices and therefore it is often not necessary to configure static routes on <application>Fedora</application> servers or clients. Exceptions include traffic that must pass through an encrypted VPN tunnel or traffic that should take a less costly route. The default gateway is for any and all traffic which is not destined for the local network and for which no preferred route is specified in the routing table. The default gateway is traditionally a dedicated network router.
+    Static routes are for traffic that must not, or should not, go through the default gateway. Routing is often handled by devices on the network dedicated to routing (although any device can be configured to perform routing). Therefore, it is often not necessary to configure static routes on Fedora servers or clients. Exceptions include traffic that must pass through an encrypted VPN tunnel or traffic that should take a specific route for reasons of cost or security. The default gateway is for any and all traffic which is not destined for the local network and for which no preferred route is specified in the routing table. The default gateway is traditionally a dedicated network router.
     </para>
     <bridgehead id="bh-networkscripts-static-routes">
    Configuring Static Routes Using the Command Line
@@ -1660,13 +1679,31 @@ The address assignment of a specific device can be viewed as follows:
     <primary>static route</primary>
     </indexterm>
     <para>
-      Use the <command>ip route</command> command to display the <systemitem class="protocol">IP</systemitem> routing table. If static routes are required, they can be added to the routing table by means of the <command>ip route add</command> command and removed using the <command>ip route del</command> command. To add a static route to a host address, that is to say to a single <systemitem class="protocol">IP</systemitem> address, issue the following command as <systemitem class="username">root</systemitem>:
-      <screen>ip route add <replaceable>192.0.2.1</replaceable></screen> where <replaceable>192.0.2.1</replaceable> is the <systemitem class="protocol">IP</systemitem> address of the host in dotted decimal notation. To add a static route to a network, that is to say to an <systemitem class="protocol">IP</systemitem> address representing a range of <systemitem class="protocol">IP</systemitem> addresses, issue the following command as <systemitem class="username">root</systemitem>:
-      <screen>ip route add <replaceable>192.0.2.0/24</replaceable></screen> where <replaceable>192.0.2.0</replaceable> is the <systemitem class="protocol">IP</systemitem> address of the network in dotted decimal notation and <replaceable>/24</replaceable> is the network prefix. The network prefix is the number of enabled bits in the subnet mask. This format of network address slash prefix length is referred to as CIDR notation.
+      If static routes are required, they can be added to the routing table by means of the <command>ip route add</command> command and removed using the <command>ip route del</command> command. The more frequently used <command>ip route</command> commands take the following form:
+<synopsis>ip route <optional> add | del | change | append | replace </optional> <replaceable>destination-address</replaceable></synopsis>
+See the <filename>ip-route(8)</filename> man page for more details on the options and formats.</para>
+<para>
+Use the <command>ip route</command> command without options to display the <systemitem class="protocol">IP</systemitem> routing table. For example:
+<screen>~]$&nbsp;ip route
+default via 192.168.122.1 dev ens9  proto static  metric 1024
+192.168.122.0/24 dev ens9  proto kernel  scope link  src 192.168.122.107
+192.168.122.0/24 dev eth0  proto kernel  scope link  src 192.168.122.126</screen>
+</para>
+
+
+      <para>To add a static route to a host address, in other words to a single <systemitem class="protocol">IP</systemitem> address, issue a command as <systemitem class="username">root</systemitem>:
+      <screen>ip route add <replaceable>192.0.2.1</replaceable> via <replaceable>10.0.0.1</replaceable> <optional><option>dev</option> <replaceable>ifname</replaceable></optional></screen>
+      Where <replaceable>192.0.2.1</replaceable> is the <systemitem class="protocol">IP</systemitem> address of the host in dotted decimal notation, <replaceable>10.0.0.1</replaceable> is the next hop address and <replaceable>ifname</replaceable> is the exit interface leading to the next hop.</para>
+      <para>To add a static route to a network, in other words to an <systemitem class="protocol">IP</systemitem> address representing a range of <systemitem class="protocol">IP</systemitem> addresses, issue the following command as <systemitem class="username">root</systemitem>:
+      <screen>ip route add <replaceable>192.0.2.0/24</replaceable> via <replaceable>10.0.0.1</replaceable> <optional><option>dev</option> <replaceable>ifname</replaceable></optional></screen> where <replaceable>192.0.2.0</replaceable> is the <systemitem class="protocol">IP</systemitem> address of the destination network in dotted decimal notation and <replaceable>/24</replaceable> is the network prefix. The network prefix is the number of enabled bits in the subnet mask. This format of network address slash network prefix length is sometimes referred to as <firstterm>classless inter-domain routing</firstterm> (<acronym>CIDR</acronym>) notation.
       </para>
 
       <para>
-      Static route configuration is stored per-interface in a <filename>/etc/sysconfig/network-scripts/route-<replaceable>interface</replaceable></filename> file. For example, static routes for the <interface>eth0</interface> interface would be stored in the <filename>/etc/sysconfig/network-scripts/route-eth0</filename> file. The <filename>route-<replaceable>interface</replaceable></filename> file has two formats: <application>ip</application> command arguments and network/netmask directives. These are described below.
+      Static route configuration can be stored per-interface in a <filename>/etc/sysconfig/network-scripts/route-<replaceable>interface</replaceable></filename> file. For example, static routes for the <interface>eth0</interface> interface would be stored in the <filename>/etc/sysconfig/network-scripts/route-eth0</filename> file. The <filename>route-<replaceable>interface</replaceable></filename> file has two formats: <application>ip</application> command arguments and network/netmask directives. These are described below.
+    </para>
+
+    <para>
+      See the <filename>ip-route(8)</filename> man page for more information on the <command>ip route</command> command.
     </para>
 
       <bridgehead id="bh-networkscripts-default-gateway">
@@ -1677,10 +1714,10 @@ The address assignment of a specific device can be viewed as follows:
     <para>
       The default gateway is determined by the network scripts which parse the <filename>/etc/sysconfig/network</filename> file first and then the network interface <literal>ifcfg</literal> files for interfaces that are <quote>up</quote>. The <literal>ifcfg</literal> files are parsed in numerically ascending order, and the last GATEWAY directive to be read is used to compose a default route in the routing table.</para>
     <para>
-      The default route can thus be indicated by means of the GATEWAY directive and can be specified either globally or in interface-specific configuration files. Specifying the gateway globally has certain advantages in static networking environments, especially if more than one network interface is present. It can make fault finding simpler if applied consistently. There is also the GATEWAYDEV directive, which is a global option. If multiple devices specify GATEWAY, and one interface uses the GATEWAYDEV directive, that directive will take precedence. This option is not recommend as it can have unexpected consequences if an interface goes down and it can complicate fault finding.
+      The default route can thus be indicated by means of the GATEWAY directive and can be specified either globally or in interface-specific configuration files. Specifying the gateway globally has certain advantages in static networking environments, especially if more than one network interface is present. It can make fault finding simpler if applied consistently.
     </para>
     <para>
-      In dynamic network environments, where mobile hosts are managed by <application>NetworkManager</application>, gateway information is likely to be interface specific and is best left to be assigned by DHCP. In special cases where it is necessary to influence <application>NetworkManager</application>'s selection of the exit interface to be used to reach a gateway, make use of the <command>DEFROUTE=no</command> command in the <literal>ifcfg</literal> files for those interfaces which do not lead to the default gateway.
+      In dynamic network environments, where mobile hosts are managed by <application>NetworkManager</application>, gateway information is likely to be interface specific and is best left to be assigned by <systemitem class="protocol">DHCP</systemitem>. In special cases where it is necessary to influence <application>NetworkManager</application>'s selection of the exit interface to be used to reach a gateway, make use of the <command>DEFROUTE=no</command> command in the <literal>ifcfg</literal> files for those interfaces which do not lead to the default gateway.
     </para>
      <para>
       Global default gateway configuration is stored in the <filename>/etc/sysconfig/network</filename> file.
@@ -1782,7 +1819,7 @@ To address these problems, the IETF draft <ulink url="https://tools.ietf.org/id/
   <para>
     To configure an interface to use a tokenized <systemitem class="protocol">IPv6</systemitem> identifier, issue a command in the following format as <systemitem class="username">root</systemitem> user:
     <screen>~]#&nbsp;<command>ip token set ::1a:2b:3c:4d/64 dev eth4</command></screen>
-    Where <literal>::1a:2b:3c:4d/64</literal> is the token to be used. This setting is not persistent. To make it persistent, add the command to an init script.</para>
+    Where <literal>::1a:2b:3c:4d/64</literal> is the token to be used. This setting is not persistent. To make it persistent, add the command to an init script. See <xref linkend="sec-Network_Configuration_Using_sysconfig_Files" /> for information on network scripts.</para>
   <para>
     Using a memorable token is possible, but is limited to the range of valid hexadecimal digits. For example, for a <systemitem class="protocol">DNS</systemitem> server, which traditionally uses port <literal>53</literal>, a token of <literal>::53/64</literal> could be used.
   </para>
@@ -1804,7 +1841,7 @@ To address these problems, the IETF draft <ulink url="https://tools.ietf.org/id/
    Note that adding a token to an interface will replace a previously allocated token, and in turn invalidate the address derived from it. Supplying a new token causes a new address to be generated and applied, but this process will leave any other addresses unchanged. In other words, a new tokenized identifier only replaces a previously existing tokenized identifier, not any other <systemitem class="protocol">IP</systemitem> address.</para>
    <note>
      <para>
-Take care not to add the same token to more than one system or interface as the duplicate address detection (<acronym>DAD</acronym>) mechanism will not be able to resolve the problem. Once a token is set, it cannot be cleared or reset, except by rebooting the machine. 
+Take care not to add the same token to more than one system or interface. The duplicate address detection (<acronym>DAD</acronym>) mechanism will remove the duplicate address from the interface but it cannot change the configuration. Once a token is set, it cannot be cleared or reset, except by rebooting the machine.
  </para>
    </note>
 </section>



More information about the docs-commits mailing list