Linux overrides /etc/hosts on windows-linux-subsystem

linuxwindows-subsystem-for-linux

I had problems with hostnames resolving in windows Linux-subsystem so I removed /etc/hosts and wrote new version of it. That solution solved my problem, but after every reboot system started overriding /etc/hosts by a some default version, so I need setup hosts again and again.
Is it possible to setup linux subsystem so it copies original windows hosts file or at least doesn't delete already written file ?

Best Answer

sudo vim /etc/wsl.conf

Add the following two lines:

[network]
generateHosts = False

Reference: https://devblogs.microsoft.com/commandline/automatically-configuring-wsl/

Related Question