[CentOS] From Networkmanager to self managed configuration files

Wed Mar 8 14:54:15 UTC 2017
Jonathan Billings <billings at negate.org>

On Wed, Mar 08, 2017 at 10:43:57AM +0000, Giles Coochey wrote:
> https://en.wikipedia.org/wiki/KISS_principle
> 
> I'm not flaming NetworkManager, I'm just stating that for many (perhaps
> most), it is over-engineered for a server orientated distribution. I can run
> with the script above on 30 server instances, and it doesn't, as yet, break
> any of the other features of Centos that I enjoy.

If you'd like a really simple solution that avoids NetworkManager, I
suggest using systemd-networkd (both systemd-networkd and
systemd-resolved packages required).  I've used it to set up a bridge
on my workstattion for use with libvirtd/kvm, and it is just as simple
a text file but future compatible.  Heck, it probably even works on
other distros that use systemd.

Here's a super-simple static configuration:

# cat /etc/systemd/network/10-static-eno1.network
[Match]
name=eno1

[Network]
Address=192.168.1.2
Gateway=192.168.1.1
DNS=192.168.1.1

You need to make sure that /etc/resolv.conf is a symlink
/run/systemd/resolve/resolv.conf if you want the systemd-resolved
service to manage it.  Just disable NetworkManager and network
services and enable the systemd-networkd and systemd-resolved
services.

Honestly, I've found systemd-networkd very useful for the more complex
networking on my workstation (bridged VMs to external network) but its
also useful for my tiny VMs that don't need extra daemons running.

-- 
Jonathan Billings <billings at negate.org>