Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to set up my machine with a static IP address. I've done it before and it worked.

It's been a long time so, once again, I researched how to do it before starting. It looked pretty familiar and I could remember the process from before ... so I got started ...

I should mention that this is a new installation. The only thing I did before attempting this was to do an update and install ssh.

The first thing that I thought was odd was the contents of /etc/network/interfaces. It looked like this:

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

Where's the stuff I usually find (and the walk through pages all seemed indicate that I would find) for eth0? I was expecting to see:

auto eth0
iface eth0 inet dhcp

Funny thing is, it did pick up an IP address - - which is a bit odd because IPs are usually assigned on a sequential basis and I would have expected it to pick up because this was the next available IP.

Anyway, all this oddness aside, I ploughed on. I added the following to /etc/network/interfaces

auto eth0
iface eth0 inet static

Then the next dose of oddness ... I issued the following command: /etc/init.d/networking restart ... nothing happened. No error messages, nothing at all. So, I tried this: service networking restart ... this is what happened:

stop: Job failed while stopping
start: Job is already running: networking

So I rebooted. The network configuration looked just great. I could ssh into the machine from inside my internal network. At this moment I thought I'd done it and I could forget the odd stuff. But no, the next thing I did was run apt-get update ... it failed ... I tried to ping a couple of websites and nothing would resolve so I'm guessing it's not finding a DNS server.

But it's just a guess and it doesn't help me because I don't know what to try next.

share|improve this question
Thanks user68186 - I've taken that approach before but it introduced another set of problems (that I do understand for a change!) that I want to avoid this time. – Simon Jul 19 '14 at 0:00
up vote 8 down vote accepted

The default /etc/network/interfaces file only contains the loopback interface definition because desktop versions of Ubuntu use the NetworkManager service instead.

Your current configuration is missing a dns-nameservers specification, so it cannot resolve names to IP addresses.

You could add one or more dns-nameservers, however unless you have a particular reason to use the networking service, it would probably be better to revert your changes and then set up a static interface via NetworkManager's nm-applet (from the menu bar) or by invoking nm-connection-editor from a terminal - navigate to the IPV4 Settings tab and change the drop-down Method: from DHCP to Manual and then enter your desired network parameters there.

share|improve this answer
Ah - now this makes sense - when I did all this before I didn't have a gui installed - this time I installed the lot. Right, I'm going to try adding a dns-nameserver just because I want to see this through but I'll probably re-install without the gui. This machine is inteded to be a file server for a small network of windows pcs and macs. Is there any reason to use or not to use a gui for this role? I am more comfortable with command line stuff for this kind of thing but I thought that the gui might help with some other stuff that I might do on the machine. Thanks steeldriver – Simon Jul 18 '14 at 23:59
If you're comfortable administering everything via CLI that's fine. FYI the keyword in the /etc/network/interfaces file needs to be dns-nameservers (plural) even if you only specify a single one e.g. dns-nameservers or dns-nameservers – steeldriver Jul 19 '14 at 0:04
Excellent - that worked - I simply added this: dns-nameservers, restarted and it worked. I am a very happy, I can go to bed now! :) I will get shot of the gui tomorrow. Thank you so much steeldriver. By the way, is it possible to mark this as solved? I've looked for a button/link but, either I'm too tired to see it or it's not there. – Simon Jul 19 '14 at 0:10
@Simon Yes! Please, mark it as accepted :) you can also upvote it – Lucio Jul 19 '14 at 0:13
By the way, this forum is really, really good - lots of helpful people who don't ridicule us beginners - thanks to everyone involved. – Simon Jul 19 '14 at 0:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.