To remove a fixed IP address in Red Hat 8, you need to edit network configuration files or use nmcli
(NetworkManager Command Line Interface)
WARNING! Be careful when restarting the networking service over an SSH session. !!!
The old way (Editing Network Configuration Files)
- Open the network configuration file for the interface (e.g.,
ifcfg-e
np0s3):
sudo nano /etc/sysconfig/network-scripts/ifcfg-<interface-name>
- Remove or update the following lines to switch to DHCP:
BOOTPROTO=dhcp
- Remove any
IPADDR
,PREFIX
,NETMASK
, orGATEWAY
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.