How to change IP address in CentOS through command line Print

  • 19



1. Log into the server e.g. via SSH as "root" user using your favorite SSH client (for example Putty).

2. To change IP you need to edit /etc/sysconfig/network-scripts/ifcfg-eth0 on your server in your favorite editor.
Command for example:
vi /etc/sysconfig/network-scripts/ifcfg-eth0
or
nano /etc/sysconfig/network-scripts/ifcfg-eth0

The current entry will look something like
CentOS

You will need to change lines "IPADDR", "GATEWAY" and "NETMASK". All this information you received from our letter.

4. Also you need to edit/check /etc/hosts file and change your old IP to new (if it is needed). 

5. Then restart networking using next command: 
$ ifdown eth0 && ifup eth0

If that gives you trouble reboot the machine.
If the problem persists, please, let us know and we will solve it as soon as possible.


Was this answer helpful?

« Back