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
Ubuntu 18.04 (server) is using
systemd-networkd
as default, if the service is enablesystemctl status systemd-networkd
, the proper way to enable dhcp is to use the systemd network configuration files (/etc/systemd/network/*)https://www.freedesktop.org/software/systemd/man/systemd.network.html
As exemple, the following configuration file will enable DHCP to any nic that have a name that's matching
enp*