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.

I have upgraded to 12.10 from 12.04 recently and I am having issues with connecting to the Internet.

I got an IP address and am able to ping other LAN IPs in the local network but I am unable to connect to the Internet and am even unable to ping www.google.com from a terminal.

Somehow making changes in /etc/resolv.conf and restarting resolvconf service and rebooting works but I need to do this every time I connect to a new network. How do I make these changes permanent?

Can someone suggest a solution to this issue?

share|improve this question
    
@medigeek This is incredibly unhelpful. The question is about DNS configuration in Ubuntu, not some intermittent Windows issue. Please take your “restart it and see if it works” comments elsewhere. –  Blacklight Shining Apr 5 '13 at 21:13
    
@medigeek no offense, but I absolutely fail to see how a “stuck” network card could affect DNS resolution. Even if it did, you advise shutting down all routers and modems? Really? –  Blacklight Shining Apr 27 '13 at 17:14
add comment

2 Answers

As per the header on /etc/resolv.conf:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN

Try putting your change in

/etc/resolvconf/resolv.conf.d/base and they should get added to /etc/resolv.conf when it gets re-written every 15 minutes.

share|improve this answer
    
It is not true that /etc/resolv.conf gets rewritten every fifteen minutes. When resolvconf is installed and /etc/resolv.conf is a symbolic link to /run/resolvconf/resolv.conf, the target of /etc/resolv.conf can get rewritten when resolvconf's nameserver information changes, generally as a result of some change in network configuration. –  jdthood Nov 10 '12 at 22:32
    
Putting nameserver information in /etc/resolvconf/resolv.conf.d/base is at best a workaround for the problem. Workarounds are good but a solution to the real problem would be better. –  jdthood Nov 10 '12 at 22:36
add comment

Here is a generic procedure which fixes a couple of known bugs in nameserver information handling.

Is resolvconf installed? If so then do the following.

sudo dpkg-reconfigure resolvconf

If it is not installed then do the following.

sudo apt-get install resolvconf

Now that resolvconf is installed correctly, reboot so that resolvconf will be provided with nameserver information.

If name service is still broken and you are using NetworkManager to manage networking then open /etc/NetworkManager/NetworkManager.conf in an editor and comment out the line "dns=dnsmasq". To comment it out, put a '#' character at the beginning of the line.

gksudo gedit /etc/NetworkManager/NetworkManager.conf

Next go into the connection editor and make sure that the connection you are using is properly configured. E.g., most often "network indicator | Edit Connections... | Wired | Wired connection 1 | Edit... | IPv4 Settings | Method" is set to "Automatic (DHCP)" and no "Additional DNS server" addresses are set.

Then restart network-manager.

sudo restart network-manager

Now confirm that the expected nameserver address(es) appear in /etc/resolv.conf.

If you aren't using NetworkManager to configure interfaces and you are using ifup then edit /etc/network/interfaces and include dns-nameservers and dns-search lines in the appropriate iface stanza as needed. Make sure that /etc/resolvconf/resolv.conf.d/head only contains comment lines and that /etc/resolvconf/resolv.conf.d/base and /etc/resolvconf/resolv.conf.d/tail are absent or empty. Then ifdown and ifup the interface. Confirm that the nameserver address(es) that you added to /etc/network/interfaces now appear in /etc/resolv.conf.

If name service still does not work then there's most likely a local problem: a misconfigured DHCP server, for example. Another known cause of problems is third-party VPN clients which trash the symbolic link /etc/resolv.conf. If your LAN seems OK and you aren't using third-party networking software then file a bug report against NetworkManager or resolvconf, whichever you think is more likely the culprit.

share|improve this answer
add 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.