Setting up a static ip address is useful for a lot of things, especially if you run a web server for example and don’t want to change the port forwarding rules on your router each time it allocates a different ip to your Ubuntu server.

Only use this guide if you already know the working network configuration (ip, mask, gateway and dns servers).

First of all, open a terminal window and edit the network interfaces file:

sudo nano /etc/network/interfaces

You will find here something like this:

auto eth0
iface eth0 inet dhcp

Edit that file accordingly and replace with your own ip configuration. The dns nameservers are actually Google’s dns servers so if you don’t know your own ISP ones, you can use those:

auto eth0
iface eth0 inet static

Restart the interface:

sudo ifdown eth0 && sudo ifup eth0

That’s it!

HowTo: Setup a Static IP Address in Ubuntu 14.04
Tagged on: