Skip to content

Instantly share code, notes, and snippets.

View SandraMct's full-sized avatar

SandraMct SandraMct

  • InTech S.A.
View GitHub Profile
@SandraMct
SandraMct / reset-dns.sh
Last active November 19, 2024 13:33
WSL auto-generate DNS resolution
#!/bin/bash
# Remove the file for resolver configuration
chattr -i /etc/resolv.conf
rm -Rf /etc/resolv.conf
# Use the default routing table entry as DNS for WSL
echo "nameserver $(ip route | grep default | grep -Poe "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+")" > /etc/resolv.conf