Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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 192.168.1.99.
  • The router's address is 192.168.1.1.
  • The subnet mask is 255.255.255.0.
  • I assume that the network is 192.168.1.0.
  • I assume that the broadcast is 192.168.1.255.
  • According to my router, the DNS servers are 75.75.75.75 and 75.75.75.76. No idea if this is correct or not.

This is what my files look like currently:

/etc/network/interfaces

auto eth0
iface eth0 inet static
address 192.168.1.99
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

/etc/resolv.conf

#these are all commented out, I was trying ideas, but no combinations worked.
#nameserver 75.75.75.75
#nameserver 75.75.76.76
#nameserver 8.8.8.8
#search hsd1.nh.comcast.net

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

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 192.1.8.1.1 <-- type-o there , should be 192.168.1.1 –  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 192.168.1.1 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
show 1 more comment

2 Answers

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 cyberciti.biz 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:

search hsd1.nh.comcast.net
nameserver 68.87.71.226
nameserver 68.87.73.242

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

dns-nameservers 68.87.71.226 68.87.73.242

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 68.87.71.226' 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
add comment

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: 8.8.8.8 and 8.8.4.4
Open DNS is: 208.67.222.222 and 208.67.220.220

The syntax is:

nameserver 8.8.8.8
nameserver 8.8.4.4

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
show 1 more comment

Your Answer

 
discard

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.