/etc/resolv.conf and secondary DNS suffixes
I wasn't able to find an existing idea for this issue, so I am creating a new one.
This is really a bug report, but the GitHub issue at https://github.com/Microsoft/BashOnWindows/issues/701 says to provide feedback here, so...
There are two problems to report.
One: the /etc/resolv.conf file is autogenerated when a new WSL session starts, but WSL only pulls in the DNS suffix for the primary domain for the "search" line. The result is that by default, only hosts in the primary domain can be resolved using short/unqualified names. If you need to resolve other short/unqualified hostnames in WSL, you have to edit /etc/resolv.conf and add those DNS suffixes yourself.
Two: While the generated /etc/resolv.conf file has a comment saying automatic generation can be stopped by removing the comment line, this does not work between WSL sessions. If you close all WSL windows and then open a new one, the file gets regenerated, even if you've removed the comment. If you've added your own DNS suffixes, they get removed, and you have to add them again. Which is pretty annoying.
It would be great if WSL could either include all configured DNS suffixes (in the order configured!) when generating /etc/resolv.conf, or provide a standard way to control the content of /etc/resolv.conf that persists between WSL sessions.
I only have two ideas on how to do this. One would be to provide another file somewhere that, if present, replaces all or part of the generated /etc/resolv.conf on session creation; I'm going to try and do something like this with my bash profile so my suffix list gets added automatically for my user. Another idea would be to further virtualize WSL: run the selected distribution's network scripts/daemons on session creation, while providing a fake DHCP server for them to contact such that DNS and other updates would get presented via DHCP and handled by the distribution's standard tools instead of WSL having to directly generate/edit the various config files itself.
Erkin Alp Güney commented
Use Windows DNS configuration for your WSL instance as WSL is not a virtual machine but a personality of Windows.
Ryan Erwin commented
Since Linux already configuration files in /etc/resolvconf/resolv.conf.d seems most reasonable to handle changes with those files.
Could also include a comment at that top of /etc/resolv.conf notifying uses to edit the files in /etc/resolvconf/resolv.conf.d if persistent changes are required