If you have a new install of Ubuntu/Debian, you’ll notice that eth0 is always set to “DHCP”. While this is fine and dandy for user environments, out there in the server world, we like static IP addresses.
First thing’s first…. open the /etc/network/interfaces file.
sudo vi /etc/network/interfaces
Next, you want to change the eth0 DHCP setting to Static and add your Networking:
iface eth0 inet dhcp
iface eth0 inet static
Restart Networking and enjoy!
sudo /etc/init.d/networking restart
[UPDATE] (Thanks Mike)
You may lose your name-server config upon reboot, so you can add this to your static IP config in /etc/network/interfaces: