Changeset 131c907 for chapter07/network.xml
- Timestamp:
- 12/31/2015 09:09:13 AM (8 years ago)
- Branches:
- 7.9-systemd
- Children:
- 6e13139
- Parents:
- 6eb40d4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
chapter07/network.xml
r6eb40d4 r131c907 23 23 <para>Starting with version 209, systemd ships a network configuration 24 24 daemon called <command>systemd-networkd</command> which can be used for 25 basic network configuration.</para> 26 27 <para>Configuration files for <command>systemd-networkd</command> can be 28 placed in <filename class="directory">/usr/lib/systemd/network</filename> 29 or <filename class="directory">/etc/systemd/network</filename>. Note that 30 files in <filename class="directory">/etc/systemd/network</filename> have 25 basic network configuration. Additionally, since version 213, DNS name 26 resolution can be handled by <command>systemd-resolved</command> in place 27 of a static <filename>/etc/resolv.conf</filename> file. Both services are 28 enabled by defualt, and absolutely should not be disabled.</para> 29 30 <para>Configuration files for <command>systemd-networkd</command> (and 31 <command>systemd-resolved</command>) can be placed in 32 <filename class="directory">/usr/lib/systemd/network</filename> 33 or <filename class="directory">/etc/systemd/network</filename>. Files in 34 <filename class="directory">/etc/systemd/network</filename> have a 31 35 higher priority than the ones in 32 <filename class="directory">/usr/lib/systemd/network</filename>.</para> 33 34 <para>There are three types of configuration files: 36 <filename class="directory">/usr/lib/systemd/network</filename>. 37 There are three types of configuration files: 35 38 <filename class="extension">.link</filename>, 36 39 <filename class="extension">.netdev</filename> and 37 40 <filename class="extension">.network</filename> files. For detailed 38 explanation about contents of the mentioned39 configuration files, consult<filename>systemd-link(5)</filename>,41 descriptions and example contents of these configuration files, consult 42 the <filename>systemd-link(5)</filename>, 40 43 <filename>systemd-netdev(5)</filename> and 41 44 <filename>systemd-network(5)</filename> manual pages.</para> … … 50 53 <title>Static IP Configuration</title> 51 54 52 <para>The command below creates a basic configuration file for 53 Static IP setup:</para> 54 55 <screen role="nodump"><userinput>cat > /etc/systemd/network/10-static-eth0.network << "EOF" 55 <para>The command below creates a basic configuration file for a 56 Static IP setup (using both systemd-networkd and 57 systemd-resolved):</para> 58 59 <screen role="nodump"><userinput>cat > /etc/systemd/network/10-eth0-static.network << "EOF" 56 60 <literal>[Match] 57 61 Name=eth0 … … 63 67 EOF</userinput></screen> 64 68 65 <para>More than one DNS entry can be specified in the configuration file.</para> 69 <para>Multiple DNS entries can be added if you have more than one DNS 70 server.</para> 66 71 67 72 </sect3> … … 70 75 <title>DHCP Configuration</title> 71 76 72 <para>The command below creates a basic configuration file for 77 <para>The command below creates a basic configuration file for an IPv4 73 78 DHCP setup:</para> 74 79 75 <screen role="nodump"><userinput>cat > /etc/systemd/network/10- dhcp-eth0.network << "EOF"80 <screen role="nodump"><userinput>cat > /etc/systemd/network/10-eth0-dhcp.network << "EOF" 76 81 <literal>[Match] 77 82 Name=eth0 78 83 79 84 [Network] 80 DHCP=yes</literal> 81 EOF</userinput></screen> 82 83 <para>Note that <command>systemd-networkd</command> can only handle 84 DHCPv4. DHCPv6 support is a work in progress.</para> 85 DHCP=ipv4</literal> 86 EOF</userinput></screen> 85 87 86 88 </sect3> … … 102 104 <filename>/etc/resolv.conf</filename>.</para> 103 105 104 <para>If static <filename>/etc/resolv.conf</filename> is desired, create 105 it by running the following command:</para> 106 <sect3 id="resolv-conf-systemd-resoloved"> 107 <title>systemd-resolved Configuration</title> 108 109 <note><para>If using another means to configure your network 110 interfaces (ex: ppp, network-manager, etc.), or if using any type of 111 local resolver (ex: bind, dnsmasq, etc.), or any other software that 112 generates an <filename>/etc/resolv.conf</filename> (ex: resolvconf), the 113 <command>systemd-resolved</command> service should not be 114 used.</para></note> 115 116 <para>When using <command>systemd-resolved</command> for DNS 117 configuration, it is responsible for creating the 118 <filename>/etc/resolv.conf</filename> file, which is placed in a 119 non-standard location that is writable during early boot. In order to be 120 used by other components of the system, it is necessary to create a 121 symlink with the following command:</para> 122 123 <screen><userinput>ln -sfv /run/systemd/resolve/resolv.conf /etc/resolv.conf</userinput></screen> 124 125 <para>This is required if you are specifying DNS entries in <filename 126 class="extension">.network</filename> files or using the built in 127 DHCP client to obtain DNS addresses.</para> 128 129 </sect3> 130 131 <sect3 id="resolv-conf-static"> 132 <title>Static resolv.conf Configuration</title> 133 134 <para>If a static <filename>/etc/resolv.conf</filename> is desired, 135 create it by running the following command:</para> 106 136 107 137 <screen role="nodump"><userinput>cat > /etc/resolv.conf << "EOF" … … 115 145 EOF</userinput></screen> 116 146 117 <para>The <varname>domain</varname> statement can be omitted 118 or replaced with a <varname>search</varname> statement. See the man page for 119 resolv.conf for more details.</para> 120 121 <para>Replace <replaceable><IP address of the nameserver></replaceable> 122 with the IP address of the DNS most appropriate for the setup. There will 123 often be more than one entry (requirements demand secondary servers for 124 fallback capability). If you only need or want one DNS server, remove the 125 second <emphasis>nameserver</emphasis> line from the file. The IP address 126 may also be a router on the local network.</para> 127 128 <note><para>The Google Public IPv4 DNS addresses are 8.8.8.8 and 8.8.4.4.</para></note> 129 130 <para>When using <command>systemd-networkd</command> for network 131 configuration, another daemon, <command>systemd-resolved</command>, 132 is responsible for creating the <filename>/etc/resolv.conf</filename> 133 file. It is, however, placed in a non-standard location which is 134 writable since early boot, so it is necessary to create a symlink 135 to it by running the following command:</para> 136 137 <screen><userinput>ln -sfv /run/systemd/resolve/resolv.conf /etc/resolv.conf</userinput></screen> 138 139 <para>This is required if you are specifying DNS entries in <filename 140 class="extension">.network</filename> files or using the built in 141 DHCP client to obtain DNS addresses.</para> 147 <para>The <varname>domain</varname> statement can be omitted 148 or replaced with a <varname>search</varname> statement. See the man page 149 for resolv.conf for more details.</para> 150 151 <para>Replace 152 <replaceable><IP address of the nameserver></replaceable> 153 with the IP address of the DNS most appropriate for the setup. There will 154 often be more than one entry (requirements demand secondary servers for 155 fallback capability). If you only need or want one DNS server, remove the 156 second <emphasis>nameserver</emphasis> line from the file. The IP address 157 may also be a router on the local network.</para> 158 159 <note><para>The Google Public IPv4 DNS addresses are 160 <parameter>8.8.8.8</parameter> and <parameter>8.8.4.4</parameter> 161 for IPv4, and <parameter>2001:4860:4860::8888</parameter> and 162 <parameter>2001:4860:4860::8844</parameter> for IPv6.</para></note> 163 164 </sect3> 142 165 143 166 </sect2>
Note:
See TracChangeset
for help on using the changeset viewer.