microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.48k stars 822 forks source link

sudo ifconfig eth0 up doesn't bring up network #12011

Closed gigit0000 closed 2 months ago

gigit0000 commented 2 months ago

Windows Version

Microsoft Windows [Version 10.0.19045.4780]

WSL Version

0.0.0.0

Are you using WSL 1 or WSL 2?

Kernel Version

5.10.16.3

Distro Version

Ubuntu 20.04

Other Software

No response

Repro Steps

sudo ifconfig eth0 down sudo ifconfig eth0 up ping google.com >> doesn't work > ping: connect: Network is unreachable ping 8.8.8.8 >> doesn't work > ping: connect: Network is unreachable ping 127.0.0.1 >> works

Expected Behavior

After sudo ifconfig eth0 down and sudo ifconfig eth0 up, the eth should work.

Actual Behavior

After sudo ifconfig eth0 down and sudo ifconfig eth0 up, the eth doesn't work as shown above.

Diagnostic Logs

$ ifconfig eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.19.210.220 netmask 255.255.240.0 broadcast 172.19.223.255 inet6 fe80::215:5dff:fe49:338a prefixlen 64 scopeid 0x20 ether 00:15:5d:49:33:80 txqueuelen 1000 (Ethernet) RX packets 75 bytes 14548 (14.5 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 30 bytes 2180 (2.1 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 1000 (Local Loopback) RX packets 146 bytes 7640 (7.6 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 146 bytes 7640 (7.6 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

$ ping google.com ping: connect: Network is unreachable $ ping 8.8.8.8 ping: connect: Network is unreachable $ ping 127.0.0.1 PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data. 64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.061 ms 64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.034 ms ^C --- 127.0.0.1 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1038ms rtt min/avg/max/mdev = 0.034/0.047/0.061/0.013 ms

No response

github-actions[bot] commented 2 months ago

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs Download and execute [collect-wsl-logs.ps1](https://github.com/Microsoft/WSL/blob/master/diagnostics/collect-wsl-logs.ps1) in an **administrative powershell prompt**: ``` Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1 Set-ExecutionPolicy Bypass -Scope Process -Force .\collect-wsl-logs.ps1 ``` The script will output the path of the log file once done. If this is a networking issue, please use [collect-networking-logs.ps1](https://github.com/Microsoft/WSL/blob/master/diagnostics/collect-networking-logs.ps1), following the instructions [here](https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#collect-wsl-logs-for-networking-issues) Once completed please upload the output files to this Github issue. [Click here for more info on logging](https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#8-collect-wsl-logs-recommended-method) If you choose to email these logs instead of attaching to the bug, please send them to wsl-gh-logs@microsoft.com with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

View similar issues

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!

Closed similar issues:

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

gigit0000 commented 2 months ago

This is the log. It only happens when I command sudo ifconfig eth0 down and then sudo ifconfig eth0 up .

$ ifconfig eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.19.210.220 netmask 255.255.240.0 broadcast 172.19.223.255 inet6 fe80::215:5dff:fe49:338a prefixlen 64 scopeid 0x20 ether 00:15:5d:49:33:80 txqueuelen 1000 (Ethernet) RX packets 75 bytes 14548 (14.5 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 30 bytes 2180 (2.1 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 1000 (Local Loopback) RX packets 146 bytes 7640 (7.6 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 146 bytes 7640 (7.6 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

$ ping google.com ping: connect: Network is unreachable $ ping 8.8.8.8 ping: connect: Network is unreachable $ ping 127.0.0.1 PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data. 64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.061 ms 64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.034 ms ^C --- 127.0.0.1 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1038ms rtt min/avg/max/mdev = 0.034/0.047/0.061/0.013 ms

github-actions[bot] commented 2 months ago

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs Download and execute [collect-wsl-logs.ps1](https://github.com/Microsoft/WSL/blob/master/diagnostics/collect-wsl-logs.ps1) in an **administrative powershell prompt**: ``` Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1 Set-ExecutionPolicy Bypass -Scope Process -Force .\collect-wsl-logs.ps1 ``` The script will output the path of the log file once done. If this is a networking issue, please use [collect-networking-logs.ps1](https://github.com/Microsoft/WSL/blob/master/diagnostics/collect-networking-logs.ps1), following the instructions [here](https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#collect-wsl-logs-for-networking-issues) Once completed please upload the output files to this Github issue. [Click here for more info on logging](https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#8-collect-wsl-logs-recommended-method) If you choose to email these logs instead of attaching to the bug, please send them to wsl-gh-logs@microsoft.com with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

View similar issues

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!

Open similar issues:

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

gigit0000 commented 2 months ago

I only updated the title. That's my feedback.

OneBlue commented 2 months ago

@gigit0000: This is by design, since WSL's network interfaces are configured by WSL itself (not by dhcp). If you disable an interface , it won't be able to automatically reconfigure itself when you enable it again.