C7 Systemd And Network Configuration

Home » CentOS » C7 Systemd And Network Configuration
CentOS 7 Comments

Hi all,

I used to manage network through /etc/sysconfig/network-scripts/ifcfg-*
Most of my use case are vlans (ie: eth0.1) an aliases (ie: eth1:3)
My context in headless VMs (no DE, no Xorg, no GUI)

With CentOS7 and systemd: is it still managed with
/etc/sysconfig/network-scripts/ifcfg-* ?

For the mount component, I found that systemd kind of “sources”
/etc/fstab and converts it to something for it (so, no worry about fstab), but how about networking?

Thanks.

7 thoughts on - C7 Systemd And Network Configuration

  • Networking isn’t really controlled by systemd but by NetworkManager. I
    usually just yum remove NetworkManager* and then everything works just as it did in CentOS 6.

    Regards,
    Dennis

  • Note: NetworkManager is in CentOS6 too, and is part of the default workstation install. The NM in CentOS7 is a bit more polished than the NM in CentOS6, but it is configured in the same way, using files in /etc/sysconfig/network-scripts/ (using the ifcfg-rh NetworkManager plugin). In both cases, you can remove NM and use the ‘network’
    service instead.

  • You can disable NetworkManager for now in CentOS-7 and use the network service .. but in reality I am not sure how long that is going to be
    100% true. In fact, things like dnsmsq and even libvirt/qemu are becoming much harder to configure to work via the network service and are pre-configured to work with NetworkManager. (Don’t yell at me, not my decision :D)

    I have decided it is likely better to bite the bullet and learn how to use and configure Network Manager if you are going to do anything other than very simple things with your network .. at least on CentOS-7 or higher (ie, Fedora > 18, etc.).

    Again, one CAN still use the network service .. but most documentation available now assumes instead that Network Manager is being used.

    Thanks, Johnny Hughes

  • A lot of the problems I had with NetworkManager was that even though NM started fairly early in C6, often the network wouldn’t be up by the time later-starting services started (since NM didn’t block on network), and anything that needs to do a DNS resolution or some sort of initial sync on start would fail. Even worse, if you had both the
    ‘network’ and ‘NetworkManager’ services started, the network would be brought up with the ‘network’ service, then NM would start, and sometime mid-boot the network would drop then be re-started as NM took over. So it’d be a form of russian roulette as to which service would not have a network during boot.

    In C7, services have dependencies on the network-online.target, which fixes a lot of the issues I mentioned above. One of the nicer things of having actual service dependencies.

  • systemd-networkd is becoming increasingly capable and popular though so NetworkManager might not actually stay around for too long.

    Regards,
    Dennis

  • Saying the same differently: systemd gradually takes over everything ;-(

    Valeri

    ++++++++++++++++++++++++++++++++++++++++
    Valeri Galtsev Sr System Administrator Department of Astronomy and Astrophysics Kavli Institute for Cosmological Physics University of Chicago Phone: 773-702-4247
    ++++++++++++++++++++++++++++++++++++++++

  • This is the information I needed: ” … using files in
    /etc/sysconfig/network-scripts/…”

    Looking furter I found https://access.redhat.com/discussions/644133
    where I can read:

    What is the preferred method for changing an interface’s setttings?
    Previously, editing /etc/sysconfig/network-scripts/ifcfg-xxx then
    “service network restart” did the trick.

    On RHEL 7, after editing the ifcfg file, nothing short of a reboot seems to get it to use that config. I’ve tried “service network restart” I’ve tried “systemctl restart network.service” as well as “systemctl stop network.service” followed by “systemctl start network.service” Those don’t seem to actually do anything. I need to reboot to get the new config to work.

    Then answered by Ryan Sawhill :

    A little late, but the command you’re missing (if you’re using NM) is:

    * |nmcli connection reload|

    Which can be shortened to:

    * |nmcli c r|

    That will reload the ifcfg files after manual edits. From there if you want to re-up a connection whose file you changed, you need to manually do so with another |nmcli connection| command, e.g.:

    * |nmcli c up “System eno1″|

    Note that you don’t actually need to take an interface down first, like in the old days (e.g., with |ifdown eth0| followed by |ifup eth0|).

    Thanks for all.