Linux Lite Forums

Software - Support => Other => Topic started by: paul1149 on April 22, 2016, 09:31:54 AM

Title: No DNS cache
Post by: paul1149 on April 22, 2016, 09:31:54 AM
I've been having slow Web page loading for several weeks now. Finally, I ran tests against a couple of Windows boxes, and isolated the problem to my LL box.

The status bar of the browser almost always hangs for a second or more on "Resolving host...". This doesn't happen on the other units. All units are set to get their DNS addresses from the local router, which in turn points to quality DNS services such as OpenDNS. My Linux box is on ethernet, and I've tried Windows boxes on both ethernet and wifi.

It seemed odd that this would happen even when I had visited the same domain just prior, so I began to suspect the DNS cache. I did a little research and ran the command sudo /etc/init.d/nscd restart, and got back: "command not found"

I ran service nscd restart, and got back "unrecognized service".

It seems that I don't have DNS cache running on this machine. That would explain the problem. Does anyone have any insight on how to troubleshoot or rectify this?

Thanks.
Title: Re: No DNS cache
Post by: firenice03 on April 22, 2016, 09:59:50 AM
You may need to install?? Since the error command not found...

Found this:
Install nscd using the following command if not yet
Code: [Select]
sudo apt-get install nscd
Flush DNS Cache in Ubuntu by restarting the nscd

Code: [Select]
sudo /etc/init.d/nscd restart
From here: http://askubuntu.com/questions/414826/how-to-flush-dns-in-ubuntu-12-04

Maybe worth a try to install???....

Added:
service nscd restart and sudo /etc/init.d/nscd restart are essentially the same command - restart said service (2 ways to accomplish the same)
Title: Re: No DNS cache
Post by: paul1149 on April 22, 2016, 10:12:04 AM
Absolutely awesome, firenice. I ran the install, which went well and auto-started the service. Even without a reboot, now when I first visit a domain I get the "resolving host" delay. But subsequent visits are without delay. I dare say we've got this beat!

I suppose I did a "complete removal" of some software a couple of months ago and it must have taken NSCD out with it.

Thanks much, and blessings!
Title: Re: No DNS cache
Post by: torreydale on April 22, 2016, 10:17:10 AM
I had a similar DNS head scratcher when I connected to my personal OpenVPN Access Server.  There is something unusual with how Linux Lite handles DNS.  Perhaps firenice03's suggestion is on to something.  The workaround to my issue is below. 

What is the result you get from the following?:

Code: [Select]
sudo nano /etc/resolv.conf
If the nameserver you see is 127.0.0.1, change the line that states nameserver 127.0.1.1 to nameserver 8.8.8.8

Then see if your results aren't better.  If they are better, when you reboot, the nameserver may return to 127.0.0.1.  As a workaround for this, to make the change stick, you'll have to add 8.8.8.8 as an Additional DNS Server in your Network Connections.  You'll find the Additional DNS Server settings under the IPv4 Settings tab of Network Connections (Menu > Settings > Network Connections).

8.8.8.8 is a Google public DNS server, by the way.

P.S.  You may also try to see what happens if you manually add your OpenDNS server IP addresses to the Additional DNS server settings, in addition to or instead of 8.8.8.8.  Use commas to separate multiple domain name server addresses.

UPDATE:  It's good to see firenice03's suggestion helped.  Can you reboot and report back whether your issue stays resolved after a reboot?
Title: Re: No DNS cache
Post by: paul1149 on April 22, 2016, 10:26:54 AM
That's interesting, Torrydale. If I understand it, resolv.conf tells the programs to look to the machine for the DNS nameserver, and then the machine tells it to look to the network settings? In my case, I then send the request to the router, rather than to the default ISP nameserver.

If I were to do this, I would use OpenDNS rather than google, though, since I don't want google to know every site I look up. I'll watch my current situation for a while, but the nscd install seems to be 99% on the money so far.
Title: Re: No DNS cache
Post by: paul1149 on April 22, 2016, 10:39:04 AM
I rebooted, and the problem is still resolved. I would say there is a bit more time spent resolving hosts than before the reboot, but most of the time it is later in the page load sequence, indicating the DNS's of secondary, remote elements being sought out. I think it's solved.
Title: Re: No DNS cache
Post by: technomancer on April 22, 2016, 12:15:12 PM
(I have a similar issue with Xerox automatic meter reporting on copiers. DNS can be tricky !)

A complete uninstall of software can lead to issues i have found. Some not so obvious.
If you used synaptic package manager it may have taken out a DNS related component as you suspect.
Selecting complete removal sometimes does not differentiate between critical packages.

