Ubuntu – Unable to ping 18.04 desktop unless this machine first pings the client, when using networkd instead of network-manager

18.04netplannetwork-managernetworkingsystemd-networkd

I'm trying to set up networking with netplan and networkd as renderer on an 18.04 machine. It runs the desktop distribution because it's connected to my TV and used for multimedia, but I'll call it a server because it's easier to explain and will run dns & dhcp servers once I get the network up and running properly.

I noticed that when I configure the network via netplan, I can't ping the server from my Windows 10 clients (not tested on other OS') unless I ping the said client from the server first. On the clients, I get:

Reply from [CLIENT'S OWN IP]: Destination host unreachable.

But after pinging from the server first, the client has an ARP entry and all is well.

I've searched solutions for far too much time and confirmed that:

  • Subnets are correct – everything is DHCP from my router at the moment to rule this out
  • There is no MAC or IP address conflict
  • Power management is off on the interface
  • It doesn't seem like a driver issue given the only change is network-manager vs networkd
  • Firewalls are OK
  • Router is OK

At the moment the machine is connected via WiFi and to change the configuration away from network-manager I just renamed /etc/netplan/01-network-manager-all.yaml so it's not used, and created /etc/netplan/config.yaml as follows:

network:
    version: 2
    renderer: networkd
    wifis:
        wlp3s0:
            dhcp4: yes
            dhcp6: no
            access-points:
                "MyAP":
                    password: "MyPassword"

/etc/network/interfaces is just iface lo inet loopback

I read that disabling of network-manager wasn't required as it will just report that interfaces configured manually are unmanaged, so the above change is all I have made.

Using Wireshark I confirmed that when configured with netplan, the server doesn't receive ARP packets when I ping from a client with no ARP entry for the server IP. It does receive them when network-manager is taking care of the interface; first one to tell the router, then one to tell the client.

Thanks in advance for any help!

EDIT 1: additional information:

/etc/NetworkManager/system-connections/[NETWORKNAME] is:

[connection]
id=XXXX
uuid=992e3be7-dea0-49b7-a474-60832236b8bf
type=wifi
permissions=
timestamp=1530425561

[wifi]
mac-address=C4:E9:84:E1:61:FF
mac-address-blacklist=
mode=infrastructure
seen-bssids=50:C7:BF:38:01:91;
ssid=XXXX

[wifi-security]
key-mgmt=wpa-psk
psk=XXXX

[ipv4]
dns=8.8.8.8;8.8.4.4;
dns-search=
method=auto

[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=auto

The netplan-generated networkd configuration at /run/systemd/network/10-netplan-wlp3s0.network is:

[Match]
Name=wlp3s0

[Network]
DHCP=ipv4

[DHCP]
UseMTU=true
RouteMetric=600

EDIT 2: a closer look at Wireshark shows that when using systemd-networkd configuration, there is no IGMP activity, no MDNS activity other than where the server is the source, and the only ARP activity is between gateway and server, until the server attempts to ping a client. Once the server attempts to ping the client, the first ARP is 'who has Client IP tell server IP', then immediately following, 'who has server IP, tell client IP', and finally the ping goes out to the client. From here on, the client can ping the server.

The whole time, the server can access any network services, internal and external.

Best Answer

After realising I was affected by this bug and correcting for it, I found that networkctl showed the wireless interface as 'configuring' status.

I then found that NetworkManager was running, and on stopping it via sudo systemctl stop NetworkManager, followed by sudo systemctl restart systemd-networkd, and finally deleting the ARP entry on my Windows client before pinging again, everything worked. I did sudo systemctl disable NetworkManager and restarted to make sure the solution persisted and it did not...

A kind soul in the Ubuntu IRC channel guided me to do:

sudo systemctl mask network-manager.service
sudo systemctl mask NetworkManager-dispatcher.service
sudo systemctl mask NetworkManager-wait-online.service

This resolved the issue and networkctl now shows the status of 'configured'. It appears network-manager and systemd-networkd were fighting over configuration of the wireless interface. I suspect that my understanding that network-manager would leave it alone would be correct if there was no configuration in /etc/NetworkManager/system-connections/ but haven't tested this theory - I'm just relieved it's resolved.

Related Question