On 10/09/17 23:25, Jason A. Donenfeld wrote:
I just wrote the attached script, which will tell you all the
processes that have an open netlink socket...

There's a bit too much fluff in there on a desktop system, but I
imagine the pi might help boil it down to a few candidates. Probably
we'll determine it's an ifplugd/ifupdown.action thing, but we'll see.

Many thanks again for such great work. Here's the output of the netlistenerwho.sh program. It's awash with potential culprits!

  PID TTY      STAT   TIME COMMAND
    1 ?        Ss     2:35 /sbin/init
  128 ?        Ss     0:01 /lib/systemd/systemd-udevd
  770 ?        Ss     2:24 /sbin/dhcpcd -q -b
  783 ?        Ss     0:15 avahi-daemon: running [janus.local]
  840 ?        Ss     0:32 /lib/systemd/systemd-logind
  896 ?        Ss    10:19 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 107:112
  906 ?        S      0:02 /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsmasq -r /run/dnsmasq/resolv.conf -7 /etc/dnsmasq.
 1204 ?        Ss     0:00 /lib/systemd/systemd --user
18942 ?        Ss     0:00 /lib/systemd/systemd --user

I also made a great mistake earlier: the problematic system is the version of Raspbian based on begin 8 and not 9. Debian 9 works fine!

I've tweaked the /etc/network/interfaces file to have the line “iface wg0 inet manual” in it so we shouldn't get DHCP running or anything…

I tried the nlmon trick but I got the response “RTNETLINK answers: Operation not supported” which isn't too helpful.

After some more playing I've found that running the wg-quick script's commands by hand works. But then, I'm manually entering them and that affects timing.

I note you perform the ”ip link set wg0 up” after the “ip address add 192.168.2.3/32 dev wg0” and “ip link set mtu 1420 dev wg0”. However, the act of creating the interface with the “ip link add wg0 type wireguard” seems to trigger the ip up automatically. The log files give:

Sep 10 23:57:51 janus kernel: wireguard: WireGuard 0.0.20170907 loaded. See www.wireguard.com for information.
Sep 10 23:57:51 janus kernel: wireguard: Copyright (C) 2015-2017 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
Sep 10 23:57:51 janus ifplugd(wg0)[14109]: ifplugd 0.28 initializing.
Sep 10 23:57:51 janus ifplugd(wg0)[14109]: Using interface wg0/00:00:00:00:00:00
Sep 10 23:57:51 janus ifplugd(wg0)[14109]: Using detection mode: IFF_RUNNING
Sep 10 23:57:51 janus ifplugd(wg0)[14109]: Initialization complete, link beat detected.
Sep 10 23:57:52 janus ifplugd(wg0)[14109]: Executing '/etc/ifplugd/ifplugd.action wg0 up'.
Sep 10 23:57:52 janus ifplugd(wg0)[14109]: client: /sbin/ifup: interface wg0 already configured
Sep 10 23:57:52 janus ifplugd(wg0)[14109]: Program executed successfully.

Which could well be interesting. I manually ran ifdown then ifup on wg0 and it didn't lose its IP address.

Most perplexing!

Jim.