0

I recently installed a proper router on my home network, one which enables local DNS names to propagate around the local network.

I have a set of local machines. Some of these are servers.

I can ping the servers from a Windows CMD prompt. For example ping HOSTNAME works.

I cannot ping these servers from within WSL. WSL is currently set with everything to the default, I just installed it today.

I can ping HOSTNAME.local from WSL, however.

Why is this, and is there a way to configure WSL such that I can ping HOSTNAME instead of needing to type HOSTNAME.local?


Side note. (For Mikrotik devices.)

ping HOSTNAME used to work from Windows. Now it is no longer working. Some searching suggests that Mikrotik devices will not retain DNS entries for devices configured with a static IP address. (Configured static via Mikrotik.)

Static DNS entries are also required.

I have now added these, and the results are the same. In other words, the question is unchanged by this additional configuration.


wsl.conf

[boot]
systemd=true

[user]
default=user
10
  • 1
    Please use Wireshark or nslookup (on Windows) to verify whether your ping HOSTNAME is actually getting a DNS result from the router, or whether it is only getting an mDNS result directly from the other host. Commented Sep 2 at 18:13
  • @grawity, nslookup reports Server: router.lan, Address: 192.168.1.1 which is the address of the router. However it also says "can't find HOSTNAME.local" Non-existent domain. I think that the fact the router thinks the local domain name should end with .lan instead of .local might be the cause of the issue. It is a Mikrotik device, so I will see if I can figure out how to change this. Commented Sep 2 at 19:33
  • 1
    1) What suffix do the actual 'static' DNS entries have in the router; 2) what is the 'domain' parameter being advertised by the DHCP server (under Networks), 3) what "Primary DNS Suffix" and what "DNS Suffix Search List" do you have in ipconfig /all on Windows, and 4) what search or domain suffixes you have in /etc/resolv.conf on Linux? Commented Sep 2 at 19:40
  • @grawity 1) They have no suffix as far as I am aware. If I go to "IP">"ARP" I see hostnames with no suffix. 2) "IP">"DHCP Server">"Networks" domain is blank. 3) "Connection-specific DNS Suffix" is blank. I don't see any other relevant lines here. Unrelated but "DHCP Server" is set to 192.168.88.1 (wtf?) 4) None. /etc/resolv.conf contains only nameserver 10.255.255.254 Commented Sep 2 at 19:47
  • 1
    Post your WSL configuration file by editing your question. Please do not respond if you are going to NOT provide the information I requested. Commented Sep 2 at 22:45

1 Answer 1

4

I'm guessing one of these two:

First, it sounds like you might not actually have internal DNS set up. Although Mikrotik RouterOS does record the hostnames from hosts' DHCP lease requests, it does not automatically copy them to static DNS entries, the way a typical home router would. You can make it do this by writing a custom lease-script=, but it is not out-of-the-box functionality.

Second, it sounds like your router isn't advertising the correct domain (DNS suffix) via DHCP. Without that, the OS doesn't know that it should append .lan to bare hostnames.

Either way, when Windows finds no result in regular DNS, it will instead try a direct broadcast query using mDNS (aka Multicast DNS, aka Bonjour, aka Avahi).

The behavior of Linux and Windows differs at that point – other mDNS implementations (Linux, iOS, macOS) require the .local suffix to be explicitly specified, while Windows will also use mDNS for suffixless hostnames (automatically adding it under the hood); this is mostly to provide easy transition from obsolete NetBIOS to mDNS. In short, Linux won't use mDNS for suffixless names while Windows will.

Make sure that

  1. entries under /ip/dns/static actually exist,

  2. entries under /ip/dns/static have the suffix you want (e.g. foobar.home.arpa to use the officially allocated one, or foobar.lan otherwise),

  3. the DHCP server configuration under /ip/dhcp-server/network announces that suffix as the domain parameter (to be seen in ipconfig /all and in /etc/resolv.conf)

and strongly avoid using .local as the internal DNS suffix – it is exclusively the mDNS suffix.

5
  • Thanks for this, let me try - I have now added the suffix .lan to every entry in /ip/dns/static Commented Sep 3 at 6:12
  • Ok interesting, with these changes I can now ping my hostnames using both HOSTNAME and HOSTNAME.lan. dig HOSTNAME does not work. dig HOSTNAME.lan reports HOSTNAME.lan. 86400 IN A 192.168.1.X. nslookup HOSTNAME and nslookup HOSTNAME.lan both report exactly the same information. Name: HOSTNAME.lan\n Address: 192.168.1.X All these commands were run within WSL. Commented Sep 3 at 6:17
  • That sounds good. Use dig +search if you want it to honor the resolv.conf "search" list. (Dig is generally the type of testing/debugging tool where "do exactly what's requested" is the preferred behavior, whereas nslookup and host are more of user-facing tools so they honor the search list by default.) The announced suffix is appended client-side, so HOSTNAME.lan is what all your programs are actually querying – the DNS server isn't supposed to answer to just HOSTNAME anyway. Commented Sep 3 at 6:23
  • (As a side thought, I've seen people use their internal DNS without a suffix at all, but it seems that just tends to lead to headaches and incompatibilities more often than not. So if you can have a suffix like .lan or .home.arpa then it's better to have it.) Commented Sep 3 at 6:24
  • Ok interesting, thanks again. dig +search HOSTNAME appears to be searching for HOSTNAME.lan and therefore it finds the correct address. Commented Sep 3 at 6:27

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.