Add networking diagnostics to collect-wsl-logs script (#10180)

Add netwokring diagnostics to collect-wsl-logs script and additional commands to networking.sh

---------

Co-authored-by: Catalin-Emil Fetoiu <cfetoiu@microsoft.com>
Co-authored-by: Mitchell Schmidt <74631052+mitschmi@users.noreply.github.com>
This commit is contained in:
Cătălin Emil Fetoiu 2023-06-21 17:23:07 -07:00 committed by GitHub
parent 73fde8be56
commit 8f23d2f234
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 76 additions and 1 deletions

View file

@ -130,6 +130,79 @@ if ($Dump)
} }
} }
# Collect networking state relevant for WSL
# Using a try/catch for commands below, as some of them do not exist on all OS versions
Write-Host "`nCollecting additional network state..."
$networkingFolder = "$folder/networking"
mkdir -p $networkingFolder
# Host networking info
try
{
Get-NetAdapter -includeHidden | select Name,ifIndex,NetLuid,InterfaceGuid,Status,MacAddress,MtuSize,InterfaceType,Hidden,HardwareInterface,ConnectorPresent,MediaType,PhysicalMediaType | Out-File -FilePath "$networkingFolder/Get-NetAdapter.log" -Append
}
catch {}
try
{
Get-NetIPConfiguration -All -Detailed | Out-File -FilePath "$networkingFolder/Get-NetIPConfiguration.log" -Append
}
catch {}
try
{
Get-NetFirewallHyperVVMCreator | Out-File -FilePath "$networkingFolder/Get-NetFirewallHyperVVMCreator.log" -Append
}
catch {}
try
{
Get-NetFirewallHyperVVMSetting -PolicyStore ActiveStore | Out-File -FilePath "$networkingFolder/Get-NetFirewallHyperVVMSetting_ActiveStore.log" -Append
}
catch {}
try
{
Get-NetFirewallHyperVProfile -PolicyStore ActiveStore | Out-File -FilePath "$networkingFolder/Get-NetFirewallHyperVProfile_ActiveStore.log" -Append
}
catch {}
try
{
Get-NetFirewallHyperVPort | Out-File -FilePath "$networkingFolder/Get-NetFirewallHyperVPort.log" -Append
}
catch {}
try
{
& hnsdiag.exe list all 2>&1 > $networkingFolder/hnsdiag_list_all.log
}
catch {}
try
{
& hnsdiag.exe list endpoints -df 2>&1 > $networkingFolder/hnsdiag_list_endpoints.log
}
catch {}
try
{
foreach ($port in Get-NetFirewallHyperVPort)
{
& vfpctrl.exe /port $port.PortName /get-port-state 2>&1 > "$networkingFolder/vfp-port-$($port.PortName)-get-port-state.log"
& vfpctrl.exe /port $port.PortName /list-rule 2>&1 > "$networkingFolder/vfp-port-$($port.PortName)-list-rule.log"
}
}
catch {}
try
{
& vfpctrl.exe /list-vmswitch-port 2>&1 > $networkingFolder/vfpctrl_list_vmswitch_port.log
}
catch {}
$logArchive = "$(Resolve-Path $folder).zip" $logArchive = "$(Resolve-Path $folder).zip"
Compress-Archive -Path $folder -DestinationPath $logArchive Compress-Archive -Path $folder -DestinationPath $logArchive
Remove-Item $folder -Recurse Remove-Item $folder -Recurse

View file

@ -13,7 +13,9 @@ uname -a
# Output adapter & routing configuration. # Output adapter & routing configuration.
ip a ip a
ip route show ip route show table all
ip neighbor
ip link
# Validate that the gateway is responsive and can route ICMP correctly. # Validate that the gateway is responsive and can route ICMP correctly.
if gateway=$(ip route show | awk '/default/ { print $3 }'); then if gateway=$(ip route show | awk '/default/ { print $3 }'); then