1. Overview

There are different occasions when we need to renew the DHCP-assigned system IP address:

  • resolving general connection issues
  • resolving IP address conflicts in a place with many computers and only one DHCP server
  • short lease time set for the assigned DHCP IP

Of course, on top of these reasons, when a computer switches to a different network, its IP also changes.

In this tutorial, we’ll discuss renewing the DHCP-assigned IP address on a Ubuntu 22.04 system.

2. Dynamic Host Configuration Protocol (DHCP)

To begin with, let’s do an overview of the DHCP protocol.

To identify a computer (host) on a network, we use IP addresses. Using these addresses, computers communicate with each other via the network infrastructure and the IP protocol.

Basically, there are two ways of configuring IP addresses on a client machine:

  1. static IP allocation: manually setting IP configuration on each individual client
  2. dynamic allocation: automatically assigning IP addresses through a DHCP server

So, a DHCP server automatically assigns IP addresses to connected hosts on a network. The client cannot interfere with the DHCP settings they receive. However, these settings are transparent to the client side. An IP address set using the above way usually isn’t a permanent one, and we refer to it as a DHCP lease.

Once it expires, if we do not renew it, the same DHCP lease may be allotted to another computer. Therefore, to renew the lease, the client has to periodically check back with the DHCP server.

3. DHCP Clients

Broadly speaking, there are three DHCP clients common to Ubuntu:

However, not all versions of Ubuntu work with all three clients by default. This is true for other Linux-based distributions too.

For example, some of them come shipped with only one of the three clients, whereas others may come shipped with two or all of the three. However, dhclient is a commonly available DHCP client on Ubuntu systems.

Ideally, every system has a default DHCP client. On Ubuntu 22.04, dhclient is the default DHCP client. At the time of writing this article, the other clients, pump and dhcpcd, aren’t available on Ubuntu 22.04.

Since we’re working on Ubuntu 22.04 system, we’ll use dhclient as the DHCP client.

4. Process of DHCP Client-Server Interaction

There are several messages that pass between the DHCP server and the client, as described below:

  1. DHCPDISCOVER: the client broadcasts a DHCPDISCOVER message asking for an IP address
  2. DHCPOFFER: in response to the DHCPDISCOVER message, a DHCP server may transmit a DHCPOFFER message
  3. DHCPREQUEST: the client responds with a DHCPREQUEST message for a DHCPOFFER message from the DHCP server it wants to be configured with, although the message is broadcasted to all DHCP servers on the network
  4. DHCPACK: when a client finalizes communication with a DHCP server, it receives a DHCPACK message from this DHCP server that also includes other required configuration details
  5. DHCPRELEASE: the client can send a DHCPRELEASE message to terminate the lease

After the last DHCPACK message, the client can use the leased IP address and other settings till the end of the lease time.

When half the lease time is over, the client can request IP renewal. For this, the client sends a DHCPREQUEST message to the DHCP server. If the current DHCP server accepts and acknowledges that request, it responds with a DHCPACK message.

However, if the client doesn’t get a response, the client might go on with the current DHCP settings. It can continue using them until the lease time is over.

Once the lease time is over, it’s mandatory for the client to again restart with the DHCPDISCOVER procedure.

5. Renewing DHCP IP Using dhclient

Importantly, since some commands can result in a loss of connection, we should carefully perform these steps through remote sessions that rely on that connection.

Let’s first check if the dhclient service is running on our Ubuntu 22.04 system:

$ ps fax | grep dhclient
   4988 pts/0    S+     0:00  |           \_ grep --color=auto dhclient

The ps command shows the information corresponding to different services running on the system.

Now, let’s check our current leased DHCP IP address on the target interface wlo1:

$ ip addr | grep wlo1
wlo1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    inet brd scope global dynamic noprefixroute wlo1

As we can see, the current assigned IP is We can release a leased DHCP IP address using the -r flag of the dhclient command:

$ sudo dhclient -r

The -r flag releases the current DHCP lease and halts the running DHCP client.

Next, we request a new DHCP IP from the server:

$ sudo dhclient -v
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/wlo1/d0:c5:d3:3d:22:cf
Sending on   LPF/wlo1/d0:c5:d3:3d:22:cf
Listening on LPF/eno1/c8:d9:d2:ee:4f:f9
Sending on   LPF/eno1/c8:d9:d2:ee:4f:f9
Sending on   Socket/fallback
DHCPDISCOVER on wlo1 to port 67 interval 3 (xid=0xaee34c7f)
DHCPDISCOVER on eno1 to port 67 interval 3 (xid=0xebcb010d)
DHCPREQUEST for on wlo1 to port 67 (xid=0x7f4ce3ae)
DHCPACK of from (xid=0xaee34c7f)
bound to -- renewal in 1452 seconds.

Again, let’s verify our IP address on the wlo1 interface:

$  ip addr | grep wlo1
wlo1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    inet brd scope global dynamic wlo1

As we can see, the IP address has now changed to

6. Renew DHCP IP Using systemd-networkd

Many Linux distributions, including Ubuntu, have switched over to the systemd initialization and system management framework. It provides multiple services that can control many aspects of a given environment.

For example, the systemd-networkd service manages networks and network connections. In particular, it can handle new network devices and ensure their proper configuration and connectivity.

As part of this functionality, since Ubuntu 20.04, systemd-networkd provides the networkctl network control client utility.

Naturally, before we use the tool, we should ensure systemd-networkd is our current network management service:

$ systemctl status systemd-networkd
● systemd-networkd.service - Network Configuration
     Loaded: loaded (/lib/systemd/system/systemd-networkd.serv>
     Active: active (running) since Mon 2024-01-21 01:51:58 UT>
TriggeredBy: ● systemd-networkd.socket
       Docs: man:systemd-networkd.service(8)
   Main PID: 66601 (systemd-network)
     Status: "Processing requests..."
      Tasks: 1 (limit: 2244)
     Memory: 2.8M
        CPU: 32ms
     CGroup: /system.slice/systemd-networkd.service
             └─66601 /lib/systemd/systemd-networkd

As we can see, the systemd-networkd service is active.

At this point, we can use networkctl to restart a DHCP lease in a fairly simple manner:

$ networkctl renew wlo1

Here, we leverage networkctl to send a renew request over the desired device.

Notably, there isn’t a release subcommand, but we can also do a forcerenew to ensure the renewal.

7. DHCP Log Verification and Troubleshooting

The syslog file stores the logs generated by the DHCP server. So, we can search through these logs for DHCP logs:

$ cat /var/log/syslog | grep dhcp
Oct 30 05:10:01 LHB NetworkManager[840]: <info>  [1667086801.8104] dhcp4 (wlo1):
  activation: beginning transaction (timeout in 45 seconds)
Oct 30 05:10:01 LHB NetworkManager[840]: <info>  [1667086801.8418] dhcp4 (wlo1):
  state changed new lease, address=
Oct 30 05:40:01 LHB NetworkManager[840]: <info>  [1667088601.7480] dhcp4 (wlo1):
  state changed new lease, address=

By picking the correct terms with grep, we can scan and filter the logs. Such log entries can be very helpful while troubleshooting DHCP issues.

8. Conclusion

In this article, we have learned how we can acquire a new IP address on the Ubuntu system. Specifically, we have used the dhclient utility to renew our IP configuration.