DNS not functioning on command line

16,397

After much investigation, I came across these threads:

The solution was to run these commands:

netsh winsock reset catalog
netsh int ipv4 reset reset.log
netsh int ipv6 reset reset.log
Share:
16,397

Related videos on Youtube

void.pointer
Author by

void.pointer

Updated on September 18, 2022

Comments

  • void.pointer
    void.pointer over 1 year

    I recently did a combination of Vagrant + VirtualBox stuff on my machine to try to get a virtualized Ubuntu install working. However, I had no luck with it so I just uninstalled everything. Ever since then, I've had some issues with using command line applications on my host machine.

    I'm on Windows 7 x64. DNS resolution and network connectivity seem to be fine through Chrome browser and other GUI based tools. However, when I launch cmd.exe, I notice weird behavior out of various command line tools.

    nslookup

    Executing nslookup results in inability to find IP address of basic domain names.

    C:\>nslookup google.com
    Server:  UnKnown
    Address:  10.3.1.1
    
    *** UnKnown can't find google.com: No response from server
    

    10.3.1.1 is my router, which supplies itself as the DNS server to clients via DHCP. The router forwards DNS requests to the Google DNS servers. As I said, DNS resolution is working in my browser and through many other applications so I doubt my router setup or DNS servers are the issue. I will leave out those details here to keep the topic simple.

    ping

    ping works for physical IPv4 addresses but not for hostnames.

    C:\>ping google.com
    Ping request could not find host google.com. Please check the name and try again.
    
    C:\>ping 8.8.8.8
    Pinging  with 32 bytes of data:
    Reply from 8.8.8.8: bytes=32 time=29ms TTL=52
    Reply from 8.8.8.8: bytes=32 time=29ms TTL=52
    Reply from 8.8.8.8: bytes=32 time=30ms TTL=52
    Reply from 8.8.8.8: bytes=32 time=29ms TTL=52
    
    Ping statistics for _`&:
        Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
    Approximate round trip times in milli-seconds:
        Minimum = 29ms, Maximum = 30ms, Average = 29ms
    

    netstat

    Now here's where it gets interesting. When I run the netstat command, the Local Address field is empty, although IPv6 addresses still show up. It's just the IPv4 ones that do not. This was working fine before!

    C:\>netstat -ano
    
    Active Connections
    
      Proto  Local Address          Foreign Address        State           PID
      TCP                                                  LISTENING       4
      TCP                                                  LISTENING       544
      TCP                                                  LISTENING       904
      TCP                                                  LISTENING       616
      TCP                                                  LISTENING       4556
      TCP                                                  LISTENING       6756
      TCP                                                  LISTENING       1080
      TCP                                                  LISTENING       4
      TCP                                                  LISTENING       3612
      TCP                                                  LISTENING       3436
      TCP                                                  LISTENING       3436
      TCP                                                  LISTENING       4
      TCP                                                  ESTABLISHED     4
      TCP                                                  ESTABLISHED     5196
      TCP                                                  ESTABLISHED     2944
      TCP                                                  ESTABLISHED     1444
      TCP                                                  ESTABLISHED     3436
      TCP                                                  ESTABLISHED     2944
      TCP                                                  ESTABLISHED     2944
      TCP                                                  ESTABLISHED     2944
      TCP                                                  ESTABLISHED     2944
      TCP                                                  CLOSE_WAIT      3612
      TCP                                                  CLOSE_WAIT      3612
      TCP                                                  CLOSE_WAIT      3612
      TCP                                                  CLOSE_WAIT      3612
      TCP                                                  CLOSE_WAIT      3612
      TCP                                                  CLOSE_WAIT      3612
      TCP                                                  ESTABLISHED     3612
      TCP                                                  ESTABLISHED     2944
      TCP                                                  ESTABLISHED     2944
      TCP                                                  ESTABLISHED     2944
      TCP                                                  ESTABLISHED     2944
      TCP                                                  ESTABLISHED     2944
      TCP                                                  ESTABLISHED     2944
      TCP                                                  ESTABLISHED     2944
      TCP                                                  TIME_WAIT       0
      TCP                                                  ESTABLISHED     2944
      TCP                                                  ESTABLISHED     2944
      TCP                                                  ESTABLISHED     2944
      TCP                                                  ESTABLISHED     2944
      TCP                                                  TIME_WAIT       0
      TCP                                                  ESTABLISHED     2944
      TCP                                                  LISTENING       3320
      TCP                                                  LISTENING       4576
      TCP                                                  LISTENING       5196
      TCP                                                  TIME_WAIT       0
      TCP                                                  TIME_WAIT       0
      TCP                                                  TIME_WAIT       0
      TCP                                                  TIME_WAIT       0
      TCP                                                  TIME_WAIT       0
      TCP                                                  TIME_WAIT       0
      TCP                                                  TIME_WAIT       0
      TCP                                                  TIME_WAIT       0
      TCP                                                  TIME_WAIT       0
      TCP                                                  TIME_WAIT       0
      TCP                                                  TIME_WAIT       0
      TCP                                                  TIME_WAIT       0
      TCP                                                  TIME_WAIT       0
      TCP                                                  TIME_WAIT       0
      TCP                                                  TIME_WAIT       0
      TCP                                                  TIME_WAIT       0
      TCP                                                  TIME_WAIT       0
      TCP                                                  TIME_WAIT       0
      TCP                                                  TIME_WAIT       0
      TCP                                                  TIME_WAIT       0
      TCP                                                  TIME_WAIT       0
      TCP                                                  TIME_WAIT       0
      TCP                                                  TIME_WAIT       0
      TCP                                                  TIME_WAIT       0
      TCP                                                  TIME_WAIT       0
      TCP                                                  TIME_WAIT       0
      TCP                                                  TIME_WAIT       0
      TCP                                                  TIME_WAIT       0
      TCP                                                  TIME_WAIT       0
      TCP                                                  ESTABLISHED     4556
      TCP                                                  ESTABLISHED     4556
      TCP                                                  ESTABLISHED     6756
      TCP                                                  ESTABLISHED     6756
      TCP                                                  ESTABLISHED     3612
      TCP                                                  ESTABLISHED     3612
      TCP                                                  ESTABLISHED     3612
      TCP                                                  LISTENING       3612
      TCP                                                  LISTENING       3612
      TCP                                                  ESTABLISHED     3612
      TCP                                                  LISTENING       2960
      TCP                                                  LISTENING       2044
      TCP                                                  LISTENING       1420
      TCP                                                  LISTENING       4
      TCP                                                  LISTENING       4
      TCP    [::]:445               [::]:0                 LISTENING       4
      TCP    [::]:1025              [::]:0                 LISTENING       544
      TCP    [::]:1026              [::]:0                 LISTENING       904
      TCP    [::]:1038              [::]:0                 LISTENING       616
      TCP    [::]:3389              [::]:0                 LISTENING       1080
      TCP    [::]:3587              [::]:0                 LISTENING       5700
      TCP    [::]:5357              [::]:0                 LISTENING       4
      TCP    [::]:32400             [::]:0                 LISTENING       3436
      TCP    [::]:32401             [::]:0                 LISTENING       3436
      TCP    [::1]:1028             [::]:0                 LISTENING       1768
      UDP                           *:*                                    1000
      UDP                           *:*                                    964
      UDP                           *:*                                    964
      UDP                           *:*                                    1568
      UDP                           *:*                                    1568
      UDP                           *:*                                    1000
      UDP                           *:*                                    1080
      UDP                           *:*                                    3612
      UDP                           *:*                                    3172
      UDP                           *:*                                    3436
      UDP                           *:*                                    3436
      UDP                           *:*                                    3436
      UDP                           *:*                                    3172
      UDP                           *:*                                    2944
      UDP                           *:*                                    3436
      UDP                           *:*                                    1568
      UDP                           *:*                                    2944
      UDP                           *:*                                    2944
      UDP                           *:*                                    964
      UDP                           *:*                                    4
      UDP                           *:*                                    4
      UDP                           *:*                                    1568
      UDP                           *:*                                    3436
      UDP                           *:*                                    3436
      UDP                           *:*                                    3436
      UDP                           *:*                                    3436
      UDP                           *:*                                    3436
      UDP                           *:*                                    1568
      UDP                           *:*                                    1568
      UDP                           *:*                                    2960
      UDP                           *:*                                    3436
      UDP                           *:*                                    3436
      UDP                           *:*                                    3436
      UDP                           *:*                                    3436
      UDP                           *:*                                    1420
      UDP                           *:*                                    1568
      UDP                           *:*                                    4
      UDP                           *:*                                    4
      UDP                           *:*                                    1568
      UDP                           *:*                                    3436
      UDP                           *:*                                    3436
      UDP                           *:*                                    4
      UDP                           *:*                                    4
      UDP                           *:*                                    1568
      UDP                           *:*                                    3436
      UDP                           *:*                                    3436
      UDP    [::]:500               *:*                                    1000
      UDP    [::]:3540              *:*                                    5700
      UDP    [::]:3702              *:*                                    964
      UDP    [::]:3702              *:*                                    1568
      UDP    [::]:3702              *:*                                    964
      UDP    [::]:3702              *:*                                    1568
      UDP    [::]:4500              *:*                                    1000
      UDP    [::]:5355              *:*                                    1080
      UDP    [::]:58964             *:*                                    1568
      UDP    [::]:64135             *:*                                    964
      UDP    [::1]:1900             *:*                                    1568
      UDP    [::1]:64131            *:*                                    1568
      UDP    [fe80::2923:9898:cce9:9b60%18]:1900  *:*                                    1568
      UDP    [fe80::41ba:5355:289f:f5fa%27]:1900  *:*                                    1568
      UDP    [fe80::8c37:8952:a3d5:ca0%20]:1900  *:*                                    1568
      UDP    [fe80::8c37:8952:a3d5:ca0%20]:64130  *:*                                    1568
    

    Things I have done to try to remedy the issue:

    • Reboots
    • Uninstall NIC drivers; reinstall from motherboard manufacturer
    • ipconfig /flushdns
    • ipconfig /registerdns
    • Asked it nicely

    None of these worked. Anyone know what the issue is or steps I can take to diagnose it?

    Vagrant / VirtualBox Details

    I want this at the bottom because it's quite lengthy and potentially irrelevant. However, I want to discuss it because this is what I believe triggered this issue.

    I ran a series of Vagrant commands to install Ubuntu Trusty 32 on Virtual Box:

    $ vagrant box add ubuntu/trusty64
    $ vagrant init ubuntu/trusty64
    $ vagrant up
    

    However, it had issues with DNS resolution in the guest OS. So I set a few flags on my VM to get it working:

    C:\Program Files\Oracle\VirtualBox>VBoxManage.exe modifyvm "Ubuntu Trusty 64" --natdnshostresolver1 on
    C:\Program Files\Oracle\VirtualBox>VBoxManage.exe modifyvm "Ubuntu Trusty 64" --natdnsproxy1 on
    

    While this did resolve the DNS resolutions on Ubuntu guest OS, port forwarding still didn't work. So because it wasn't working I gave up completely and uninstalled Vagrant and VirtualBox after deleting the virtual machines it installed/setup. After this is when I noticed that command line stuff and even commands run though msys weren't working anymore. DNS resolution issues now exist in my host OS!

    EDIT

    I will amend my question with requests from comments below.

    Settings under adapter IPv4: IPv4 settings

    All available adapters on my system are below, per ipconfig /all command (The adapter named Ethernet adapter Local Area Connection is my real physical network adapter connected to the LAN).

    Also note I changed my DNS servers to 8.8.8.8 and 8.8.4.4 respectively. Normally my gateway is my DNS server (10.3.1.1). I did this to rule out any issues with my router and per someone's suggestion in the comments.

    C:\>ipconfig /all
    
    Windows IP Configuration
    
       Host Name . . . . . . . . . . . . : Robert-PC
       Primary Dns Suffix  . . . . . . . :
       Node Type . . . . . . . . . . . . : Hybrid
       IP Routing Enabled. . . . . . . . : No
       WINS Proxy Enabled. . . . . . . . : No
       DNS Suffix Search List. . . . . . : home
    
    Ethernet adapter Local Area Connection:
    
       Connection-specific DNS Suffix  . : home
       Description . . . . . . . . . . . : Qualcomm Atheros AR8151 PCI-E Gigabit Ethernet Controller (NDIS 6.20)
       Physical Address. . . . . . . . . : 90-2B-34-57-0D-24
       DHCP Enabled. . . . . . . . . . . : Yes
       Autoconfiguration Enabled . . . . : Yes
       Link-local IPv6 Address . . . . . : fe80::8c37:8952:a3d5:ca0%20(Preferred)
       IPv4 Address. . . . . . . . . . . : 10.3.1.38(Preferred)
       Subnet Mask . . . . . . . . . . . : 255.255.255.0
       Lease Obtained. . . . . . . . . . : Monday, May 25, 2015 9:35:57 PM
       Lease Expires . . . . . . . . . . : Tuesday, May 26, 2015 9:36:00 PM
       Default Gateway . . . . . . . . . : 10.3.1.1
       DHCP Server . . . . . . . . . . . : 10.3.1.1
       DNS Servers . . . . . . . . . . . : 8.8.8.8
                                           8.8.4.4
       NetBIOS over Tcpip. . . . . . . . : Enabled
    
    Ethernet adapter Local Area Connection 3:
    
       Connection-specific DNS Suffix  . :
       Description . . . . . . . . . . . : Cisco Systems VPN Adapter for 64-bit Windows
       Physical Address. . . . . . . . . : 00-05-9A-3C-78-00
       DHCP Enabled. . . . . . . . . . . : No
       Autoconfiguration Enabled . . . . : Yes
       Link-local IPv6 Address . . . . . : fe80::2923:9898:cce9:9b60%18(Preferred)
       Autoconfiguration IPv4 Address. . : 169.254.155.96(Preferred)
       Subnet Mask . . . . . . . . . . . : 255.255.0.0
       Default Gateway . . . . . . . . . :
       DHCPv6 IAID . . . . . . . . . . . : 654312858
       DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-1A-03-8A-D9-90-2B-34-57-0D-24
       DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                           fec0:0:0:ffff::2%1
                                           fec0:0:0:ffff::3%1
       NetBIOS over Tcpip. . . . . . . . : Enabled
    
    Tunnel adapter Local Area Connection* 11:
    
       Media State . . . . . . . . . . . : Media disconnected
       Connection-specific DNS Suffix  . :
       Description . . . . . . . . . . . : Teredo Tunneling Pseudo-Interface
       Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
       DHCP Enabled. . . . . . . . . . . : No
       Autoconfiguration Enabled . . . . : Yes
    
    Tunnel adapter Reusable ISATAP Interface {D85DF6F3-7D47-4198-B7B9-DD5680A8A6E7}:
    
       Media State . . . . . . . . . . . : Media disconnected
       Connection-specific DNS Suffix  . :
       Description . . . . . . . . . . . : Microsoft ISATAP Adapter #4
       Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
       DHCP Enabled. . . . . . . . . . . : No
       Autoconfiguration Enabled . . . . : Yes
    

    With my DNS manually set to Google's DNS servers, I ran nslookup (output below). Note that I am still not able to resolve hostnames using nslookup or ping after the DNS change to Google DNS servers.

    C:\>nslookup
    Default Server:  UnKnown
    Address:  8.8.8.8
    
    • Abraxas
      Abraxas almost 9 years
      When you go to your network adapter on the windows7 machine, what are the settings under ipv4?
    • Abraxas
      Abraxas almost 9 years
      So that typically happens when there is no reverse dns record/zone available. Try setting 'use the following DNS server addresses' to 8.8.8.8 or another public DNS IP. See if that works and, if so, try switching it to your router's IP. If that fails see if there are some additional settings to change in the router - perhaps provide your routers model etc.
    • void.pointer
      void.pointer almost 9 years
      @Abraxas I set Preferred and Alternate IP addresses to 8.8.8.8 and 8.8.4.4 respectively. ping google.com still doesn't work. I saved the settings and disabled/reenabled the adapter. Still nothing!
    • Abraxas
      Abraxas almost 9 years
      What happens when you just type nslookup without another argument?
    • void.pointer
      void.pointer almost 9 years
      It enters interactive mode.
    • Abraxas
      Abraxas almost 9 years
      Above that does it give a default server? Typically you'll see: Default Server and Address above that prompt - I expect this will say Unknown and your router IP. My suspicion is that you can set different default DNS servers in your router (perhaps use this to identify the best ones code.google.com/p/namebench ) and this will fix your issue.
    • void.pointer
      void.pointer almost 9 years
      It says unknown and then 8.8.8.8 below that. I don't see how this can be my router, it hasn't changed. And steam and chrome work just fine.
    • void.pointer
      void.pointer almost 9 years
      I updated my post to include the results of ipconfig /all and also nslookup after DNS servers have been manually set in adapter settings.
  • fixer1234
    fixer1234 about 7 years
    Welcome to Super User. You've got a bit of a rant going on here. The answer seems more focused on critiquing something else than providing a solution. If there is an actual solution here, it gets lost. Can you whittle this down to focus just on the solution? If you feel the need to supplement that with commentary, you can do that in a comment on your answer. Thanks.