- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
BOOK/network/common/systemd-network.xml
r6d3523f r31e77c0 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 21 <envar>Name=eth0</envar>) or Systemd will fail to bring 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 && 27 cat > static.network << "EOF" 28 [Match] 29 Name=enp2s0 30 31 [Network] 32 Address=192.168.1.1/24 33 Gateway=192.168.1.2 34 EOF</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 && 57 cat > dhcp.network << "EOF" 58 [Match] 59 Name=enp2s0 60 61 [Network] 62 DHCP=yes 63 EOF</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 69 </sect2> 70 71 </sect1>
Note:
See TracChangeset
for help on using the changeset viewer.