Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wsl2 Ubuntu-22.04 The netplan does not work after the restart #11006

Closed
1 of 2 tasks
yyyyyyyysssss opened this issue Jan 10, 2024 · 10 comments
Closed
1 of 2 tasks

wsl2 Ubuntu-22.04 The netplan does not work after the restart #11006

yyyyyyyysssss opened this issue Jan 10, 2024 · 10 comments

Comments

@yyyyyyyysssss
Copy link

Windows Version

Microsoft Windows [版本 10.0.22621.2715]

WSL Version

2.0.9.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.133.1-1

Distro Version

Ubuntu 22.04

Other Software

Docker version 23.0.5, build bc4487a

Repro Steps

wsl --shutdown

Expected Behavior

netplan config:

network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: false
      dhcp6: true
      addresses:
        -  172.30.112.2/24
      routes:
      - to: default
        via: 172.30.112.1
      nameservers:
       addresses: [172.30.112.1]

run netplan apply is work properly, but netplan does not work after wsl --shutdown is executed

This is the result of executing netplay apply:
image

This is the result of executing wsl --shutdown:
image

Actual Behavior

run netplan apply is work properly, but netplan does not work after wsl --shutdown is executed

Diagnostic Logs

No response

Copy link

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@OneBlue
Copy link
Collaborator

OneBlue commented Jan 10, 2024

@yyyyyyyysssss: Netplan probably depends on systemd to reapply the settings on reboot. Is systemd enabled in your distro ?

@yyyyyyyysssss
Copy link
Author

@yyyyyyyysssss:Netplan 可能依赖于 systemd 在重新启动时重新应用设置。您的发行版中启用了 systemd 吗?

Have already opened
image

@OneBlue
Copy link
Collaborator

OneBlue commented Jan 11, 2024

Thank you @yyyyyyyysssss. Reading a bit netplan I can see that the way it works is that it generates configuration for systemd-networkd and network-manager. In the case of WSL this is unfortunately not well supported.

What you can try instead would be calling netplan apply at boot via:

[boot]
cmd=/path/to/netplan apply

@yyyyyyyysssss
Copy link
Author

谢谢@yyyyyyyysssss。读了一下 netplan,我可以看到它的工作方式是为 systemd-networkd 和网络管理器生成配置。遗憾的是,对于 WSL,这没有得到很好的支持。

您可以尝试在启动时通过以下方式调用netplan apply

[boot]
cmd=/path/to/netplan apply

This parameter is added
image

Two ip addresses appear after the wsl --shutdown is executed:
image

@yyyyyyyysssss
Copy link
Author

Thank you @yyyyyyyysssss. Reading a bit netplan I can see that the way it works is that it generates configuration for systemd-networkd and network-manager. In the case of WSL this is unfortunately not well supported.

What you can try instead would be calling netplan apply at boot via:

[boot]
cmd=/path/to/netplan apply

Another release Debian.
The same configuration works fine
image

@OneBlue
Copy link
Collaborator

OneBlue commented Jan 16, 2024

@yyyyyyyysssss: I'm not following. Are you saying that another version of debian doesn't hit the issue ? Is this within WSL or outside of WSL ?

@yyyyyyyysssss
Copy link
Author

@yyyyyyyysssss: 我不关注。您是说另一个版本的 Debian 没有解决这个问题吗?这是在 WSL 之内还是 WSL 之外?

My wsl has two distributions installed. The netplan configuration of the ubuntu distribution does not take effect, and the netplan of the Debian distribution works normally

@yyyyyyyysssss
Copy link
Author

@yyyyyyyysssss: 我不关注。您是说另一个版本的 Debian 没有解决这个问题吗?这是在 WSL 之内还是 WSL 之外?

wsl内,我安装了两个发行版,一个ubuntu2204一个Debian12。其中ubuntu2204发行版的netplan启动后不生效,需要手动执行 netplan apply才生效。而Debian12发行版配置的netplan是正常工作的。

@OneBlue
Copy link
Collaborator

OneBlue commented Apr 18, 2024

Ok. In this case this is most likely distro / configuration specific, so unfortunately this is something that WSL can solve. I'd recommend opening an issue with the distribution itself.

@OneBlue OneBlue closed this as completed Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants