aboutsummaryrefslogtreecommitdiff
path: root/etc/private/systemd-networkd/README
blob: 2db3904b91d3d34cebb577e1f2f845228eb3bced (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
This directory contains sample configuration files for setting up a bridge
(br0) and a permanent tap interface (tap0) using systemd's networkd network
manager. The tap interface can be used, for example, to run a virtual machine
that appears as a real machine on the host's Ethernet network.

Assumptions:

 - The host's Ethernet interface is eth0.
 - The host uses IPv4 DHCP for network configuration.

Note: only perform the following steps over a physical login to the host since
the configuration involves bringing the host's networking down.


1. Switch to systemd-networkd for network configuration.

Overall, the goal of this step is to disable the currently used network
manager and enable systemd-networkd. First check if systemd-networkd is
already used:

# systemctl status systemd-networkd

If it's enabled and running, skip to step 2. Otherwise, identify the currently
used network manager. The possible options depend on the distribution used so
consult the relevant documentation for details. One common option is the GNOME
network manager:

# systemctl status NetworkManager

If it's enabled and running, stop and disable:

# systemctl stop NetworkManager
# systemctl disable NetworkManager

For Debian-based distributions a common approach is to define the network
configuration in the /etc/network/interfaces file. To disable this method,
perform the following steps:

# systemctl stop networking
# mv /etc/network/interfaces /etc/network/interfaces.disabled

Once the current network manager is disabled, proceed to step 2.


2. Configure bridged networking using systemd-networkd.

Copy configuration files found in this directory to /etc/systemd/network/ (see
the comment at the beginning of each file for its purpose):

# cp *.netdev *.network /etc/systemd/network/

Note: if you are already using systemd-networkd, then you may already have
some configuration in /etc/systemd/network/. If the existing configuration
conflicts with this setup (for example, you already have a configuration
for eth0), then you will need to remove the relevant files.

Then adjust the following to match your setup:

  - Ethernet interface name if not eth0: 20-br0-eth0.network (both name and
    content)

  - Bridge MAC address: 10-br0.netdev

    Use your Ethernet interface's address as your bridge address, which
    you can obtain with:

    # ip link show eth0

  - Tap user/group: 10-tap0.netdev

    For example, set to the user/group that will run the VM that will use this
    tap interface.


3. Test and enable networking using systemd-networkd.

Once the configuration is complete, start/restart systemd-networkd and verify
networking is configured correctly.

# systemctl restart systemd-networkd
# systemctl status systemd-networkd
# ip addr show br0
# ip addr show tap0

Specifically, verify that:

  - The br0 MAC address is correct.

  - The br0 interface is assigned (via DHCP) an IP address and, if a fixed
    IP is used, it's what's expected.

  - Try to ping example.org to confirm the overall network (routing, DNS)
    is functional.

If everything looks good, enable systemd-networkd:

# systemctl enable systemd-networkd

You may also want to reboot the host and performs the above verifications
one more time.