I am trying to ping my Ubuntu VM from my WSL2 Ubuntu. And same ping issue happening for vice versa. Both ubuntu version are 20.04.1. But I can ping Ubuntu VM from my Local Windows.
From Windows To Ubuntu VM
From WSL2 Ubuntu To Ubuntu VM
We need to set Forwarding to be enabled across the two v-Switches. Using this command (with admin rights) based on my v-Switch names works.
Get-NetIPInterface | where {$_.InterfaceAlias -eq 'vEthernet (WSL)' -or $_.InterfaceAlias -eq 'vEthernet (Default Switch)'} | Set-NetIPInterface -Forwarding Enabled
Below is my network connection
That's a great command line ! Minor improvment that would product less logs, invoke Enabled only if state is Disabled.
Get-NetIPInterface | select ifIndex,InterfaceAlias,AddressFamily,ConnectionState,Forwarding| where {$_.InterfaceAlias -eq 'vEthernet (WSL)' -or $_.InterfaceAlias -eq 'vEthernet (Default Switch)'} | where {$_.Forwarding -eq 'Disabled'} | Set-NetIPInterface -Forwarding 'Enabled'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With