Giter VIP home page Giter VIP logo

wsl2-dns-fix-config's Introduction

WSL2 DNS Fix/Config

GitHub Workflow Status

One-liner shell script that will setup your WSL2 image to use custom nameserver 8.8.8.8 from Google.

Usage

Clone and run the shell:

sudo sh ./run.sh

Restart WSL:

wsl --shutdown

All done. Make sure you read what it does.


⁉️ GitHub DNS not resolving?

You can try curl --resolve with one of GitHub's IP addresses to force DNS resolution:

curl --resolve 'codeload.github.com:443:20.201.28.149' 'https://codeload.github.com/epomatti/wsl2-dns-fix-config/tar.gz/refs/tags/v1.0.1' -o wsl2-dnsfix.tar.gz

tar -xf wsl2-dnsfix.tar.gz

cd wsl2-dns-fix-config-1.0.1

sudo sh ./run.sh

This will work in distros like Ubuntu 22.04 which are not recognizing github.com out of the box.

Yet another way is to get the archive from the releases:

curl -L 'https://github.com/epomatti/wsl2-dns-fix-config/archive/refs/tags/v1.0.1.tar.gz' -o wsl2-dnsfix.tar.gz

What it does

The run.sh script will perform these tasks:

  1. Delete the following files: /etc/wsl.conf and /etc/resolv.conf

  2. Create the new ".conf" files (pre-created in the dist folder) setting Google DNS for name resolution and preventing WSL from overriding it:

    # /etc/wsl.conf
    [network]
    generateResolvConf = false
    # /etc/resolv.conf
    nameserver 8.8.8.8
  3. Make /etc/resolv.conf immutable

Contributing

Feel free to open an issue/discussion or send a pull request.

Tested on:

  • Ubuntu 22.04
  • Ubuntu 20.04

Source / Credits

https://gist.github.com/coltenkrauter/608cfe02319ce60facd76373249b8ca6

wsl2-dns-fix-config's People

Contributors

epomatti avatar lorenzobersano avatar zalastax avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

wsl2-dns-fix-config's Issues

Remove "fix" from the repository name

A more applicable name for the repository would be "wsl2-dns-config" as opposed to the current one "wsl2-dns-fix-config".

There are no penalties for broken links as GH will route it to the new repository as long as it is not re-used, but the readme documentation should be updated as it has links to the release artifacts.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.