Change IP address after installation (Static IP)

Say on our host

alpha

we want to change (from DHCP) to a static IP Address

192.168.127.123

edit

/etc/hosts

and add an entry for alpha with 192.168.127.123 as:

192.168.127.123 alpha

edit

/etc/network/interfaces

and make it look like this:

auto lo
iface lo inet loopback
auto eth0
allow-hotplug eth0

comment the following line referring to DHCP

#iface eth0 inet dhcp

add the following for a static IP Address

iface eth0 inet static

change as necessary to an address /netmask from your network

address 192.168.127.123
netmask 255.255.255.0

change as necessary to the gateway of your network

gateway 192.168.127.1

change as necessary to match the DNS server of your network

dns-nameservers 192.168.127.1

Lastly, in a terminal, run

sudo service networking stop
sudo service networking start