Getty Images/iStockphoto


DHCP client configuration for Linux, Windows and macOS

Network and system admins can use command-line and GUI tools to configure DHCP clients in Linux, Windows and macOS. Here's a breakdown of which commands to use for each OS.

IP addresses serve as one of the primary ways of identifying nodes on the network. Administrators use these logical addresses to place devices on the network in specific segments, control access to the devices via routers and firewalls, and map network devices for client machines.

IP addresses are configured on client systems in two ways:

  1. Manual assignment. Referred to as static IP addresses, the addresses are manually configured on the device. No typographical errors or duplicates are acceptable.
  2. Automatic assignment. Referred to as dynamically assigned addresses, the IP settings are leased from a Dynamic Host Configuration Protocol (DHCP) server that holds a pool of available addresses.

Most end-user devices -- e.g., desktop computers, laptops, phones, tablets, etc. -- are configured as DHCP clients by default. This is an OS setting controlled by administrators. Client systems receive their IP address configurations dynamically because these devices are often transient on the network and frequently move between networks. Because they frequently move, they need different IP configurations depending on location. For example, a laptop in a business office needs one set of network configurations for internet connectivity. But, when that laptop is moved to a coffee shop or home network, it needs a different set of configurations.

While most OSes typically default to DHCP clients, administrators still need to know how to manipulate and troubleshoot these settings, whether on Windows, Linux or macOS.

Windows DHCP client configuration

It may be easiest to discover whether a Windows device is configured as a DHCP client by using the command line.

Windows command line

Open a command prompt or Windows PowerShell console, and then type ipconfig /all. Look for a line in the output that reads DHCP Enabled and a corresponding Yes or No value. Yes means the device is a DHCP client and receives its IP address configuration from a DHCP server. A little further below in the output are the DHCP server's IP address and info about when the lease was obtained and expired.

Administrators can refresh the DHCP lease by using two simple commands:

PS C:\> ipconfig /release
PS C:\> ipconfig /renew

The ipconfig /release command clears the current IP address configuration. The ipconfig /renew command causes the client to initiate the four-step DHCP lease generation process. This process provides the client with an updated IP address configuration, which likely includes the IP address, subnet mask, name resolution server and router information.

Windows GUI

For administrators who are more comfortable with the Windows GUI, various consoles display much of the same information. Admins can access network configuration information in Windows using several methods.

On Windows Server, launch Server Manager, select Local Computer and then select the IP address information in the Ethernet entry. Likely, this information reads IPv4 address assigned by DHCP.

The two available radio buttons configure the device as a DHCP client or a static IP address assignment.

Screenshot of Windows DHCP client configuration
Windows DHCP client configuration

Linux DHCP client configuration

Many common Linux distributions exist, so managing DHCP from the Linux GUI can vary a great deal. Managing Linux from the Bash shell is usually more consistent.

Recall that two common commands display IP address settings in Linux: ifconfig and ip. The ifconfig command is older, simpler and less comprehensive. Some distributions make both commands available, while, on other distros, only one or the other is present.

Type the following commands to display the current IP address settings for a given interface, such as enp0s3:

$ ifconfig enp0s3
$ ip addr show enp0s3
Screenshot of ifconfig and ip commands
The ifconfig and ip commands

To see whether a system is configured as a DHCP client, administrators can view the contents of network configuration files. The file name and path vary by distribution.


To view the DHCP configuration status on older Ubuntu Linux versions, display the contents of the /etc/network/interfaces file. If the system has more than one network interface card, you need to know which interface to look for.

Note that, in the above example, the lines auto eth0 and iface eth0 inet dhcp indicate the interface is a DHCP client. If an IP address was statically assigned, the lines would display an IP address, subnet mask and other network information.

To renew the configuration, type the following commands:

$ dhclient -r
$ dhclient

The first command uses the -r option, which releases the current configuration. The second command initiates the lease generation process.

Ubuntu 20.04 uses Network Manager to handle network configurations. Type the nmcli command to display the current interfaces. Note the interface ID, which will be something like enp0s3.

Refresh the DHCP configuration by downing and upping the interface:

$ nmcli con down enp0s3
$ nmcli con up enp0s3

Use the ip addr command to display the updated IP address settings.


Fedora Linux, another popular distribution, also relies on Network Manager for IP address settings. The nmcli commands and GUI interface are similar to those found on Ubuntu. Again, various distributions handle networking differently, so be sure to check the documentation for the specific distro and version.

Screenshot of nmcli subcommands
The nmcli subcommands

Linux GUI

Various Linux distributions have graphical tools for managing network settings. These tools enable administrators to configure IP address settings. The following example shows possible settings on an Ubuntu system.

Screenshot of GUI Network Manager interface on Ubuntu 20.04
The GUI Network Manager interface on Ubuntu 20.04

The settings in the GUI are basically the same as those found in the Windows GUI tools.

MacOS DHCP client configuration

The configuration of a macOS DHCP client is equally straightforward.

MacOS command line

The zsh is the default shell in macOS. To manipulate network settings from the command line, first, open the Terminal, and then use the following command:

% sudo ipconfig getpacket en0 dhcp

In this example, en0 represents the interface identity. Type the ifconfig command to identify the interfaces.

To configure an interface as a DHCP client, type the following command:

% sudo ipconfig set en0 DHCP

The newer networksetup command can also be used to display DHCP lease information for specific interfaces. First, determine which interface to gather information for, and then display that information -- in this case, for the Wi-Fi interface -- using the following commands:

networksetup -listallnetworkservices
networksetup -getinfo Wi-Fi
Screenshot of networksetup command on macOS
The networksetup command on macOS


It is simplest to manage DHCP client status via the macOS GUI. Here is the path for the Wi-Fi interface:

System Preference > Network > Wi-Fi > Advanced > TCP/IP

Note there is a button to renew the IP address configuration. The Configure IPv4 pull-down menu allows the Using DHCP and Manually options for setting the IP address.

Screenshot of GUI network configuration tool on macOS
The GUI network configuration tool on macOS


Whether on Windows, Linux or macOS, IP address configuration and troubleshooting are critical. These OSes default to DHCP client settings. While managing systems via the GUI can be convenient, using command-line tools is often more efficient. Further, command-line tools are more flexible and scriptable. In some cases, such as Windows Server Core and many Linux deployments, a GUI is not available.

One of the most common troubleshooting steps for network connectivity issues is to renew the IP address configuration. Knowing the appropriate commands for each of the client types in a given network is a timesaver.

Next Steps

APIs crucial to a successful DDI strategy

Dig Deeper on Network infrastructure

Unified Communications
Mobile Computing
Data Center