Ubuntu: systemd-networkd daemon does not start the DHCP client



Question:

I have the appropriate network file with DHCP enabled.

$ cat /etc/systemd/network/20-dhcp.network   [Match]  Name=enp3*    [Network]  DHCP=ipv4    [DHCP]  UseDomains=true  

I have appropriate /etc/resolv.conf as well. I am not using systemd-resolvd daemon (and it may not have anything to do with it, because I did try using it, but did not help anyway). Any ideas why the DHCP client needs to be run manually to get it working?


Solution:1

From reading man systemd.network, it sounds like the .network files in /etc/systemd/network are controlled by systemd-networkd. If the files aren't being read, it could be that you aren't using this part of systemd.

For example, on a Ubuntu 16.04 desktop, I can see that systemd-networkd is not in use:

 systemctl status systemd-networkd  

● systemd-networkd.service - Network Service Loaded: loaded (/lib/systemd/system/systemd-networkd.service; disabled; vendor preset: enabled) Active: inactive (dead) Docs: man:systemd-networkd.service(8)

Instead, the NetworkManager service is running. So, a DHCP client would be configured through NetworkManager in that case, or NetworkManager needs to be stopped and disabled, and systemd-networkd needs to be started and enabled.


Solution:2

It turned out that I had two network files. I followed arch linux systemd-networkd documentation (https://wiki.archlinux.org/index.php/systemd-networkd#Wireless_adapter), and created one network file:

/etc/systemd/network/25-wireless.network  [Match]  Name=wlp2s0    [Network]  DHCP=ipv4  

And it is working.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »