How to set a static IP to Ubuntu Server

Sep 5, 2015

In computing, a network interface is a system’s (software and/or hardware) interface between two pieces of equipment or protocol layers in a computer network.

A network interface will usually have some form of network address. Below I show how to setup a network interface with IPv4.

01 – Getting superuser access

In Ubuntu:

# sudo su

In Debian:

> # su –

02 – Edit interface settings

Edit the interfaces file:

# nano /etc/network/interfaces

Change “dhcp” to “static” configuration and fill the follow areas with your network information.


Restart network service:

# /etc/init.d/networking restart

03 – Test

To test if everything is working ok, run:

# ifconfig

The result need to be something like this:


And that’s it. Any question, just leave a comment below.

See ya!


Luiz Felipe F M Costa

I am a quality engineer at Red Hat / Ansible. I love automation tools, games, and coffee. I am also an active contributor to open-source projects on GitHub.