Configure Static IP Address in Ubuntu Server 8.10

Jack Wallen
Mar 30, 2009
Updated • Dec 28, 2012
Linux
|
5

If you have a need for a server OS that is robust, reliable, and as flexible as any other server available, then Ubuntu 8.10 should be in serious consideration. There is only one drawback to this server - no GUI. Oh sure you could install a GUI (you'd be doing it from the command line of course), but that would defeat the purpose of having a headless server that is going to suffer from serious loneliness as it sits alone doing its job.

Naturally if you have such a server, you have to have the ability to configure that server. One of the configurations you most likely will need to undertake is the configuring of network settings for a static IP address on your headless, GUI-less server. Fortunately, when using Ubuntu Server 8.10 - that is a piece of cake.

In reality there are two files that must be configured and one file that can be configured. The "must files" are /etc/network/interfaces and /etc/resolv.conf. The "can file" is /etc/hosts. We will deal with the former two files in this article. The latter file (a file that deals with local IP to name mapping) has already been covered in my article "Ease Linux Networking with /etc/hosts" here on gHacks.

So let's first take a look at the most important file, /etc/network/interfaces. Open that file up in your favorite editor (mine being nano).? What you will most likely see is this:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp

The last line is what you need to edit (and add to.) To configure eth0 (your network device) for a static IP address that last line should resemble:

iface eth0 inet static
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1

Naturally you will need to change the last three lines to reflect your own networking setup.

Once that file has been edited you can restart your network connection with the command:

sudo /etc/init.d/networking restart

Your Ubuntu Server 8.10 should now be up and running with a static IP address.

DNS

There is one last file you will need to take care of. That file is /etc/resolv.conf. This file is in charge of holding your DNS server addresses. Open this file up in your editor. What you need are two lines:

nameserver 208.67.220.220

nameserver 208.67.222.222

The above example reflects using the OpenDNS servers. Your network will obviously have its own requirements for DNS addresses. Once you have edited that file save it and you're done (no need to restart networking for the change in DNS addresses to take effect.)

Final Thoughts

That's it. How simple is it to configure your Ubuntu Server with a static IP address - even when said server is a headless, GUI-less server. Of course there is much more you can do than simple Static IP address configuration, but this just highlights how easy a Linux server can actually be to administer.

Advertisement

Previous Post: «
Next Post: «

Comments

  1. Andrew Lobban said on January 4, 2010 at 3:18 am
    Reply

    Hey guys,

    What do I put in place of nameserver?
    Or is it in my case
    nameserver 64.233.207.8
    nameserver 64.233.207.9
    to be added to my resolv.conf

  2. Glen said on December 12, 2009 at 10:36 am
    Reply

    Thanks! Why didn’t I switch to static local IP earlier when it was this easy? … I suppose I thought it would be hard as I had trouble with Fedora (10).

  3. arif said on November 14, 2009 at 10:25 pm
    Reply

    great….

    so why not do a complete install/setup-configure/test static ip webserver with a dummy website serving mysql dynamic content. Using one of the lattest distro eg. ubuntu / opensuse with diagrams.

    you’ll help lots of people and if you have a [donate] click i am sure people will send generously when they finally find something that works.

    if i knew how to do it i would explain it to the world with diagrams from the very geginning – eg. what directories contain what files and what these files are used for etc.

    thanks and good luck.

  4. Arizona Charlies Boulder said on March 30, 2009 at 10:17 pm
    Reply

    great tip, thanks!

  5. 44Bar said on March 30, 2009 at 4:18 pm
    Reply

    Very good, thanks for the info.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.