How to remove fixed IP in RHEL

To remove a fixed IP address in Red Hat 8, you need to edit network configuration files or use nmcli (NetworkManager Command Line Interface)

The old way (Editing Network Configuration Files)

  • Open the network configuration file for the interface (e.g., ifcfg-enp0s3):
sudo nano /etc/sysconfig/network-scripts/ifcfg-<interface-name>
  • Remove or update the following lines to switch to DHCP:
BOOTPROTO=dhcp
  • Remove any IPADDR, PREFIXNETMASK, or GATEWAY entries. / or comment on it.
  • Restart the network service
sudo systemctl restart NetworkManager

Using nmcli

  • check connection name
nmcli connection show
  • Modify the connection to remove the fixed IP
    Note: Replace "connection-name" with the name of the connection from previous command
nmcli connection modify "your-connection-name" ipv4.addresses "" ipv4.method auto
  • Restart the network connection
nmcli connection up "your-connection-name"


Discover more from naiwaen@DebuggingSoft

Subscribe to get the latest posts sent to your email.