Portal Home Knowledgebase Server Configuration Guides How to Update IP Address on CentOS Servers (CentOS 7 / CentOS 8 / CentOS Stream)

How to Update IP Address on CentOS Servers (CentOS 7 / CentOS 8 / CentOS Stream) Print

  • 0

Step-by-Step Instructions:

For CentOS 7 Servers:

CentOS 7 typically uses the traditional network-scripts system.

  1. Access the server via SSH.
  2. Open your network interface configuration file:

sudo nano /etc/sysconfig/network-scripts/ifcfg-eth0

(If your interface is named differently, adjust accordingly — check with ip a.)

  1. Update or add the following lines:

IPADDR=YourNewIP

GATEWAY=YourNewGateway

Example:

IPADDR=104.160.9.50

GATEWAY=104.160.9.1

  1. Save and exit the file:
  • Press Ctrl+X, then Y, then Enter
  1. Restart the network service:

sudo systemctl restart network


For CentOS 8 and CentOS Stream Servers:

CentOS 8 may use either network-scripts or NetworkManager (nmcli).

If network-scripts exist (common on hosting setups):

  • Follow the CentOS 7 steps above (same commands).

 

If your server uses NetworkManager, follow these steps:

  1. Access the server via SSH.
  2. List the active connections:

nmcli connection show

  1. Edit your network connection:

nmcli connection edit YourConnectionName

  1. Set the new static IP:

set ipv4.addresses 104.160.9.50/24

set ipv4.gateway 104.160.9.1

set ipv4.dns 8.8.8.8,8.8.4.4

set ipv4.method manual

save

quit

  1. Restart networking:

sudo systemctl restart NetworkManager

 

Important Reminders:

  • Ensure you enter IP addresses and gateways correctly to avoid disconnection.
  • Always keep a console (IPMI/KVM) access ready if available, in case network access is lost.
  • If unsure, contact your hosting support for confirmation before applying changes.

Need Assistance?

If you face any issues while updating the IP, feel free to open a support ticket via your client portal — we are here to help!

OffshoreDedicated.NET

Privacy Made Easy


Was this answer helpful?

« Back