Repository navigation
Description
Windows build number: version 2004 Build 19041.264
I've removed all WSL/WSL2 components and Docker before installing only WSL/WSL2. I have the same behaviour on 4 distributions (Ubuntu 18.04/20.04, Debian 10, Kali Linux 2020.1).
All coming lines are from Ubuntu 20.04.
When started, I cannot get any connection. eth0 interface is down and not configured:
ip addr show eth0
4: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 00:15:5d:3c:76:f7 brd ff:ff:ff:ff:ff:ff
Using ipconfig from Windows gives me information about needed network configuration:
Ethernet adapter vEthernet (WSL):
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::a0cf:c53c:da4:86ef%53
IPv4 Address. . . . . . . . . . . : 172.31.208.1
Subnet Mask . . . . . . . . . . . : 255.255.240.0
Default Gateway . . . . . . . . . :
I then manually configure eth0 and add a default route:
sudo ip address add 172.31.208.10/20 broadcast 172.31.223.255 dev eth0
sudo ip route add default via 172.31.208.1
Now the interface:
ip addr show eth0
4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:15:5d:3c:76:f7 brd ff:ff:ff:ff:ff:ff
inet 172.31.208.10/20 brd 172.31.223.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::215:5dff:fe3c:76f7/64 scope link
valid_lft forever preferred_lft forever
and the route:
ip route
default via 172.31.208.1 dev eth0
172.31.208.0/20 dev eth0 proto kernel scope link src 172.31.208.10
are correct (network connections are working).
What's not working: network is not fully configured
Expected behaviour: have inet fully configured without manual intervention. Also, the network settings change at each reboot, raising the need for this operation after each reboot.
Activity
betancour commentedon May 29, 2020
Hello Fellow Devs 😊
I had an error using WSL2 and Ubuntu 20.04
Seems like the /etc/resolv.conf generates an incorrect nameserver
adjusting this nameserver manually my connection start to working again.
I've tried to disable the auto-generation of this nameserver adjusting the /etc/wsl.conf
with:
[network] generateResolvConf = falsethis creates a linked file with .../run/resolvconf/resolv.conf that don't allows me to create a fixed one.
please let me know if you have any patch or remedy to this error.
Best regards.
skippednote commentedon May 29, 2020
Yitzhak B. Solórzano (@betancour) I set my DNS to the one being used on the host but that didn't help. I've tried solutions on the other issues and none of it has worked so far.
betancour commentedon May 29, 2020
Hi skippednote
Regarding your message
Did you use your router IP as the nameserver?
skippednote commentedon May 29, 2020
Yitzhak B. Solórzano (@betancour) By default it points to 172.20.32.1 which is Ethernet (WSL).
I've tried changing it to 8.8.8.8 as well but that didn't help either.
betancour commentedon May 29, 2020
Hi Again Bassam Ismail (@skippednote)
I've tried using Google DNS unsuccessfully.
The way that works is when I use my router ip as nameserver
Example:
skippednote commentedon May 29, 2020
Yitzhak B. Solórzano (@betancour) I'm seeing a similar output. What DNS address is working for you?
betancour commentedon May 29, 2020
Hi Bassam Ismail (@skippednote) as you can see I am using the 192.168.1.1
skippednote commentedon May 29, 2020
Yitzhak B. Solórzano (@betancour) This doesn't work for me. Only thing that work is reverting to WSL1
ericct commentedon May 29, 2020
There are two different things here:
Default is to rely on the host machine for name resolution.
/etc/resolv.confis dynamically generated when WSL2 kernel starts. One can of course set another DNS IP.But, there may also be a third problem with the firewall on the host, blocking communication for WSL2.
At the end,
apt updateproblem can have multiple reasons.skippednote commentedon May 29, 2020
ericct I don't have a VPN or Antivirus installed. I have tried with Windows Defender Firewall disabld.
skippednote commentedon May 29, 2020
Yitzhak B. Solórzano (@betancour) ericct For me it was an issue with the ISP who had disabled post routing. After enabling it internet is working fine in WSL2.
tokiedokie commentedon May 29, 2020
same here
eth0 is down every after reboot
but i configure eth0 up, eth0 can't ip addr
when i configure ip addr and route, network works fine
ericct commentedon May 29, 2020
Yes, this is the same case. I'm not alone!
It's really that the network is not fully configured, the other cases are other issues.
So, does anyone have a solution for this uncomplete network configuration (inside WSL2)?
tokiedokie commentedon May 30, 2020
clean install windows works for me.
betancour commentedon Jun 1, 2020
Anotherway is deleting the account and log again with your account to set default parameters. thanks so much.
19 remaining items
gtumanyan commentedon Jun 18, 2020
in my case, it was moved without symlink made pointing to a new location.
Thank you. My problem is solved too!
kobenauf commentedon Jul 7, 2020
Zacharias Giannadakis (@giannadakis) fix above worked for me too, but also only until I reboot.
After that
sudo apt updateworks. The problem seems to be with the ip addr wsl2 is populating in /etc/resolv.conf as the nameserver. Mine originally was this:nameserver 172.28.144.1.Is it related to some change Windows has made to permissions/firewall on that internal ip addr? The
sudo apt updatecommand used to work. I don't know what nameserver used to be set at when it used to work, because I never needed to care before.ericct commentedon Jul 9, 2020
Yes, I confirm the root cause, as explained in #5437
Better to close this one then, since it's misleading to other network issues (nameserver issues mainly).
Ritbit1111 commentedon Aug 16, 2020
Hey can you show the steps?
realasking commentedon Oct 19, 2020
This works for me. Thanks very much.
therealkenc commentedon Oct 19, 2020
/dupe #5437
TgMrP commentedon Dec 10, 2020
This works for me. Thank you very much.
EvoPulseGaming commentedon Dec 23, 2020
Internet worked once, then never again. After several days of trying things:
Reset network = no
Reset firewall = no
Manually setting IP, using ICS with the vEthernet (WSL), etc = no
Finally:
wsl --shutdown
compact /u %temp% /i /Q (I would like to point out that the temp folder itself was not compressed, but I suspect something within was.
Open device manager, remove the Hyper-V network, restart.
Suddenly its like the day I first installed wsl 2 and everything works.
OranguTech commentedon Apr 23, 2021
This was driving me nuts, thank you! (To be clear, it applied to multiple distros)
msustik commentedon Oct 18, 2021
Windows noob here. When you use % in the file or directory names is that actually part of the name?
compact /C %temp% /i /Q
returned that 0 files within 1 directories were uncompressed.
zecaoliveira commentedon Oct 26, 2021
Thank you Kyle Piira (@KylePiira) .
I disabled bitlocker but the folder %temp% was still compressed.
After turning off compression, the interface started working automatically.