[systemd-devel] "networkctl reload" complains about "Macvlan" unknown section

Maxim Blinov maxim.a.blinov at gmail.com
Tue Aug 16 21:34:27 UTC 2022


Hi all,

I just wanted to give an update about how I solved this issue:

Firstly, the "error" I was seeing was actually stale and completely
unrelated. To explain, here's what happened:
1). I created my `.netdev` file, with a "[Macvlan]" section.
2). I ran `$ networkctl reload`
3). I ran `$ networkctl status`, which reported the error concerning
the unknown "[Macvlan]" section.
4). I edited the `.netdev` file to now state a "[MACVLAN]" section instead
5). I ran `$ networkctl reload`
6). I ran `$ networkctl status`, which _still_ reported the errors
concerning the unknown "[Macvlan]" section - But this was from the
_previous_ invocation, not _this_ invocation! Infact, the current
invocation did not generate any errors, which is why the log didn't
change at all. However, I was operating under the assumption that
every time you run `$ networkctl reload`, the log in `$ networkctl
status` would always get refreshed, so I was thinking that the
"unknown section [Macvlan]" error was referring to the current state
of the file (which it was not - it was an old error message, from a
previous invocation.)

So that's the first thing. THe second issue, which I only just solved
now, was that simply adding a `.netdev` and `.network` file for a
macvlan interface is not enough. You _also_ have to go to the
`.network` file of the interface that will be acting as the parent
interface of the macvlan interface, and add a statement  under its
[Network] section with the line
`MACVLAN=<name-of-your-macvlan-interface`.

To illustrate, I chose my macvlan ethernet interface to be called
`veth0`, and I want the parent interface to be `enp0s3`. Hence, I go
to the .network file that corresponds to the `enp0s3` interface, and
fill it in as follows:

```
[Match]
Name=enp0s3

[Network]
DHCP=ipv4
MACVLAN=veth0
LinkLocalAddressing=ipv6

[DHCP]
RouteMetric=100
UseMTU=true
```

Now, everything works.

Maxim

On Tue, 16 Aug 2022 at 11:39, Maxim Blinov <maxim.a.blinov at gmail.com> wrote:
>
> Hi all,
>
> I am using Ubuntu 20.04 server, and `networkctl --version` returns:
>
> systemd 245 (245.4-4ubuntu3.17)
> +PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP
> +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS
> +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid
>
> ## The problem
>
> When running `networkctl reload`, I get the following error reported
> by `networkctl status`:
> ```
> Aug 15 21:28:02 vm-server systemd-networkd[587]:
> /etc/systemd/network/10-veth0.netdev:5: Unknown section 'Macvlan'.
> Ignoring.
> Aug 15 21:28:02 vm-server systemd-networkd[587]:
> /etc/systemd/network/10-veth0.netdev:5: Unknown section 'Macvlan'.
> Ignoring.
> ```
>
> I'm trying to configure my server networking statically by using
> .netdev and .network files, following the manual pages referenced by
> [1] and [2].
>
> I would like to add a macvlan device under my main ethernet interface,
> and have added two files at this location:
>
> /etc/systemd/network/10-veth0.netdev
> /etc/systemd/network/10-veth0.network
>
> The contents of `10-veth0.netdev` is as follows:
> ```
> [NetDev]
> Name=veth0
> Kind=macvlan
>
> [MACVLAN]
> Mode=bridge
> ```
>
> The contents of `10-veth0.network` is as follows:
> ```
> [Match]
> Name=veth0
>
> [Network]
> DHCP=ipv4
> LinkLocalAddressing=ipv6
>
> [DHCP]
> RouteMetric=110
> UseMTU=true
> ```
>
> I'm probably being stupid, but I can't see where the issue is. Could
> someone please point me in the right direction?
>
> Maxim
>
> [1]: https://man.archlinux.org/man/systemd.netdev.5.en
> [2]: https://man.archlinux.org/man/systemd.network.5.en


More information about the systemd-devel mailing list