source: BOOK/network/common/systemd-network.xml@ 988dedf

systemd
Last change on this file since 988dedf was 80765e9, checked in by William Harrington <kb0iic@…>, 8 years ago

Path for systemd-networkd should be /etc/systemd/network and not /etc/system/network per the systemd-networkd manual page.

  • Property mode set to 100644
File size: 4.0 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-systemd-network">
9 <?dbhtml filename="systemd-network.html"?>
10
11 <title>Networking Configuration with Systemd-networkd</title>
12
13 <sect2 role="interface-config">
14 <title>Network Interface Configuration</title>
15
16 <note><para>Udev may assign random Network Card Interface names
17 for some network cards such as enp2s1. If you are not sure what
18 your Network Card Interface name is, you can always run
19 <command>ip l</command> after you have booted your system. It is important
20 that the <envar>Name</envar> variable in
21 <filename>/etc/systemd/network</filename> contain the correct Network Card
22 Interface name (e.g. <envar>Name=enp2s1</envar> or
23 <envar>Name=eth0</envar>) or systemd will fail to bring
24 up your network interface.</para></note>
25
26 <sect3 role="static">
27 <title>Static Network Interface Configuration</title>
28
29 <para><command>systemd-networkd</command> uses
30 <filename>/etc/systemd/network</filename> for configuration files. Refer
31 to systemd.network(5) and systemd.netdev(5). Configure a network
32 interface with a config file. Adjust Name= as required:</para>
33
34<screen role="nodump"><userinput>cd /etc/systemd/network &amp;&amp;
35cat &gt; static.network &lt;&lt; "EOF"
36[Match]
37Name=enp2s0
38
39[Network]
40Address=192.168.1.1/24
41Gateway=192.168.1.2
42EOF</userinput></screen>
43
44 <para os="var-ob">The values of these variables must be changed in every
45 file to match the proper setup.</para>
46
47 <para os="var-i">The <envar>Name</envar> variable defines the interface
48 name, for example, eth0. It is required for all network device
49 configuration files.</para>
50
51 <para>The <envar>Gateway</envar> variable should contain the default
52 gateway IP address, if one is present. If not, then comment out the
53 variable entirely.</para>
54
55 <para>For more information see the <command>systemd.netdev</command> man page.</para>
56
57 </sect3>
58
59 <sect3 role="dhcp">
60 <title>Connecting to a network with DHCP</title>
61
62 <para><command>systemd-networkd</command> uses
63 <filename>/etc/systemd/network</filename> for configuration files. Refer
64 to <filename>systemd.network(5)</filename> and
65 <filename>systemd.netdev(5)</filename>. Configure a network interface
66 with a config file. Adjust Name= as required:</para>
67
68<screen role="nodump"><userinput>cd /etc/systemd/network &amp;&amp;
69cat &gt; dhcp.network &lt;&lt; "EOF"
70[Match]
71Name=enp2s0
72
73[Network]
74DHCP=yes
75EOF</userinput></screen>
76
77 <para><command>systemd-networkd</command> will automatically configure
78 <filename>/run/systemd/network/resolv.conf</filename> when using DHCP.
79 If you did not manually create <filename>/etc/resolv.conf</filename>,
80 create a symlink:</para>
81
82<screen role="nodump"><userinput>ln -sv /run/systemd/network/resolv.conf /etc</userinput></screen>
83
84 </sect3>
85
86 </sect2>
87
88 <sect2 role="timesyncd">
89 <title>Using Timesyncd</title>
90
91 <para>Systemd includes a simple NTP client daemon,
92 <command>systemd-timesyncd</command>, though it is disabled by
93 default. If you want to enable it, you will first need to add a required
94 user and group:</para>
95
96<screen role="nodump"><userinput>groupadd -g &gid-systemd-timesync; systemd-timesync
97useradd -g systemd-timesync -u &uid-systemd-timesync; -d /dev/null -s /bin/false systemd-timesync</userinput></screen>
98
99 <para>Then, actually enable <command>systemd-timesyncd</command> so that
100 it will run on system boot:</para>
101
102<screen role="nodump"><userinput>systemctl enable systemd-timesyncd</userinput></screen>
103
104 <para>You can configure <command>systemd-timesyncd</command> by editing
105 <filename>/etc/systemd/timesyncd.conf</filename>.</para>
106
107 <para>Continue to <xref linkend="chapter-bootable"/>.</para>
108
109 </sect2>
110
111</sect1>
Note: See TracBrowser for help on using the repository browser.