WSL: DNS not working in fresh Ubuntu 18.04 that installed from Windows Store
-
Your Windows build number: 10.0.16299.431
-
What you’re doing and what’s happening: Ubuntu 18.04 installed from Windows Store can not resolve domain names.
ping xxx.xxx.xxx.xxx works fine, but ping baidu.com does not work.
ifconfig returns following result:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.17.62.113 netmask 255.255.255.240 broadcast 172.17.62.127
inet6 fe80::388c:7783:48bc:85c5 prefixlen 64 scopeid 0x0<global>
ether a6:15:d1:58:04:82 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.192 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 2402:f000:9:ce01:3520:9468:2982:8e90 prefixlen 64 scopeid 0x0<global>
inet6 2402:f000:9:ce01:c086:34b5:b28a:6a5a prefixlen 128 scopeid 0x0<global>
inet6 fe80::3520:9468:2982:8e90 prefixlen 64 scopeid 0x0<global>
ether 1c:1b:0d:82:76:36 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 1500
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x0<global>
loop (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
sudo systemctl status resolvconf returns:
System has not been booted with systemd as init system (PID 1). Can't operate.
The content of /etc/resolv.conf is:
# This file was automatically generated by WSL. To stop automatic generation of this file, remove this line.
nameserver 192.168.1.1
nameserver fec0:0:0:ffff::1
nameserver fec0:0:0:ffff::2
search lan
192.168.1.1 is my router’s ip address.
At the same time, everything works fine in Ubuntu 16.04 installed from Windows Store works fine.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 6
- Comments: 92 (1 by maintainers)
Hello, I have encountered the same issue. After clean install of Ubuntu from the store, DNS resolution does not work (eg.
apt updatefails). My/etc/resolv.confis empty except for the comment# This file was automatically generated by WSL. To stop automatic generation of this file, remove this line.. Addingnameserver 8.8.8.8to the file immediately fixes the problem, but is not permanent – even after removing the comment, the file is still regenerated.The complete process:
The only working permanent workaround I have found is:
This seems to be successfully preserved after restarts of WSL.
To restore
/etc/resolv.conf, add this line to the top of the file:Then close all bash windows and open a fresh one. Open up
/etc/resolv.confand you should see auto-generated entries.try sudo vi /etc/resolv.conf
I have resolved my issue by deleting Checkpoint VPN Client. Now it works correctly.
Just mentioning #469 here, because for some people there antivirus / firewall settings did interfere.
It also may be worthwhile to post the complete (failing) output of just
ping baidu.comAnd, perhaps, try updating your version of Windows to the latest Windows 10 release, in case that is possible?
today, I meet the same problem, all domain in wsl will resolve to 192.168.0.52 ,This is not correct. I don’t konw what’s wrong.
Finally,I edit /etc/resolv.conf ,I ease the nameserver 127.0.0.1 53, use the public dns server and
everything looks fine .
Last, I find this in cause by EasyConnect that a ssl vpn clinet made by Sangfor(http://www.sangfor.com.cn/),Which will modify windows local DNS server to 127.0.0.1:53 to it DNS process.
@nhoclove Sadly, for me the problem is occurring without ever using a proxy. Also, it affects all programs, not just
apt.Just upgrade to Windows 1803. Ubuntu 18.04 works fine now.
Hi folks, we have put out a new update that aims to address networking issues in WSL. In your
.wslconfigfile you can setexperimental.networkingMode=mirrored, as well as some other key settings that should improve your network compatibility! Please try them out and let us know what you think.More info on this release and the changes can be found here in the blog post.
Please note: You need to be on a Windows Insiders version to use the new networking settings (Any channel of Windows Insiders will do, including release preview). If you see the “These are not supported” messages it means that your current Windows version doesn’t have support, and you will need to upgrade. These features will eventually be coming to Windows 11 22H2.
Please use the megathread for more DNS discussion: #8365
The issue seems to correlate with truncation of UDP DNS responses, at least in my case - all DNS responses that are reported by nslookup as trucated are triggering the same “Temporary” resolution issue in ping (and node)
@rellbits I have checked my router config and it already has my ISP DNS servers set for primary and secondary. That’s the default and can’t be changed.
I tried to turn off
Enable IPv6 on LAN sideandEnable IPv6 DHCP Serverbut that didn’t change the WSL DNS Servers. I can’t see any other advanced settings to change.I’m not sure how the WSL DNS Servers get those addresses, but I’ll look into more about that. Thank you for pointing me in the right direction.
EDIT I went into
network & sharing center, right clicked onvEthernet WSL Adapter, clickedproperties, selectedInternet Protocol Version 4 (TCP/IPv4), clickedProperties. In there I can set Google’s DNS 8.8.8.8 & 8.8.4.4. Did the same for Wireless LAN adapter.Now in Powershell
ipconfig/alldisplays Google’s DNS addresses, but this still does not fix the problem. I will keep trying differemt config and solutions and update here if I find something.I don’t understanding networking very well, so diffiuclt for me to say if all of this is correct. I see that DHCP is disabled on the wsl adapter, I’m not sure if it should be enabled.
Here’s the output of
ipconfig /all(I’ve removed the irrelevant adapter information like bluetooth adapter)I got aware of other issues like this one caused by firewalls as @onewnan said.
Moreover, I would like to know if there’s any solution for those who don’t have access to firewall configs (i.e. people using companies laptops which doesn’t have admin access).
Just had this problem, same as @VMatrix1900. Couldn’t run
apt updatewithout error.lxrungave error when uninstalling WSL. Had to go to Control Panel -> Enable or Disable Windows Features and uninstall from there.After uninstalling WSL-reboot-install WSL-reboot, it worked.
I am on 1803. That’s when the problem started, after the upgrade.
Owen
https://sites.google.com/site/owennewnan/
On Sun, Jul 1, 2018 at 4:16 AM Vincent Stone notifications@github.com wrote:
@3antrt67
apt-get updateoutput:strace apt-get updateoutput:@3antrt67 DNS is not working for
apt-geteither. I can runping baidu.comsuccessfully through Windowscmdandpowershell.I would certainly recommend running through at least
apt-get update.Also just to clarify, can you run
ping baidu.comsuccessfully through Windowscmdorpowershell?