Skip to content

[WSL2/Ubuntu/Debian/Kali] Network not configured #5286

Closed

Description

@ericct

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

  1. betancour commented on May 29, 2020

    @betancour

    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 = false

    this 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.

  2. skippednote commented on May 29, 2020

    @skippednote

    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.

  3. betancour commented on May 29, 2020

    @betancour

    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.

    Hi skippednote
    Regarding your message
    Did you use your router IP as the nameserver?

  4. skippednote commented on May 29, 2020

    @skippednote

    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.

  5. betancour commented on May 29, 2020

    @betancour

    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.

    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:

     betancour  Inspiron-5570  mnt  d  Dev  $  sudo apt-get update
    [sudo] password for betancour:
    Err:1 https://deb.nodesource.com/node_12.x focal InRelease
      Temporary failure resolving 'deb.nodesource.com'
    Err:2 http://archive.ubuntu.com/ubuntu focal InRelease
      Temporary failure resolving 'archive.ubuntu.com'
    Err:3 http://security.ubuntu.com/ubuntu focal-security InRelease
      Temporary failure resolving 'security.ubuntu.com'
    Err:4 https://dl.yarnpkg.com/debian stable InRelease
      Temporary failure resolving 'dl.yarnpkg.com'
    Get:5 http://archive.ubuntu.com/ubuntu focal-updates InRelease [107 kB]
    Get:6 http://archive.ubuntu.com/ubuntu focal-backports InRelease [98.3 kB]
    Fetched 205 kB in 39s (5261 B/s)
    Reading package lists... Done
    W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/InRelease  Temporary failure resolving 'archive.ubuntu.com'
    W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
    W: Failed to fetch https://deb.nodesource.com/node_12.x/dists/focal/InRelease  Temporary failure resolving 'deb.nodesource.com'
    W: Failed to fetch https://dl.yarnpkg.com/debian/dists/stable/InRelease  Temporary failure resolving 'dl.yarnpkg.com'
    W: Some index files failed to download. They have been ignored, or old ones used instead.
     betancour  Inspiron-5570  mnt  d  Dev  $  echo 'nameserver 192.168.1.1' >> /etc/resolv.conf
     betancour  Inspiron-5570  mnt  d  Dev  $  sudo apt-get update
    Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [107 kB]
    Hit:2 http://archive.ubuntu.com/ubuntu focal InRelease
    Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [107 kB]
    Hit:4 https://dl.yarnpkg.com/debian stable InRelease
    Hit:5 https://deb.nodesource.com/node_12.x focal InRelease
    Get:6 http://archive.ubuntu.com/ubuntu focal-backports InRelease [98.3 kB]
    Fetched 312 kB in 18s (17.8 kB/s)
    Reading package lists... Done
  6. skippednote commented on May 29, 2020

    @skippednote

    Yitzhak B. Solórzano (@betancour) I'm seeing a similar output. What DNS address is working for you?

  7. betancour commented on May 29, 2020

    @betancour

    Hi Bassam Ismail (@skippednote) as you can see I am using the 192.168.1.1

    image

  8. skippednote commented on May 29, 2020

    @skippednote

    Yitzhak B. Solórzano (@betancour) This doesn't work for me. Only thing that work is reverting to WSL1

  9. ericct commented on May 29, 2020

    @ericct
    Author

    There are two different things here:

    • one is to have a network route (initial topic), which sometimes apprently is not set (initial topic here)
    • another one is indeed name resolution

    Default is to rely on the host machine for name resolution. /etc/resolv.conf is 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 update problem can have multiple reasons.

  10. skippednote commented on May 29, 2020

    @skippednote

    ericct I don't have a VPN or Antivirus installed. I have tried with Windows Defender Firewall disabld.

  11. skippednote commented on May 29, 2020

    @skippednote

    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.

  12. tokiedokie commented on May 29, 2020

    @tokiedokie

    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

  13. ericct commented on May 29, 2020

    @ericct
    Author

    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

    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)?

  14. tokiedokie commented on May 30, 2020

    @tokiedokie

    clean install windows works for me.

  15. betancour commented on Jun 1, 2020

    @betancour

    clean install windows works for me.

    Anotherway is deleting the account and log again with your account to set default parameters. thanks so much.

  16. 19 remaining items

  17. gtumanyan commented on Jun 18, 2020

    @gtumanyan

    This problem occurs if the %temp% directory is

    in my case, it was moved without symlink made pointing to a new location.
    Thank you. My problem is solved too!

  18. kobenauf commented on Jul 7, 2020

    @kobenauf

    Zacharias Giannadakis (@giannadakis) fix above worked for me too, but also only until I reboot.

    sudo sh -c "echo 'nameserver 192.168.1.1' >> /etc/resolv.conf"

    After that sudo apt update works. 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 update command 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.

  19. ericct commented on Jul 9, 2020

    @ericct
    Author

    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).

  20. Ritbit1111 commented on Aug 16, 2020

    @Ritbit1111

    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

    Hey can you show the steps?

  21. realasking commented on Oct 19, 2020

    @realasking

    Hi, for me works when i use this command:

    sudo sh -c "echo 'nameserver 192.168.1.1' >> /etc/resolv.conf"

    but after reboot the system the nameserver 192.168.1.1 disappear and the problem returned.

    fix wsl 2 0

    This works for me. Thanks very much.

  22. therealkenc commented on Oct 19, 2020

    @therealkenc

    /dupe #5437

  23. TgMrP commented on Dec 10, 2020

    @TgMrP

    Hi, for me works when i use this command:

    sudo sh -c "echo 'nameserver 192.168.1.1' >> /etc/resolv.conf"

    but after reboot the system the nameserver 192.168.1.1 disappear and the problem returned.

    fix wsl 2 0

    This works for me. Thank you very much.

  24. EvoPulseGaming commented on Dec 23, 2020

    @EvoPulseGaming

    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.

  25. OranguTech commented on Apr 23, 2021

    @OranguTech

    ericct This problem occurs if the %temp% directory is compressed. To fix:

    wsl --shutdown
    compact /u %temp% /i /Q

    I guess the temporarily created swap file was compressed, which caused this problem.
    But it is very strange, why compressing the swap partition will cause wsl2 initialization is incomplete, and there is no error message!

    To repro:

    wsl --shutdown
    compact /C %temp% /i /Q

    When using wsl2 again, there will be problems.

    This was driving me nuts, thank you! (To be clear, it applied to multiple distros)

  26. msustik commented on Oct 18, 2021

    @msustik

    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.

  27. zecaoliveira commented on Oct 26, 2021

    @zecaoliveira

    czheji (@czheji)'s solution worked for me. I just unchecked the NTFS compression on AppData/Temp. image

    Seems like WSL 2 doesn't work very well with NTFS compression since I also needed to fix #4103 previously. I wonder if using encryption on %temp% would also break networking.

    Thank you Kyle Piira (@KylePiira) .

    I disabled bitlocker but the folder %temp% was still compressed.

    After turning off compression, the interface started working automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions