0

I'm not seeing this question asked any where else that I've looked. Long story short, NetworkManager brings down eth0 1 minute and 1 second after every hour for the reason of 'connection-removed'. Most of the time, the connection comes back up--although it obviously disconnects everything--within that same second. In some few and far between cases, it does not recover and despite being set with a static IPv4 address, will not recover until the network service is restarted.

The server is a virtual machine running in KVM by a remote hosting provider and takes place precisely within the first second of the first minute every hour. This is a recently installed stock, minimal install of CentOS 7 (trying it out for the first time since CentOS 4) with only one additional application installed: Cockpit.

Here are the logs of that second:

journalctl

http://pastebin.com/sAGEEkrx

/var/log/cron

Feb  3 08:01:01 hyaena CROND[1094]: (root) CMD (run-parts /etc/cron.hourly)
Feb  3 08:01:01 hyaena run-parts(/etc/cron.hourly)[1094]: starting 0anacron
Feb  3 08:01:01 hyaena run-parts(/etc/cron.hourly)[1103]: finished 0anacron
Feb  3 08:01:01 hyaena run-parts(/etc/cron.hourly)[1094]: starting docker-cleanup
Feb  3 08:01:01 hyaena run-parts(/etc/cron.hourly)[1111]: finished docker-cleanup

/etc/cron.hourly

/0anacron

#!/bin/sh
# Check whether 0anacron was run today already
if test -r /var/spool/anacron/cron.daily; then
    day=`cat /var/spool/anacron/cron.daily`
fi
if [ `date +%Y%m%d` = "$day" ]; then
    exit 0;
fi

# Do not run jobs when on battery power
if test -x /usr/bin/on_ac_power; then
    /usr/bin/on_ac_power >/dev/null 2>&1
    if test $? -eq 1; then
    exit 0
    fi
fi
/usr/sbin/anacron -s

/docker-cleanup

#!/bin/bash

# Do nothing if neither docker nor docker-latest service is running
if ! systemctl --quiet is-active docker-latest && ! systemctl --quiet is-active docker; then
  exit 0
fi

# If there are no dead containers, exit.
DEAD_CONTAINERS=`docker ps -aq -f status=dead`

[ -z "$DEAD_CONTAINERS" ] && exit 0

# Try to cleanup dead containers
docker rm $DEAD_CONTAINERS
0

I wiped out the ifcfg files created by the CentOS installation media and used nmcli to create them from scratch. The old an new ifcfg files ended up being almost exactly the same. The differences are the order of the content, a new UID automatically generated, and I gave the connection a custom name of ext0 rather than being generated. And now it works perfectly fine.

So, in the end, who the hell knows. The flip desk emoticon would be useful here.

From what I've found, NetworkManager fully separates the device and the connection. In my case, every hour for some reason NetworkManager determined that eth0 was not configured despite it being so and would generate a temporary new connection which would then fail. Therefore, dropping the current connection entirely, failing the temporary one, and repeat.

Perhaps either of those two items are references elsewhere that I'm not aware of, therefore informing NetworkManager it is indeed in use and controlled by NetworkManager (NM_CONTROLLED=yes did nothing, for the record).

In the end, this is my ifcfg-ext0:

TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=yes
NAME=ext0 # Arbitrary name given
UUID=<UUID generated by NetworkManager>
DEVICE=eth0
ONBOOT=yes
ZONE=drop
DNS1=<IPv4 DNS server>
DNS2=<IPv4 DNS server>
IPADDR=<static IPv4address>
PREFIX=24
GATEWAY=<static IPv4 gateway>
DOMAIN=<my domain>
DNS3=<IPv6 DNS server>
DNS4=<IPv6 DNS server>
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_PRIVACY=no

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.