can't resolve hostnames on Ubuntu 11 - no DNS?
I recently assembled a new computer with both Windows 7 boot and Ubuntu 11.04 boot. For some reason, I can not resolve domain names at all on in Ubuntu while Windows 7 works just fine. I'm wondering if I have improperly configured my network settings. I am trying to configure this machine to have a static IP on my network of 192.168.1.3
The machine definitely has its network card installed properly and in Ubuntu I can access numeric ip addresses anywhere via browser or ssh. When I type in "google.com" in a browser I get an instant 'server not found' error page. Anything that is described in my hosts file seems to work just fine. I can ping my router which has a LAN IP of 192.168.1.1 just fine with no packet loss. Here are the contents of /etc/network/interfaces: Code:
auto lo Also, I am unable to access this machine via ssh from any other machine on the network. Wondering what might be wrong. Any tips are greatly desired. |
hi, what is in:
Code:
[schneidz@hyper world-united]$ cat /etc/resolv.conf |
Thanks for your response! /etc/resolv.conf does not have a nameserver directive in it. It has a comment and that is all. Should I add a nameserver directive?
|
^ worth a shot.
|
It worked. Odd that one would need to do that I think. I would imagine the system would be smart enough to derive it from the gateway or something.
|
You're system must run dhcpcd in order to get a correct IP-configuration from the DHCP-server. If you configure for a static IP you must instead tell dhcpcd not to overwrite the nameserver-entry in /etc/resolv.conf. In order to achieve this, you'll have to insert a line
Code:
nohook resolv.conf Markus |
Markush, thanks for the additional information. Unfortunately, I'm not certain whether dhcpcd is active (or even what it is).
When I initially installed Ubuntu from the CD, I don't believe I was prompted for dhcp versus static IP. I followed this how-to document to configure it with a static IP. Do I still need that line in my /etc/dhcpcd.conf ? |
mh, if you have the file /etc/dhcpcd.conf (it maybe on another place in Ubuntu) you'll know that dhcpcd is installed. Note that every distribution installs a DHCP-client-daemon by default (there are others than dhcpcd) since without it DHCP will not work and most systems use DHCP at least while installation.
The answer to your question: if you have a dhcpcd.conf file, insert the line I described in my last post and just try it out. Note also that if you restart the system and don't have the line "nohook resolv.conf" in your dhcpcd.conf file, dhcpcd will overwrite your nameserver again. Markus |
I just did a search for dhcpcd.conf :
Code:
jaith@ubuntu64:/$ sudo find * -name 'dhcpcd.conf' I'll try a reboot and see what happens.... |
If your system doesn't use dhcpcd, you can use the command
Code:
apropos dhcp Markus |
Thanks again for the info. Rep++. I rebooted my machine and it still seems to be working. I can resolve remote hostnames and my resolv.conf file still contains the nameserver bit. This seems safe.
I typed the command you suggested: Code:
jaith@ubuntu64:/$ apropos dhcp It has a lot of settings that have all been commented out, but the active ones are as follows: Code:
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8; |
nohook is special for the dhcpcd program, but the entry in red
Code:
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8; I don't know if the "overwriting /etc/resolv.conf" is a speciality of dhcpcd or if it is a general behavior of any dhcpclient. I'd recommend to read the manpages for Code:
man dhclient Markus |
Quote:
Code:
sudo find / -name 'dhcpcd.conf' |
schneidz, my working directory when i ran the search was / so I did indeed search the whole system.
markus thanks for the info. I had to reinstall my OS due to hardware problems and will likely be experiencing this issue again this week :( |
Nearly irrelevant, slightly nitpicking, note:
Provided that you are running locate (many distros do this by default) it is easier and more convenient (and faster) to use 'locate' (sometimes, slocate) to perform simple file searches like this Quote:
|
All times are GMT -5. The time now is 04:04 AM. |