LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-12-2002, 10:56 PM   #1
Zil
LQ Newbie
 
Registered: Mar 2002
Distribution: Mandrake 8.1
Posts: 3

Rep: Reputation: 0
DNS getting queried everytime I open a program


My computer slows down a lot when I open programs when my network connection is physically removed. When I reconnect my cable to my network card, the problem goes away. The problem only affects opening desktop programs with KDE or Gnome. Stuff like grep and ls in the terminal aren't affected at all.

I started using iptables lately, and I logged my output packets. I noticed that everytime I open a desktop program, three packets are being sent out. Two of them are on my loopback interface from 127.0.0.1 to the same address, and the third is sent to my DNS server on port 53 with UDP on my ethernet connection. I guessed that the reason my computer slows down opening programs without my ethernet connected is because the packet to the DNS server has to wait to timeout before it will let me open a program. My question is why is a packet getting sent out to my DNS server whenever I open a program, and how do I stop it?

Filtering out the packet with iptables doesn't do anything except make my computer slow even when my connection is still plugged in. Removing the nameserver from etc/hosts causes my browser not to be able to translate domain names, but the packet will still be sent out nevertheless. Completely stopping my network with /etc/rc.d/init.d/network stop will stop the packet to my DNS server and also the two packets from my loopback device from being sent, but of course stops any internet use at all.

I'm using Mandrake 8.1 on a 2.4.17 Kernel, and I use DHCP to get my IP and DNS address for my cable modem. Any help would be greatly appreciated.

Last edited by Zil; 03-12-2002 at 10:58 PM.
 
Old 03-13-2002, 04:16 AM   #2
Mik
Senior Member
 
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316

Rep: Reputation: 47
Well it definetly looks like it tries to resolve the hostname when it starts a program. It needs to connect to the local x server and it's probably wants the hostname for that.
If you look in the file /etc/nsswitch.conf at the line for hostnames you'll see how the dns name gets resolved. I think in mandrake the default was something like:
files nisplus nis dns

That would mean for files it would look in /etc/hosts but it can't find the hostname there so it goes on to the next. Then it sends the two packets which you logged to find the nisplus and the nis servers but I doubt you have them installed so it just continues and goes on to your dns which is the udp packet on port 53. You use the dns server you got from your isp through dhcp. And that dns server knows nothing about your hostname so it will just timeout making you wait all that time.
So if you make sure your /etc/hosts contains the hostname it's trying to look for then it will find it right away.
 
Old 03-13-2002, 02:54 PM   #3
Zil
LQ Newbie
 
Registered: Mar 2002
Distribution: Mandrake 8.1
Posts: 3

Original Poster
Rep: Reputation: 0
How do I found how what program is trying to resolve this hostname? I've looked around XF86Config and I haven't seen anything obvious I should change. Whatever is trying to resolve this hostname is never getting it resolved, so it is probably ok to delete, I think, but how do I find out what it is? Or how do I find out what hostname is trying to be resolved so I put that in my hosts file?
 
Old 03-14-2002, 06:56 AM   #4
Mik
Senior Member
 
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316

Rep: Reputation: 47
Well it's most likely looking for either localhost or the hostname. You can find out what the hostname is by running hostname in a terminal. Make sure you have at least the following line in your /etc/hosts file:

127.0.0.1 localhost.localdomain localhost

You can add the hostname to the end of that line to let it resolve that one to.

If that doesn't help then you could use tcpdump or something like that to log the udp packets on port 53 going outwards. And try and see what kind of dns request it's trying to do.
 
Old 03-14-2002, 10:31 AM   #5
jrmann1999
Member
 
Registered: Feb 2001
Location: Texas
Distribution: Slackware, Mandrake, LFS
Posts: 306

Rep: Reputation: 30
Another thing to think about is this. By default X-Windows uses network connectivity to communicate across itself. It loads a set of core binaries to get up and running, and then uses network access to communicate with other programs(for things like KDE and GNOME this is probably 8-9 apps communicating). Most of the time it uses named pipes or the special X11 protocols to do this, but it's not uncommon for it to try vanilla tcp/ip to do so.
 
Old 03-14-2002, 02:47 PM   #6
Zil
LQ Newbie
 
Registered: Mar 2002
Distribution: Mandrake 8.1
Posts: 3

Original Poster
Rep: Reputation: 0
Whoo hoo! I finally found out what was happening. I got tcpdump and checked out the packet that was going to my DNS server and saw it was a query for my own hostname. The hostname I had was my own name, but I don't remember ever setting it to that. I did a search with grep -r though my /etc and the name never came up. Changing it with the hostname command would only change it for that logon too, which was a tad annoying. I found out how to change it from searching on the net, and then put a line in hosts to search at 127.0.0.1 for my new hostname, and there we go. No more extra packets searching for a resolution that will never come.

Thanks for all the help everyone.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to open up firewall for DNS? jdupre Fedora 1 03-15-2005 08:18 AM
Why does Linux do a DNS lookup everytime I start an application? Bandhel Linux - Networking 2 02-23-2004 07:08 AM
Why does Mandrake do a DNS lookup everytime I start an application? Bandhel Mandriva 1 02-23-2004 05:17 AM
mozilla dies everytime i am trying to open page with flash content deteriorator Linux - Newbie 1 01-06-2004 10:17 AM
how to open port 53 (DNS)? importboy03 Linux - Security 3 02-07-2003 03:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration