Add a script to help diagnose networking issue and instructions to run it

Blue committed Jan 14, 2021 at 15:07 UTC 2cca95b9c9a148e197e81c0c3ce6d0a2ff5d5c64
2 files changed +36
CONTRIBUTING.md
+10
@@ -108,6 +108,16 @@ Availability Capabilities CapabilityDescriptions
108 {3, 4, 10} {"Random Access", "Supports Writing", "SMART Notification"} \\.\PHYSICALDRIVE2 SCSI TRUE Fixed hard disk media ST2000DM001-1ER164 \\.\PHYSICALDRIVE2 1
109 ```
110
111 +#### Networking issues
112 +
113 +If the issue is about networking, download [networking.sh](https://github.com/Microsoft/WSL/blob/master/diagnostics/networking.sh), and execute it inside WSL by running:
114 +
115 +```
116 +$ bash ./networking.sh
117 +```
118 +
119 +Once the script execution is completed, include its output on the issue.
120 +
121 <!-- Preserving anchors -->
122 <div id="8-detailed-logs"></div>
123 <div id="9-networking-logs"></div>
diagnostics/networking.sh new
+26
@@ -0,0 +1,26 @@
1 +#! /bin/bash
2 +
3 +set -xu
4 +
5 +# Gather distro & kernel info
6 +lsb_release -a || cat /etc/issue
7 +uname -a
8 +
9 +# Output adapter & routing configuration
10 +ip a
11 +ip route show
12 +
13 +# Validate that the gateway is responsive and can route ICMP correctly
14 +gateway=$(ip route show | awk '/default/ { print $3 }')
15 +ping -c 4 "$gateway"
16 +ping -c 4 1.1.1.1
17 +
18 +# Validate that the default route is working (won't work if traceroute isn't installed)
19 +traceroute 1.1.1.1
20 +
21 +# Display the DNS configuration
22 +cat /etc/resolv.conf
23 +
24 +# Validate that everything is functionning correctly
25 +curl -m 5000 -v https://microsoft.com
26 +