Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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

First, yes, this question's "question" will be an exact duplicate of static ip - what am I doing wrong? , but the question was never resolved in a way that helps.

What I am trying to do is make my Ubuntu Server have a static IP address. I am not entirely sure on the numbers to plug in, but I am sure it has something to do with correctly setting up the DNS servers.

Information I have:

  • I want the address of the computer to be
  • The router's address is
  • The subnet mask is
  • I assume that the network is
  • I assume that the broadcast is
  • According to my router, the DNS servers are and No idea if this is correct or not.

This is what my files look like currently:


auto eth0
iface eth0 inet static


#these are all commented out, I was trying ideas, but no combinations worked.

Currently, as with the similar question, I can ping every other computer on my local network. But as soon as I try to ping, I get unknown host

If anyone has any suggestions, it would help a lot.

suggestion: Why doesn't this custom static IP network configuration work? (the first comment)

share|improve this question
gateway <-- type-o there , should be – SpamapS Aug 5 '12 at 16:52
sorry, that is correct. typo on my part – gunr2171 Aug 5 '12 at 16:57
Did you try the router nameserver in your /etc/resolv.conf? – con-f-use Aug 5 '12 at 16:59
still nothing, sorry – gunr2171 Aug 5 '12 at 17:01
is your server running from a static ip to start with? If it is dynamic there is a few extra things needed I think. – Magpie Aug 5 '12 at 17:21
up vote 1 down vote accepted

Ok, I am not sure why, but I got it to work. I am not going to mark it as the answer until I am conviced that I solved the issue.

First what I did was go to this tutorial, and noticed that they have search in their /etc/resolv.conf file, followed by the dns servers they want to use. Remembering that this "search" line is similar to the one that was automatically generated in my copy of the file, I formatted the file to look like this:


These DNS number I had to get from this website (I use comcast).

I restarted the computer and magicly I can ping Google! Also, the search line has been removed from the /etc/resolv.conf file, but I think that's ok.

Also, I don't know if this helps/hurts, but I put in the line


in my /etc/network/interfaces file, as the last line.

I will update this post if this turns out to work or not.

share|improve this answer
did you mean 'nameserver' instead of 'namespace' ? – SpamapS Aug 6 '12 at 20:01
The 'dns-nameservers' line is in fact necessary because Ubuntu uses 'resolvconf' and 'dnsmasq' to give you a local cache, so those are used to populate the configs for those programs, and then they take over /etc/resolv.conf – SpamapS Aug 6 '12 at 20:03
yes, I meant "nameserver". I've been doing too much programming lately. Typo here, not in my file. – gunr2171 Aug 6 '12 at 20:17

Do you have a local DNS server in your LAN?

If not, try to put Google DNS or Open DNS in your /etc/resolv.conf.

Google DNS is: and
Open DNS is: and

The syntax is:


Also maybe you need to restart networking after that, but I am not sure:

sudo /etc/init.d/networking restart

On Windows you would flush the DNS cache, but Ubuntu doesn't cache DNS by default I think.

share|improve this answer
I do not have a local DNS server in my lan. I have tried both Google's DNS and OpenDNS in that file. Still no dice. And I have been restarting the network service with service networking restart. – gunr2171 Aug 5 '12 at 17:26
Here is an interesting tid-bit: when I restart using that command, I get on the first line: stop: Unknown instance:. But then I can still ping all the computers on my local network. – gunr2171 Aug 5 '12 at 17:27
Hm I am not sure what that means... Do you have Samba installed on your machine? There have been cases where dns proxy = yes in /etc/samba/smb.conf interfered with the main DNS settings. – Richard Nixon Aug 5 '12 at 17:34
I have Ubuntu 12.04 LTS, if that is what you mean. There is no such "samba" directory in /etc/. – gunr2171 Aug 5 '12 at 17:38
I guess then it's not installed. Samba is the name of a server software providing Windows File Sharing and Printing Services. – Richard Nixon Aug 5 '12 at 17:42

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.