ifup / ifdown Equivalent for systemd
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
RE: ifup / ifdown Equivalent for systemd - Added by Ben Atkinson over 4 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 (126.96.36.199): 56 data bytes
64 bytes from 188.8.131.52: seq=0 ttl=51 time=22.743 ms
64 bytes from 184.108.40.206: seq=1 ttl=51 time=22.460 ms
64 bytes from 220.127.116.11: seq=2 ttl=51 time=22.633 ms
64 bytes from 18.104.22.168: 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 4 years ago
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.