dhclient
is the Dynamic Host Configuration Protocol (DHCP) Client one would use to allow a client to connect to a DHCP server.
$ sudo nano /etc/rc.local
#!/bin/bash
dhclient
exit 0
$ sudo chmod 755 /etc/rc.local
$ sudo systemctl enable rc-local
$ sudo systemctl restart rc-local
$ sudo systemctl status rc-local
Making a rc.local file to run dhclient is not the correct solution. You will most likely end-up with multiple network renders doing DHCP client operations and cause problems with future upgrades.
Ubuntu switched to
netplan
in release 17.10 (see Migrating to Netplan) which by default usesYou can change the network "renderer" (networkd or NetworkManager) for any/all interfaces in the yaml config files under /etc/netplan (see netplan reference). You can also configure DHCP client options in netplan, but @p1-ra provided a better approach for cases using systemd-networkd which gives you more control (see Network Configuration for systemd.networkd)
In cases where NetworkManager is running, there is no need to abandon it, it's actually pretty good these days (unlike the old days when the first thing we did on a new install was to disable it) and it does DHCP client by default! However, OOTB it runs its own
internal
DHCP client which ignores /etc/dhcp/dhclient.conf and any hooks you may have added.If you want NetworkManager to run
dhclient
instead, just edit /etc/NetworkManager/NetworkManager.conf and add a new line for "dhcp=dhclient" under the main section.(see NetworkManager.conf for details and other options)
When NetworkManager is restarted with
systemctl restart NetworkManager
it merges /etc/dhcp/dhclient.conf with its own interface specific configuration under /var/lib/NetworkManager. You can see dhclient running and the locations for conf, leases, etc. in your process list e.g.(wlp58s0 in this example is my wifi interface)