
dhclient Command Not Found on Oracle Linux 8/9? Here’s the Fix
If you’re a system administrator or developer working with recent versions of Oracle Linux, such as Oracle Linux 8 or 9, you may have encountered a puzzling issue: you type the dhclient
command to manage your network’s DHCP leases, only to be met with a “command not found” error. This can be frustrating, especially when you rely on this tool for network scripting or troubleshooting.
The reason for this is simple: dhclient
is no longer installed by default on modern enterprise Linux distributions, including Oracle Linux. These systems have fully transitioned to using NetworkManager as the primary tool for handling network configurations. While NetworkManager is powerful and efficient for most use cases, there are still valid reasons to need the classic dhclient
utility.
This guide will walk you through the simple steps to install dhclient
on your Oracle Linux system and get you back up and running.
Why is dhclient Missing? A Shift in Network Management
The dhclient
command is part of the dhcp-client
package. In older Linux versions, this package was a core component of the networking stack. However, with the standardization of NetworkManager, which handles DHCP operations internally, the standalone dhcp-client
package was deemed redundant for a default installation.
While NetworkManager is the recommended and fully supported method for managing network interfaces, dhclient
remains a valuable tool for:
- Manual IP address renewal in scripts.
- Advanced network troubleshooting and diagnostics.
- Environments with specific legacy requirements that interface directly with
dhclient
.
Fortunately, the package is still available in the official Oracle Linux repositories; it just needs to be installed manually.
Step-by-Step Guide to Installing dhclient on Oracle Linux
Follow these straightforward steps to restore the dhclient
command to your system.
Step 1: Verify That dhclient Is Not Installed
First, confirm the command is truly missing. You can do this with the command -v
or which
command.
command -v dhclient
If the command is not installed, this will produce no output. Attempting to run it directly will result in the familiar error message:
dhclient
-bash: dhclient: command not found
This confirms that you need to install the package that provides the utility.
Step 2: Install the dhcp-client Package
The dhclient
executable is contained within the dhcp-client
package. You can install it using the dnf
package manager (the standard on Oracle Linux 8 and 9). You will need superuser privileges to do this.
Run the following command:
sudo dnf install dhcp-client
The package manager will resolve dependencies and ask for confirmation. Press y
and hit Enter to proceed. The installation process is typically very quick.
(Note: If you are on an older system or prefer using yum
, the command sudo yum install dhcp-client
will also work.)
Step 3: Confirm the Installation Was Successful
Once the installation is complete, you should verify that the dhclient
command is now available. Run the verification command again:
which dhclient
This time, the command should return the path to the executable, confirming it is installed and in your system’s PATH.
The expected output should be: /usr/sbin/dhclient
You can also use the rpm
command to see exactly which package owns the file:
rpm -qf /usr/sbin/dhclient
This will correctly report that the file belongs to the dhcp-client
package, confirming everything is set up properly.
Practical Usage and Important Security Advice
With dhclient
installed, you can now use it to manage DHCP leases manually. For example, to release the current IP address for a specific interface (e.g., eth0
), you would use:
sudo dhclient -r eth0
To request a new IP address for that same interface, you would run:
sudo dhclient eth0
A Crucial Security Tip
While dhclient
is a useful utility, it’s important to use it judiciously. For day-to-day network management, you should always favor the default NetworkManager tools (nmcli
, nmtui
).
Running dhclient
manually can expose your system to security risks, such as DHCP spoofing, where a malicious actor on the network could potentially pose as a legitimate DHCP server. NetworkManager has built-in safeguards and integrates better with the modern Linux ecosystem, including firewall and systemd services.
Only use dhclient
directly when you have a specific need for manual intervention or scripting. For all automated and general-purpose network configuration, let NetworkManager handle the job.
Source: https://kifarunix.com/install-dhclient-command-on-oracle-linux/