Skip to main content
Network Security & Firewall CLI

IP Release CLI Reference: Syntax, Examples, and Troubleshooting

ip release is the operation of terminating a DHCP lease and discarding the assigned IP address on a network interface, executed via ip addr flush or dhclient -r on Linux and ipconfig /release on Windows.

# Linux – Flush all IPv4 addresses from interface
ip addr flush dev eth0

# Linux – Release DHCP lease (dhclient)
dhclient -r eth0

# Windows – Release IP for all adapters
ipconfig /release

# Windows – Release IP for a specific adapter
ipconfig /release "Ethernet0"

Syntax

Tested on Ubuntu 22.04 with iproute2 5.15 and dhclient 4.4.3; Windows 10 22H2.

All commands require elevated privileges: sudo on Linux, Run as Administrator on Windows.

Options and Flags

Flag / Option Type Default Description
ip addr flush dev <iface> Linux iproute2 N/A Removes all IP addresses from the specified interface.
dhclient -r <iface> Linux DHCP client N/A Releases the current DHCP lease for the interface.
ipconfig /release [adapter] Windows All adapters Sends a DHCPRELEASE message and discards the IP configuration. Optional adapter name narrows scope.
sudo (Linux) Privilege escalation Required Both ip addr flush and dhclient -r require root privileges.
Run as administrator (Windows) Privilege escalation Required Command Prompt must be launched with admin rights for ipconfig /release.

Usage Examples

1. Release all IPv4 addresses on Linux to force DHCP renewal

sudo ip addr flush dev eth0
sudo dhclient eth0

This sequence drops the current IP and immediately requests a new lease. Useful when migrating subnets or after a DHCP scope change. The interface will be briefly unreachable.

See also  Ieee802 1q VLAN Tagging — Complete CLI Reference, Syntax

2. Release a specific adapter on Windows to troubleshoot IP conflict

ipconfig /release "Wi-Fi"

Running this as an administrator sends a DHCPRELEASE for the Wi-Fi adapter only. The adapter loses its IP, gateway, and DNS servers. Combine with ipconfig /renew "Wi-Fi" to restore connectivity.

3. Combine release and renew in a single batch (Windows)

ipconfig /release && ipconfig /renew

One-liner for quick troubleshooting. The && ensures /renew only runs after /release succeeds. Adding a delay (timeout /t 2) improves success rate in busy networks.

Troubleshooting & Common Errors

Error Message Root Cause Resolution Command
ip: RTNETLINK answers: Operation not permitted Missing root privileges on Linux. Prepend sudo: sudo ip addr flush dev eth0
dhclient: No DHCP client running dhclient daemon not active or interface not managed by DHCP. Start sudo dhclient eth0 to run the client in foreground; or restart the service.
ipconfig /release – The requested operation requires elevation. Command Prompt not running as Administrator. Launch CMD as Administrator (right-click → Run as administrator).
An error occurred while releasing interface Lo: An address has not yet been associated with the network endpoint. Loopback adapter selected; only physical/virtual adapters can release DHCP leases. Specify the correct adapter name: ipconfig /release "Ethernet"

Performance Considerations

ipconfig /release sends a DHCPRELEASE packet with no retry. In scripted environments, use timeout /t 2 or schedule via at to avoid hanging. Release packets are tiny (< 300 bytes), so MTU is irrelevant. For remote execution, at decouples release from the script, avoiding psexec limitations with &&. Example stagger:

@echo off
at \machineA 12:59 ipconfig /release
at \machineB 13:01 ipconfig /release
at \machineC 13:03 ipconfig /release
timeout /t 120
psexec \machineA -d ipconfig /renew
psexec \machineB -d ipconfig /renew
psexec \machineC -d ipconfig /renew

Frequently Asked Questions

When should I use the /release6 flag in ipconfig?

Answer: Use ipconfig /release6 to release only the IPv6 DHCPv6 lease without affecting IPv4. On dual-stack networks, ipconfig /release releases both. To preserve IPv4 while renewing IPv6, run ipconfig /release6 && ipconfig /renew6. Verify with ipconfig /all.

How do I fix ‘An error occurred while releasing interface’ on Windows?

Answer: Run Command Prompt as Administrator, disable the adapter with netsh interface set interface "Ethernet" admin=disable, then re-enable. If persistent, reset TCP/IP: netsh int ip reset and netsh winsock reset. Reboot and retry.

Does ipconfig /release work on AWS EC2 Windows instances?

Answer: No. AWS ignores DHCPRELEASE packets. Instead, use the AWS CLI: aws ec2 assign-private-ip-addresses. On Linux, dhclient -r also fails; use ip addr flush but note it only disrupts connectivity, it does not free Elastic IPs.

What is the fastest way to release all IP addresses on a Windows machine with a single command?

Answer: Run ipconfig /release * to release all adapters, including virtual ones. For selective release, use ipconfig /release "Wi-Fi". Renew with ipconfig /renew *. On Linux, dhclient -r or ip addr flush dev *.