[CentOS] From Networkmanager to self managed configuration files

Wed Mar 8 15:24:22 UTC 2017
James Hogarth <james.hogarth at gmail.com>

On 8 March 2017 at 15:00, Giles Coochey <giles at coochey.net> wrote:
>
>
> On 08/03/17 14:54, Jonathan Billings wrote:
>>
>>
>> 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.
>>
> That's interesting, I'll snapshot and perhaps take that tangent on the next
> build and see how it goes.
>

Incidentally as far back as NM 1.0 (part of the 7.1 milestone but not
part of the original 7.0 GA) it has supported a
'configure-and-quit=yes' option to just get the configuration right,
emit the events etc needed to tell services/system network is
configured and then get out of the way and not leave any running
daemon:

https://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/NEWS?h=1.0.0

I'll give that a test as part of my upcoming article looking at how NM
has changed since the original 7.0 release.