]> Posts for January 2019 🌐:aligrant.com

DNS fails in openSUSE WSL app

Alastair Grant | Saturday 19 January 2019

I've been using openSUSE Leap 15.0 from the Windows Store on Windows Subsystem for Linux (WSL) for a while now, it's a really useful way to get a nice bash environment with Linux utilities without resorting to a virtual machine.

Recently though I have been unable to resolve DNS names, e.g. dig www.google.co.uk wouldn't resolve anything.  Though if I specified a nameserver dig www.google.co.uk @8.8.8.8, it would work fine.  Clearly, something has gone wrong with the name server configuration.

How does name server configuration even work in WSL?  I had no idea.  Normally this is something either configured manually on your network stack, or obtained via DHCP.  WSL isn't a virtual machine, it doesn't have its own network interfaces that get their own configuration.  Either way, I assumed the fundamentals would be the same, and took a look at /etc/resolv.conf - this is traditionally the place where the name resolution, such as list of name servers, is stored in Linux.

It looked pretty corrupt, with a bunch of unprintable characters - maybe something weird for WSL?  I threw caution to the wind and renamed the file and restarted my WSL app.  I then checked the file again, things looked more familar:

# This file was automatically generated by WSL. To stop automatic generation of this file, remove this line.
nameserver x.x.x.x
search xxx yyy zzz

And it seems we've learnt how name resolution works in WSL.  I haven't tried different distributions to see if they do anything differently, of if this is a part of WSL itself.

Breaking from the voyeuristic norms of the Internet, any comments can be made in private by contacting me.

Entries for: January 2019

Previous Next