3

Systemd offers the ability to manage the network by itself without additional tools such as netctl or NetworkManager. I am running debian 8 and i need to configure my network using systemd-networkd

What are the requirement to manage the networks under debian jessie through systemd-networkd? And how to enable services and network?

2
  • 2
    There is an extensive helpful wiki page in the ArchLinux wiki on the topic. It boils down to creating .network units in /etc/systemd/network/ and related technologies. For a basic network, you just need systemd-networkd and systemd-resolved for DNS. Wireless gets more complicated but is also possible with wpa_supplicant. To enable/disable: systemctl.
    – kba
    Commented Feb 17, 2016 at 14:14
  • 1
    Yes, it can, systemd is distro-independent (mostly). Of course you'd need different packages installed with apt-get and so on. But the configuration of systemd works the same in Archlinux, Debian, Fedora ...
    – kba
    Commented Feb 17, 2016 at 14:21

1 Answer 1

4

To connect to network through systemd-networkd you need to create some configuration files:

For wireless connections create wireless.network file with the following content:

nano /etc/systemd/wireless.network:

Match]
Name=wlan0

[Network]
DHCP=ipv4
DNS=8.8.8.8
DNS=8.8.4.4

[DHCP]
RouteMetric=20

For wired connections create wired.network file with the following content:

nano /etc/systemd/network/wired.network :

[Match]
Name=eth0

[Network]
DHCP=ipv4
DNS=8.8.8.8
DNS=8.8.4.4

[DHCP]
RouteMetric=10

For wireless connections, create a configuration file for your access point by using:

sudo -i
echo "ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=sudo" > /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
wpa_passphrase SSID password >> /etc/wpa_supplicant/wpa_supplicant-wlan0.conf

exit

disable network-manager:

sudo systemctl disable NetworkManager

Enable systemd-networkd :

sudo systemctl enable systemd-networkd

Enable the systemd-resolved :

sudo systemctl enable systemd-resolved
sudo systemctl start systemd-resolved

delete or rename resolv.conf then create a symlink to /etc/resolv.conf:

sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf

Restart the srvice:

systemctl restart systemd-networkd

Reboot

Type the following command

root@root:~# sudo systemctl status systemd-networkd 

The output:

● systemd-networkd.service - Network Service
Loaded: loaded (/lib/systemd/system/systemd-networkd.service; enabled)
Active: active (running) since lun. 2016-02-29 13:42:53 CET; 35min ago
 Docs: man:systemd-networkd.service(8)
Main PID: 531 (systemd-network)
 Status: "Processing requests..."
 CGroup: /system.slice/systemd-networkd.service
         └─531 /lib/systemd/systemd-networkd

févr. 29 13:42:53 debian systemd-networkd[531]: wlan0           : gained carrier
févr. 29 13:42:53 debian systemd-networkd[531]: lo              : gained carrier

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .