Solved

configuring a DNS client

Posted on 2004-10-24
269 Views
Last Modified: 2013-12-15
My linux server cannot resolve domain names, though it has no trouble connecting to remote ip addresses. The router between it and the internet seems to providing the server with the addresses of valid DNS servers, and the server successfully stores these addresses in /etc/resolv.conf. I'm fairly sure the router is correctly configured, because another machine (this one a windows machine) I've connected to the router has no trouble resolving domain names. Any suggestions as to which of my servers settings need to be modifed?

Thanks.
0
Question by:bobwood2000
    16 Comments
     
    LVL 38

    Expert Comment

    by:wesly_chen
    Hi,

        What do you mean the remote IP addresses? Are those internet IP addresses or private addresses such your router?

       First, please try to ping the IP address of www.yahoo.com (66.94.230.38) to see if your Linux server can ping the ineternet.
    If not, please check your default gateway setting by typing "netstat -rn". Make sure you can ping 66.94.230.38 first.

       Second, can your Linux server ping the IP address of DNS server which are in the /etc/resolv.conf? If you can ping the internet
    IP addresses but can not ping DNS server, then either the DNS server down or the IP of DNS server is wrong. Since the Linux server
    use DHCP to get address, you may need to check the DHCP server(on router?) to make sure you can ping the DNS server on the
    DHCP server.

       If those steps cannot fix your problem, then please provide your content of /etc/resolv.conf and the output of "netstat -rn" as well as your
    router's IP address. Those can help people to trace the problem.

    Regards,

    Wesly
    0
     
    LVL 38

    Expert Comment

    by:wesly_chen
    Hi,

         One more thing, please check /etc/nsswitch.conf. Make sure there is "dns" in "hosts: files dns" so it will querry the dns.

    Wesly
    0
     

    Author Comment

    by:bobwood2000
    I should have said "external ip addresses" rather than "remote ip addresses". I have no trouble pinging or otherwise connecting to any ip addresses, internal or external. I also have no trouble pinging the dns servers in /etc/resolv.conf. The gateway router (192.168.1.1) appears to be correctly reported by netstat.

    # cat /etc/resolv.conf
    search
    nameserver 199.166.28.10
    nameserver 199.5.157.128
    nameserver 199.166.29.3

    # netstat -rn
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
    192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0
    0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 eth0
    0
     

    Author Comment

    by:bobwood2000
    Also, my /etc/resolv.conf file contains the line "hosts: files dns".
    0
     
    LVL 38

    Expert Comment

    by:wesly_chen
    Ok, the next step is check the firewall setting on your Linux box if you have one.
    iptables or ipchains are the softwares to limit the network access in/out your Linux box.
    Please turn it off by the following commands:
    service iptables stop
    service ipchains stop
    And then turn then off on the boot-up
    chkconfig --level 2345 iptables off
    chkconfig --level 2345 ipchains off

    One more thing, please check the nameservers in /etc/resolv.conf is the same as what you got in Windows (ipconofig /all).
    And its file permission is 644 (-rw-r--r--).

    Wesly
    0
     

    Author Comment

    by:bobwood2000
    ipchains and iptables were installed, but not active. I removed them just to be sure, such the commands "apt-get remove iptables" and "apt-get remove ipchains". It's really a very minimalist linux installation by now. Here's the output of ps -ax. There is no sign of any extra services running, that I can see.

    # ps -ax
    Warning: bad syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
      PID TTY      STAT   TIME COMMAND
        1 ?        S      0:00 init [2]
        2 ?        S      0:00 [keventd]
        3 ?        SN     0:00 [ksoftirqd_CPU0]
        4 ?        S      0:00 [kswapd]
        5 ?        S      0:00 [bdflush]
        6 ?        S      0:00 [kupdated]
       18 ?        S      0:00 [ahc_dv_0]
       19 ?        S      0:00 [ahc_dv_1]
       20 ?        S      0:00 [scsi_eh_0]
       21 ?        S      0:00 [scsi_eh_1]
       23 ?        S      0:00 [scsi_eh_2]
       59 ?        S      0:00 [kjournald]
      350 ?        S      0:00 [khubd]
      649 ?        Ss     0:00 /sbin/syslogd
      652 ?        Ss     0:00 /sbin/klogd
      683 ?        Ss     0:00 /usr/sbin/exim4 -bd -q30m
      688 ?        Ss     0:00 /usr/sbin/inetd
      787 ?        Ss     0:00 /usr/sbin/sshd
      791 ?        Ss     0:00 /usr/sbin/atd
      794 ?        Ss     0:00 /usr/sbin/cron
      811 tty1     Ss+    0:00 -bash
      812 tty2     Ss+    0:00 /sbin/getty 38400 tty2
      813 tty3     Ss+    0:00 /sbin/getty 38400 tty3
      814 tty4     Ss+    0:00 /sbin/getty 38400 tty4
      815 tty5     Ss+    0:00 /sbin/getty 38400 tty5
      816 tty6     Ss+    0:00 /sbin/getty 38400 tty6
     3917 ?        Rs     0:00 sshd: root@pts/0
     3920 pts/0    Ss     0:00 -bash
     5426 pts/0    R+     0:00 ps -ax
    0
     

    Author Comment

    by:bobwood2000
    /etc/resolv has 644 permissions.

    # ls -l resolv.conf
    -rw-r--r--  1 root root 74 Oct 25 13:57 resolv.conf

    The dns servers are the same as my received when my windows box connected via dhcp to the router. I think I'm no longer using dhcp however, because I wanted the linux server to get the same internal ip (192.168....) each time. Still, the dns servers in resolv.conf are the same publically available servers that worked with a windows box.

    Thanks for sticking with me through this.
    0
     
    LVL 38

    Expert Comment

    by:wesly_chen
    Well, which Linux distro do you use?

    Wesly
    0
     

    Author Comment

    by:bobwood2000
    Debian.
    0
     
    LVL 38

    Expert Comment

    by:wesly_chen
    OK, no matter what distro you have, let's go for "nslookup" to debug DNS.
    Please type in "nslookup" and you will get ">" prompt.
    Then type in "server 199.166.28.10" and Enter.
    Then type in "www.yahoo.com" and Enter.
    Please give me the output of the result.

    Thanks,

    Wesly
    0
     

    Author Comment

    by:bobwood2000
    I've never used nslookup before, so I don't know what any of this output means:

    # nslookup
    Note:  nslookup is deprecated and may be removed from future releases.
    Consider using the `dig' or `host' programs instead.  Run nslookup with
    the `-sil[ent]' option to prevent this message from appearing.
    > server 199.166.28.10
    Default server: 199.166.28.10
    Address: 199.166.28.10#53
    > www.yahoo.com
    Server:         199.166.28.10
    Address:        199.166.28.10#53

    Non-authoritative answer:
    *** Can't find www.yahoo.com: No answer
    >
    0
     
    LVL 38

    Expert Comment

    by:wesly_chen
    Can you do the same thing in the Windows command prompt?

    I suspect the UDP port 53 on your Linux box has some issue.
    Check the /etc/services to check whether is TCP 53 and UDP 53 such as:
    --------------------
    domain             53/tcp                           #Domain Name Server
    domain             53/udp                           #Domain Name Server
    --------------------

    Wesly
    0
     

    Author Comment

    by:bobwood2000
    Unfortunately I don't have access to that Windows box any more.

    The /etc/services file seems to have something like what you said.  What should I make of this?

    # grep nameserver /etc/services
    nameserver      42/tcp          name            # IEN 116
    domain          53/tcp          nameserver      # name-domain server
    domain          53/udp          nameserver
    0
     
    LVL 38

    Accepted Solution

    by:
    Do you have a internal DNS server?
    Try to use "nslookup" and set the "> server" to the IP of internal server.
    Or can you have another Windows PC on the network to test the nslookup.

    Wesly
    0
     

    Author Comment

    by:bobwood2000
    Just reinstalling Linux seems to have worked. Thanks for all your help.
    0
     
    LVL 38

    Expert Comment

    by:wesly_chen
    Well, it seems like some of shared libraries used by dns query are corrupted.
    Anyway, glad to nnow your problem is resolved.

    Wesly
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
    How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
    Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

    846 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now