How to change IP address in Ubuntu through command line Print

  • 20



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/network/interfaces on your server in your favorite editor.
Command for example:
vi /etc/network/interfaces
or
nano /etc/network/interfaces
The interface will probably be called eth0.
The current entry will look something like
Ubuntu

You will need to change lines "address", "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