source: BOOK/network/common/systemd-network.xml@ c01bd946

systemd
Last change on this file since c01bd946 was 7cd7f99, checked in by Chris Staub <chris@…>, 9 years ago

Put one configure option per line

  • Property mode set to 100644
File size: 4.0 KB
RevLine 
[31e77c0]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
[63f1942]13 <sect2 role="interface-config">
14 <title>Network Interface Configuration</title>
[31e77c0]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
[63f1942]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
[0131d1b]23 <envar>Name=eth0</envar>) or systemd will fail to bring
[31e77c0]24 up your network interface.</para></note>
25
[63f1942]26 <sect3 role="static">
27 <title>Static Network Interface Configuration</title>
[31e77c0]28
[63f1942]29 <para><command>systemd-networkd</command> uses
30 <filename>/etc/system/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
[7cd7f99]34<screen role="nodump"><userinput>cd /etc/systemd/network &amp;&amp;
[31e77c0]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
[63f1942]44 <para os="var-ob">The values of these variables must be changed in every
45 file to match the proper setup.</para>
[31e77c0]46
[63f1942]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>
[31e77c0]50
[63f1942]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>
[31e77c0]54
[63f1942]55 <para>For more information see the <command>systemd.netdev</command> man page.</para>
[31e77c0]56
[63f1942]57 </sect3>
[31e77c0]58
[63f1942]59 <sect3 role="dhcp">
60 <title>Connecting to a network with DHCP</title>
[31e77c0]61
[63f1942]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>
[31e77c0]67
[1ecf563]68<screen role="nodump"><userinput>cd /etc/systemd/network &amp;&amp;
[31e77c0]69cat &gt; dhcp.network &lt;&lt; "EOF"
70[Match]
71Name=enp2s0
72
73[Network]
74DHCP=yes
75EOF</userinput></screen>
76
[63f1942]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>
[31e77c0]81
[1ecf563]82<screen role="nodump"><userinput>ln -sv /run/systemd/network/resolv.conf /etc</userinput></screen>
[31e77c0]83
[63f1942]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
[1ecf563]96<screen role="nodump"><userinput>groupadd -g &gid-systemd-timesync; systemd-timesync
[63f1942]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
[1ecf563]102<screen role="nodump"><userinput>systemctl enable systemd-timesyncd</userinput></screen>
[63f1942]103
104 <para>You can configure <command>systemd-timesyncd</command> by editing
105 <filename>/etc/systemd/timesyncd.conf</filename>.</para>
106
[2256e5a]107 <para>Continue to <xref linkend="chapter-bootable"/>.</para>
108
[31e77c0]109 </sect2>
110
111</sect1>
Note: See TracBrowser for help on using the repository browser.