(http://s5.postimg.org/egamsxgz7/complete_removal.jpg) (http://postimg.org/image/egamsxgz7/)

However if you used the LinuxLite SW tool, I am sure Jerry would like to know so the issue can be addressed.
Title: Re: No DNS cache
Post by: paul1149 on April 22, 2016, 12:27:28 PM
Thanks. I do remember doing a complete removal, but what prog it was is lost at this point. I doubt I used the LL SW tool. I'm surprised synaptic doesn't distinguish between critical base services and other software.
Title: Re: No DNS cache
Post by: firenice03 on April 22, 2016, 01:26:24 PM
Absolutely awesome, firenice. I ran the install, which went well and auto-started the service. Even without a reboot, now when I first visit a domain I get the "resolving host" delay. But subsequent visits are without delay. I dare say we've got this beat!

I suppose I did a "complete removal" of some software a couple of months ago and it must have taken NSCD out with it.

Thanks much, and blessings!

Not a problem, good to hear its getting you closer  ;D ;D

Do the Windows and Linux boxes use the same DNS servers?? You mention Linux having slower resolution..
Maybe try manually entering the windows IP's on the Linux box.

This link is the same info torreydale provided but has some additional info should it help...
http://askubuntu.com/questions/272358/extrememly-slow-dns-lookup

Title: Re: No DNS cache
Post by: paul1149 on April 22, 2016, 01:38:29 PM
Yes, all the machines funnel through the same router, where I manually spec three DNS servers.

Good info at that page. Thank you.

Funny, but the only two sites that still consistently hang on DNS lookup are this one (LL) and ask.libreoffice.com. Everything else seems fine. Not sure why this is, as DNS has nothing to do with remote server speed.
Title: Re: No DNS cache
Post by: Wirezfree on April 22, 2016, 01:46:46 PM
If you are feeling really geeky,
and want to test dns out.??

namebench (http://xmodulo.com/how-to-test-dns-server-speed-on-linux.html) is available in synaptic...
Title: Re: No DNS cache
Post by: firenice03 on April 22, 2016, 01:54:07 PM
One other to try...


Check  /etc/nsswitch.conf  file... Look for..
Code: [Select]
hosts:          files mdns4_minimal [NOTFOUND=return] wins dns mdns4
Within that line, "wins" is mentioned..
Change the order to:
Code: [Select]
hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4 wins

As suggested here:
http://ubuntuforums.org/showthread.php?t=1904264&page=2

Update: Another thought
Something else to try, try turning off IPv6
How to disable: http://askubuntu.com/questions/440649/how-to-disable-ipv6-in-ubuntu-14-04
Title: Re: No DNS cache
Post by: paul1149 on April 22, 2016, 03:27:35 PM
Wirez: I gave namebench a spin (I ran it when the problem first arose as well). But I don't see any report. It ran twice in GUI mode, finally I killed it, with nothing to show for it. I did run raw pings on the nameservers back then, and found them all close in speed.

Fire: I found the 'mdns4" spec missing from that line and added it. Otherwise the desired order was already there. I think I'd like to leave IP6 in place, as soon it probably will be necessary.

Thanks guys.
Title: Re: No DNS cache
Post by: torreydale on April 22, 2016, 03:32:18 PM
paul1149,

In reply #5, you mentioned you think this is solved.  If so, could you mark this thread as such?
Title: Re: No DNS cache
Post by: paul1149 on April 22, 2016, 03:35:15 PM
Done. Sorry, I forgot about that.
Title: Re: No DNS cache
Post by: Wirezfree on April 22, 2016, 06:11:40 PM
@paul1149
Do you have Chrome Browser installed.??
IIRC it will only show results if it detects you have Chrome browser default.??
Title: Re: No DNS cache
Post by: paul1149 on April 22, 2016, 06:18:34 PM
That's a pretty weird qualification, it seems. I have a couple of chromium derivatives, one set as the system default.
Title: Re: No DNS cache
Post by: Wirezfree on April 22, 2016, 06:29:04 PM
O.K, not sure then why it won't show results... mmm
Title: Re: No DNS cache
Post by: firenice03 on April 22, 2016, 09:46:54 PM
Fire: I found the 'mdns4" spec missing from that line and added it. Otherwise the desired order was already there. I think I'd like to leave IP6 in place, as soon it probably will be necessary.

Thanks guys.

If running better you're probably good... If you're feeling squirrelly you could disable (1) then enable (0) - for testing..

This is what gave me the idea..

https://www.youtube.com/watch?v=TyqynBnYg3Q

yeah its Windows, but same idea  ;D ;D ;D ;D
Title: Re: No DNS cache
Post by: paul1149 on April 22, 2016, 10:46:23 PM
I've been getting a little bit of regression on this (though it's still a lot better than it was, and some of it might be evening cable lag), so I decided to give that a try. Under the network connection I set IP6 to "Ignore", which grayed out the rest of the settings, so I guess that equals "off". I didn't see any change in dns speed, though, even after rebooting.
Title: Re: No DNS cache
Post by: paul1149 on April 23, 2016, 11:39:10 PM
Though it has been better than it was, the regression lasted all day, and I was getting delays on maybe half the sites.

On a hunch, I entered the OpenDNS address directly in the network properties applet, rather than referring the network to the router's DNS spec, then cycled the network off and on. The result was instant, and in every case my lookups were lightning fast.

So I'm not sure what's at play here. Either the router is defective and the anomalies between linux and windows box performance were just coincidence, or windows is doing a better job of talking to the router.
Title: Re: No DNS cache
Post by: torreydale on April 24, 2016, 09:04:56 AM
It shouldn't be this way.  As a workaround, I mentioned manually entering the OpenDNS servers in an earlier post (reply #3).  The resolv.conf file might show those OpenDNS server addresses now instead of 127.0.0.1.

Perhaps you can summarize your experience and report this as a Linux Lite bug.
Title: Re: No DNS cache
Post by: paul1149 on April 24, 2016, 10:30:08 AM
Thanks. Resolve.conf still shows the 127.... ip, so the network connections / ipv4 DNS setting evidently does not affect that. Before I would file a bug I think I would need to double check the performance of the windows boxes, and also try a different router. I will do that if I can, but I'm not sure when that would be.

(congrats on your promotion, BTW!)
BW
Title: Re: No DNS cache
Post by: torreydale on April 24, 2016, 01:23:37 PM
Mine still says 127.0.0.1.  My mistake on that.  In reflection on my reply #3, that was the reason I had to manually enter in an Additional DNS Server.  My change to that file wouldn't stay persistent.  So I added 8.8.8.8 as suggested by the folks at OpenVPN Access Server support.
Title: Re: No DNS cache
Post by: paul1149 on May 01, 2016, 07:56:31 PM
I finally got a chance to double-check a windows box on this LAN, and it has no problem using the router-configured DNS servers. So I think we have a bug here. But I don't see where to file it.

Basically, I expected leaving the DNS server blank in Network Connections would cause LL to look to the default gateway for DNS specs. But doing so yields no ability to find DNS at all. The DNS server must be specced in LL's Network Connections.

And speccing the default gateway, the router, as the DNS server in Network Connections works, but only with a lot of "resolving host" delays. As soon as I enter the ultimate DNS server in Network Connections, lookups are instant.

I'm on LL 2.8 x64, using an ethernet connection.
Title: Re: No DNS cache
Post by: LL-user on May 01, 2016, 09:54:45 PM
Hi paul1149,

If I'm not mistaken, I can't see in the whole thread mentioned - and therefore maybe not considered/looked at? - the DNS cache that is actually used in Ubuntu and as far as I know also in LL: dnsmasq (https://help.ubuntu.com/community/Dnsmasq)

Have you checked this?

Hope that helps solve the riddles :)
Title: Re: No DNS cache
Post by: paul1149 on May 01, 2016, 10:03:38 PM
Hi LL-user,

Isn't that for setting up a DNS server? And if it were the problem here, wouldn't placing the remote DNS server directly in Network Connections not make a difference?
Title: Re: No DNS cache
Post by: torreydale on May 01, 2016, 10:07:46 PM
You can report a bug by going to the main Linux Lite website (www.linuxliteos.com).  Under the Support section, there is a link for Bugs.
Title: Re: No DNS cache
Post by: Jerry on May 01, 2016, 10:45:12 PM
There's no need to report this in our 'Bugs' section. The answer lies at the user end or with the actual software ( Ubuntu maintainer)
Title: Re: No DNS cache
Post by: paul1149 on May 01, 2016, 10:46:31 PM
Ok. too late. I just filed it.
Title: Re: No DNS cache
Post by: LL-user on May 01, 2016, 11:48:36 PM
Hi LL-user,

Isn't that for setting up a DNS server? And if it were the problem here, wouldn't placing the remote DNS server directly in Network Connections not make a difference?

As I understand it dnsmasq is a local DNS cache/ caching DNS proxy. Beside that it could also provide a DHCP/TDTP server and a local DNS server in addition to an existing global DNS server.

BUT: We have only dnsmasq-base installed. Dnsmasq would interfere with Network Manager (also mentioned in the link I posted.) That means, we have no daemon (service) running.

If you have a look at /etc/NetworkManager/NetworkManager.conf you'll see dnsmasq configured for DNS. You can also find the dnsmasq running on your system.

It's quite some time I tested different setups/configurations. Sorry, can't remember on top of my head and don't have my notes available at the moment.