I had the same issue where a local internet ip was set up in my wsl, and restarting caused it to be re-added....
I found launching from powershell with debian.exe was better than with wsl.exe for some unknown reason: I did check, and it is the same instance.
Resolved this by modifying two files:
sudo nano /etc/resolv.conf needed the nameserv removed and changed to 1.1.1.1 or 8.8.8.8 (probably would be okay to remove it all together, may even be okay to keep it--still testing--.
So, it should look like this:
nameserv 1.1.1.1
And it's also worth noting I had to do this:
cd /etc
sudo nano resolv.conf
Because sudo nano /etc/resolv.conf resulted in "directory does not exist" errors at the bottom of nano.
The second one might be the only one that was necessary: I used sudo nano /etc/wsl.conf and had to add
[network]
generateResolvConf = false
You could also add permissions so you won't need to use sudo just to ping....
which ping
sudo visudo
your_username ALL=(ALL) NOPASSWD: etc/bin/ping
You add the third line to the visudo file. Yes, you need the full address of the executable which is seen via which.