Jump to content


- - - - -

How to Set a Static IP Address on Ubuntu and Debian

Ubuntu 12.04 Debian 6

  • Please log in to reply
No replies to this topic

#1 Wilson18



  • root
  • 112 posts
  • LocationUniversity of Birmingham

Posted 25 May 2014 - 11:11 AM

When using a server a server a lot  it is always a good idea to give it a static IP address so we know where to look for it on another machine. We do this by editing our network config file by typing:

nano /etc/network/interfaces

When you open this file, it should look like as follows:


When you open this file, you will first need to delete the following lines:

allow-hotplug eth0
iface eth0 inet dhcp

You will need to remove the two lines and replace with the following lines. (I will be adding my network configuration so

auto eth0
iface eth0 inet static

Once completed, it should look like this:


make sure that the one you enter fits your network setup and that the information is available on your network). When you have done this, you will need to save the file (With Ctrl + O) and exit the file (With Ctrl + X)
The next thing we need to do is set the DNS Servers. We do this by editing the following folder:

nano /etc/resolv.conf

This file should be blank. You will need to add the following content.



Now, I would recommend rebooting so that changes can be taken in to affect. When you log back in, you can run the following to view your network information.



List what you read?

Check me out on: YouTube, Twitter, Facebook, Google+

Also tagged with one or more of these keywords: Ubuntu 12.04, Debian 6