Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow resolv.conf personalization via adding wsl.conf parameter "Link to personal nameserver list" #6399

Closed
PavelSosin-320 opened this issue Jan 4, 2021 · 6 comments
Labels

Comments

@PavelSosin-320
Copy link

Is your feature request related to a problem? Please describe.
##5336
Allow other than "auto-generate" or nothing options for resolv.conf creation.

Describe the solution you'd like
I would like to create a personalized resolv.conf file in my home directory and point to this file using the symbolic link in the /etc/ folder
My Android phone has 4 options for DNS selection.

Describe alternatives you've considered
Implementation of network systemd daemon or alternative configurable mechanism to create meaningful resolv.conf file. It can take 1-2 years.

Additional context
I have to edit manually my /etc/resolv.conf files in all WSL distros after every network configuration and availability event in my Router-managed WiFi network. I use my WiFi router as DNS server in 99% of cases. It has DNS forwarding feature and pretty WebGUI for built-in DNS server configuration and testing.

@benhillis
Copy link
Member

Have you considered disabling the auto generation of /etc/resolv.conf and replacing it with a symlink to somewhere shared between distros? Maybe /mnt/c/users/username/resolv.conf?

@PavelSosin-320
Copy link
Author

I think it will help to stabilize WSL networking. I am working with resolv.conf disabled already a long time. In all Linux distros all applications that use networking assume that /etc/resolv.conf is a link - this is the Linux requirement. During this period I analyzed the resolve daemon logic in systemd based systems and found that resolved makes certain checks before pushing nameserver into the generated resolv.conf under the /run/systemd folder. It ensures that inaccessible or unstable DNS's are never used. DNS provided by my ISP is very unstable and "temporary problems" with the name resolution by this DNS is a frequent situation unrelated to WSL. Linux allows up to 4 nameservers in the resolv.conf list plus up to 4 DNS servers in my router used for DNS forwarding. The situation "temporary unavailable maybe not a bug in WSL networking but only a bug in resolv.conf generation logic.

@PavelSosin-320
Copy link
Author

@benhillis I tried the following solution:

  1. Create resolv.conf file in my Windows home directory with Unix EOL
    nameserver 192.168.1.1
    nameserver 9.9.9.9
    nameserver 8.8.8.8
  2. . Create symbolic link in the distro: ln /mnt/c/Users/my-user/resolv.conf /etc/resolv.conf
  3. Everything works! This is what Linux expects. Now I can upgrade my CentOS 8.2 distro without issues like "can't access mirror list"

@PavelSosin-320
Copy link
Author

The situation is really bad. When I log in as different users the /etc/resolv.conf is regenerated every time and every time in the wrong way ignoring configuration in wsl.conf generateResolvConf false. ##6404. In some use-cases root and rootless login make a huge difference. If /etc/resolv.conf is not a link created by root and has rw access only for the root user it can be randomly overridden by any user session and DNS resolution will not work in all subsequent sessions.

@PavelSosin-320
Copy link
Author

Workaround: use genie to start distro using systemd, configure network Manager using its .conf file or nmcli and forget about /etc/resolv.conf. The modern Linux distros use this mechanism and it works even in WSL and complex Local or Home networks.

@Cpt76
Copy link

Cpt76 commented Mar 17, 2021

Workaround: use genie to start distro using systemd, configure network Manager using its .conf file or nmcli and forget about /etc/resolv.conf. The modern Linux distros use this mechanism and it works even in WSL and complex Local or Home networks.

I don't think that the issue should be closed, using genie isn't a solution, only a workaround. I'm not a Linux expert, and I don't know how to use genie.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants