Skip to content

systemd-networkd doesn't wait IPv6 address under net.ipv6.conf.all.forwarding=1 #7592

@LetzteInstanz

Description

@LetzteInstanz

Submission type

  • Bug report

systemd version the issue has been seen with

235

Used distribution

Arch Linux

In case of bug report: Expected behaviour you didn't see

systemd-networkd-wait-online waits assigned by RA IPv6 address:

Dec 07 06:28:30 server systemd-networkd-wait-online[379]: ignoring: eth1
Dec 07 06:28:30 server systemd-networkd-wait-online[379]: ignoring: lo
Dec 07 06:28:30 server systemd[1]: Started Wait for Network to be Configured on eth0.
Dec 07 06:28:30 server systemd[1]: Started OpenSSH Daemon.
Dec 07 06:28:30 server systemd[1]: Started Apache Web Server.
Dec 07 06:28:30 server systemd[1]: Reached target Network is Online.
Dec 07 06:28:30 server systemd[1]: Starting OpenVPN service for server...
Dec 07 06:28:31 server sshd[408]: Server listening on 2dc0:a17b:7415:0:21b:21ff:fe63:2216 port 50000.
Dec 07 06:28:31 server sshd[408]: Server listening on 2a00:1838:aaaa:2037:7285:c2ff:fe25:bc62 port 50000.
Dec 07 06:28:31 server sshd[408]: Server listening on 192.168.153.1 port 50000.
Dec 07 06:28:31 server sshd[408]: Server listening on 94.242.17.243 port 50000.

In case of bug report: Unexpected behaviour you saw

systemd-networkd-wait-online doesn't wait assigned by RA IPv6 address:

Dec 05 06:40:56 server systemd-networkd[377]: eth0: Configured
Dec 05 06:40:56 server systemd-networkd-wait-online[378]: ignoring: eth1
Dec 05 06:40:56 server systemd-networkd-wait-online[378]: ignoring: lo
Dec 05 06:40:56 server systemd[1]: Started Wait for Network to be Configured on eth0.
Dec 05 06:40:56 server systemd[1]: Reached target Network is Online.
Dec 05 06:40:56 server systemd[1]: Starting OpenVPN service for server...
Dec 05 06:40:56 server systemd[1]: Started Apache Web Server.
Dec 05 06:40:56 server systemd[1]: Started OpenSSH Daemon.
Dec 05 06:40:56 server sshd[409]: Server listening on 2dc0:a17b:7415:0:21b:21ff:fe63:2216 port 50000.
Dec 05 06:40:56 server sshd[409]: error: Bind to port 50000 on 2a00:1838:aaaa:2037:7285:c2ff:fe25:bc62 failed: Cannot assign requested address.
Dec 05 06:40:56 server sshd[409]: Server listening on 192.168.153.1 port 50000.
Dec 05 06:40:56 server sshd[409]: Server listening on 94.242.17.243 port 50000.

In case of bug report: Steps to reproduce the problem

  1. Create the unit systemd-networkd-wait-online@.service for a network interface:
[root@server ~]# cat /etc/systemd/system/systemd-networkd-wait-online@.service

[Unit]
Description=Wait for Network to be Configured on %I
Documentation=man:systemd-networkd-wait-online.service(8)
DefaultDependencies=no
Conflicts=shutdown.target
Requires=systemd-networkd.service
After=systemd-networkd.service
Before=network-online.target shutdown.target

[Service]
Type=oneshot
ExecStart=/usr/lib/systemd/systemd-networkd-wait-online -i %I
RemainAfterExit=yes

[Install]
WantedBy=network-online.target
  1. Enable it for the interface:
    systemctl enable systemd-networkd-wait-online@eth0

  2. Add the dependency systemd-networkd-wait-online@eth0.service to, for example, sshd:

[root@server ~]# cat /etc/systemd/system/sshd.service.d/after_network-online_on_eth0.conf
[Unit]
Wants=systemd-networkd-wait-online@eth0.service
After=systemd-networkd-wait-online@eth0.service
  1. Configure core:
[root@server ~]# cat /etc/sysctl.d/10-sysctl.conf
net.ipv4.ip_forward=1
net.ipv4.conf.all.force_igmp_version=2

net.ipv6.conf.all.forwarding=1
  1. Configure the interface:
[root@server ~]# cat /etc/systend/network/10-eth0.network
[Match]
Name=eth0

[Network]
Description=WAN interface
DHCP=yes
DNS=127.0.0.1
DNS=::1
Domains=example example.ru
IPv6AcceptRA=true

[DHCP]
UseDNS=false
UseNTP=false
UseMTU=true

[IPv6AcceptRA]
UseDNS=false
  1. Shutdown the computer, then power on it.

Additional information

If I append to /etc/sysctl.d/10-sysctl.conf:

net.ipv6.conf.all.accept_ra=1
net.ipv6.conf.default.accept_ra=1

that fixes the bug. However, accept_ra values are always the same after computer start:

[root@server ~]# sysctl net.ipv6.conf | grep ".accept_ra = "
net.ipv6.conf.all.accept_ra = 1
net.ipv6.conf.default.accept_ra = 1
net.ipv6.conf.lo.accept_ra = 1
net.ipv6.conf.eth0.accept_ra = 0
net.ipv6.conf.eth1.accept_ra = 0
net.ipv6.conf.tun0.accept_ra = 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions