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?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
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
<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b9cbd6d6cdf9cbd6d6cd">[email protected]</a>:~# 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
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0