SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
i have a nb5plus4w modem/router at home which acts as a dhcp server on my lan. upon connection it instructs the clients to use 192.168.1.1 as a dns server (which is the ip address of the router) and linux machines are happy to use that in /etc/resolv.conf.
now the issue is that under these conditions dns resolution is sloooow. there have been some discussions on the net saying that the router is not a 'real' dns server (don't know what that means), but the only way i have been able to get around the issue is to edit /etc/resolv.conf to use my isp's dns servers and then chattr -i the file so that dhcpcd doesn't change it.
this approach works for the desktop and even though it is ugly it's effective. the laptop is a different issue. if i take it out of the house i have to chattr -i and let the new network put it's dns addresses in and then change it all back when i get home....
so, the question is... can i do something to stop doing chattr and get the dns performance of a windows machine (dns resolution is quick on the windows machines)?
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541
Rep:
You'd probably be better off using two or so free public DNS servers (in /etc/resolv.conf) that the router -- routers tend (not always, but tend) to not update after a while and you lose DNS.
Try a couple of the DNS servers from http://theos.in/windows-xp/free-fast...ns-server-list (there are many other sites that list public DNS servers). Use ping on some of the addresses and find a couple that are electrically close to you (you're looking for the shortest times) then put them in /etc/resolv.conf like so
Code:
search com
nameserver xx.xx.xx.x
nameserver xx.xx.xx.x
You want two in case the first goes away; more than two is overkill.
You'd probably be better off using two or so free public DNS servers
doesn't really solve my problem... when i take the laptop to work i'm behind proxy so external dns servers won't work... i'd really like to use whatever dns the dhcp server on the router tells me to use (the router itself i most cases). i'd like to get to the bottom of why a windows machine can perform fast dns resolution and a linux box cannot (and they both use the router as a dns server).
now the issue is that under these conditions dns resolution is sloooow. there have been some discussions on the net saying that the router is not a 'real' dns server (don't know what that means),
Some people probably don't think that a caching only DNS server is really a DNS server...but then some people don't know what they are talking about and, from what you have said, caching is all you need.
That said, there is not much memory in an appliance box, such as a router, and it is probably the case that it cannot keep many entries in its cache: in normal usage this is probably not a big problem, but you can almost certainly come with use cases in which a bigger cache is an advantage.
Quote:
but the only way i have been able to get around the issue is to edit /etc/resolv.conf to use my isp's dns servers and then chattr -i the file so that dhcpcd doesn't change it.
...a bit brutal, but if it works, it works... some ISP's DNS servers are either a bit slow or a bit erratic in performance, but if yours are OK, that's fine.
There are applications particularly for benchmarking DNS. I like this one (DNS Benchmark), but its a windows program that runs under wine. Alternatively, you could try this (namebench).
Quote:
reply from unexpected source: 192.168.1.1#2048, expected 192.168.1.1#53
That is odd; I don't know why that would happen, unless you have done something particularly odd to cause it. Why a query on port 53 does not cause a response on port 53 is intriguing.
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541
Rep:
Windows, as I understand it, caches DNS on the box -- which is OK until there is some kind of problem (it caches both valid and invalid entries). Thus, after a few tries, Windows is "quicker." If you really care about what Windows is doing, take a look at http://www.updatexp.com/dns-windows-xp.html and see what you think.
Don't know about your router but I suspect that you can enter DNS server addresses in its setup (you can with a Cisco/Linksys) and that should be just about as fast as his little feet will run. The router may or may not cache from those entries (as far as I can tell Linksys does not); hopefully it does not unless it updates its DNS cache every few hours.
If you do this, you don't need any entries in /etc/resolv.conf save the initial
Code:
search your-domain-name
That entry is made during system installation from /etc/HOSTNAME for you.
You might want to ping the DNS address your ISP gave you and compare that against, say, the Google DNS servers (8.8.8.8 and 8.8.4.4); put the shortest response time first, followed by one or two others.
I use fixed-IP addressing for all my systems so I really have no idea how DHCP would be affected by having DNS entries in the router's setup but I suspect that the performance might be similar to what I experience with copper wire ADSL; i.e., quick. When I am off in the boonies using either dial-up or a Verizon wi-fi thingie KPPP automagically adds a temporary DNS entry (or two) to /etc/resolv.con (I have to use loopback for dial-up or wi-fi but the same thing happens at public library that requires DHCP -- a temporary DNS entry in /etc/resolv.conf).
Some people probably don't think that a caching only DNS server is really a DNS server...but then some people don't know what they are talking about and, from what you have said, caching is all you need.
If you don't have a domain name to serve authoritatively, then caching is all you need to do for DNS.
I had a similar experience with a Linksys router, and I didn't want to change my network settings to use a fixed /etc/resolv.conf, so what I did was to configure the router to give me a different DNS server. In the control panel, I told it to give me Google's DNS cache. For Linksys, this is in "Setup > Basic Setup > Static DNS Server 1/2/3". Maybe your router has a similar option. Now when dhcpcd writes the contents of /etc/resolv.conf, I get this:
Code:
# Generated by dhcpcd from eth0
# /etc/resolv.conf.head can replace this line
nameserver 8.8.8.8
nameserver 8.8.4.4
# /etc/resolv.conf.tail can replace this line
Windows, as I understand it, caches DNS on the box -- which is OK until there is some kind of problem (it caches both valid and invalid entries). Thus, after a few tries, Windows is "quicker." If you really care about what Windows is doing, take a look at http://www.updatexp.com/dns-windows-xp.html and see what you think.
According to that URL
Quote:
There is ALSO another potential pitfall with the Windows XP DNS cache...
Most ISP's and Domain name registrar's now update their DNS information (TTL) every 4 hours instead of the twice daily updates that were common few years ago.
This means that your DNS Windows XP cache may be out of date for certain entries!
It is perfectly legitimate to cache DNS look-ups, if you do it right, but this isn't doing it right.
IIRC, every DNS entry has a 'time to live'. Any step along the chain can keep it until the time to live runs out and then must discard it (obviously, preserving the TTL value, if it is passed on to a requester further down the chain). This is particularly useful if you are managing servers and need to shift things around; you can set a TTL that lets things hold on to the old server address until the server swap occurs, and you can even get something like PDNS to do the time calculations for you.
For an endpoint to decide that some particular time, rather than the specified TTL, is the time to keep stuff in the cache is a bit risky and against the requirements of the relevant RFC.
If you want to do this correctly, you run a caching DNS server locally*. AFAIK all of the popular candidates (Dnsmasq, maradns, powerdns, djbdns and even BIND) do respect the TTL values....and do what windows does, but do it properly. OK, you do have to run a separate program, but, with the possible exception of BIND, it is not hard.
* to run it locally is on your side of the bottleneck (the high latency part of the network). It might be on your router, if you run a replacement router firmware (DD-WRT, tomato, etc) it could be on a server on your network, it could be on your workstation - the most appropriate will depend on your usage pattern and network. But, as I say, your existing router is probably running a small DNS cache, and if it goes to a reasonably quick upstream server (which need not be your ISP, but that is probably your default) then you'll probably not see a big improvement. OTOH, if your upstream server is v. slow, and some are, there might be a reasonable win from this.
i would have solved my problem ages ago if i actually read what is on my laptop screen and just stared at it like a tool.
wicd allows for static dns to be specified for a particular connection! so i have undone all the stupid chattr +i /etc/resolv.conf crap and specified my isp's dns servers in wicd for my home wireless and eth0 (as my home lan is the only lan causing the problem) and it's all good.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.