source: BOOK/network/common/systemd-network.xml@ 02e8ee7

clfs-3.0.0-systemd systemd
Last change on this file since 02e8ee7 was 0131d1b, checked in by Chris Staub <chris@…>, 11 years ago

More consistent capitalization for systemd

  • Property mode set to 100644
File size: 2.9 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
13 <sect2 role="static">
14 <title>Creating the Static Network Interface Configuration Files</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 that the <envar>Name</envar> variable in <filename>/etc/systemd/network</filename> contain the correct Network Card Interface name (e.g.
20 <envar>Name=enp2s1</envar> or
[0131d1b]21 <envar>Name=eth0</envar>) or systemd will fail to bring
[31e77c0]22 up your network interface.</para></note>
23
24 <para><command>systemd-networkd</command> uses <filename>/etc/system/network</filename> for configuration files. Refer to systemd.network(5) and systemd.netdev(5). Configure a network interface with a config file. Adjust Name= as required:</para>
25
26<screen><userinput>cd /etc/systemd/network &amp;&amp;
27cat &gt; static.network &lt;&lt; "EOF"
28[Match]
29Name=enp2s0
30
31[Network]
32Address=192.168.1.1/24
33Gateway=192.168.1.2
34EOF</userinput></screen>
35
36 <para os="var-ob">The values of these variables must be changed in every
37 file to match the proper setup.</para>
38
39 <para os="var-i">The <envar>Name</envar> variable defines the interface
40 name, for example, eth0. It is required for all network device configuration
41 files.</para>
42
43 <para>The <envar>Gateway</envar> variable should contain the default
44 gateway IP address, if one is present. If not, then comment out the
45 variable entirely.</para>
46
47 <para>For more information see the <command>systemd.netdev</command> man page.</para>
48
49 </sect2>
50
51 <sect2 role="dhcp">
52 <title>Connecting to a network with DHCP</title>
53
54 <para><command>systemd-networkd</command> uses <filename>/etc/systemd/network</filename> for configuration files. Refer to <filename>systemd.network(5)</filename> and <filename>systemd.netdev(5)</filename>. Configure a network interface with a config file. Adjust Name= as required:</para>
55
56<screen><userinput>cd /etc/systemd/network &amp;&amp;
57cat &gt; dhcp.network &lt;&lt; "EOF"
58[Match]
59Name=enp2s0
60
61[Network]
62DHCP=yes
63EOF</userinput></screen>
64
65 <para><command>systemd-networkd</command> will automatically configure <filename>/run/systemd/network/resolv.conf</filename> when using DHCP. If you did not manually create <filename>/etc/resolv.conf</filename>, create a symlink:</para>
66
67<screen><userinput>ln -sv /run/systemd/network/resolv.conf /etc</userinput></screen>
68
[2256e5a]69 <para>Continue to <xref linkend="chapter-bootable"/>.</para>
70
[31e77c0]71 </sect2>
72
73</sect1>
Note: See TracBrowser for help on using the repository browser.