Project

General

Profile

ifup / ifdown Equivalent for systemd

Added by Ben Atkinson over 8 years ago

Hello,

In the new ALPHA Release 2016.01 filesytem, what is the "systemd way" of performing ifdown eth0 and ifup eth0?

- ifup and ifdown expect an /etc/network/interfaces file -- which doesn't exist in the systemd configuration.
- I've tried restart, stop and start variations of "systemctl restart systemd-networkd", but that hasn't worked.
- The networking.service shows:

$ ls -la /etc/systemd/system/networking.service
lrwxrwxrwx 1 root root 9 Jan 1 1970 /etc/systemd/system/networking.service -> /dev/null

Regards,

Ben


Replies (2)

RE: ifup / ifdown Equivalent for systemd - Added by Ben Atkinson over 8 years ago

Well, I found something that works, but it doesn't seem very "clean" or symmetrical. I found the following to bring down eth0:

$ ip link set dev eth0 down

This succeeds in shutting down the eth0 device. However when it's time to bring it back up, I tried:

$ ip link set dev eth0 up

It works in re-establishing the connection to my network, but it doesn't fully restore everything that's in the /etc/systemd/network/eth0.network file. Namely, the specified DNS doesn't get restored. To restore the DNS, I have to:

$ systemctl restart systemd-networkd

One would think that "systemctl stop systemd-networkd" would be effective in shutting down eth0, but that appears to have no effect on the network connection:

$ systemctl stop systemd-networkd
$ ping -c4 www.google.com
PING www.google.com (216.58.216.196): 56 data bytes
64 bytes from 216.58.216.196: seq=0 ttl=51 time=22.743 ms
64 bytes from 216.58.216.196: seq=1 ttl=51 time=22.460 ms
64 bytes from 216.58.216.196: seq=2 ttl=51 time=22.633 ms
64 bytes from 216.58.216.196: seq=3 ttl=51 time=22.478 ms
--- www.google.com ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 22.460/22.578/22.743 ms
$

Am I missing something? I'm kind of surprised "systemctl stop systemd-networkd" seems to have no effect.

RE: ifup / ifdown Equivalent for systemd - Added by Bob Duke over 8 years ago

Ben,

Your concern is valid and I don't have a direct answer now. The ip command is the correct one to use to configure the network interfaces, but we haven't explored all of the new ways systemd is integrated with the rest of the system.

We are still testing our Yocto builds (which is why we still have them marked Alpha), so the anomaly you described may be due to a misconfiguration ormissing package.

    (1-2/2)
    Go to top
    Add picture from clipboard (Maximum size: 1 GB)