<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>wsl &amp;mdash; Arturo Linares</title>
    <link>https://arturo.linar.es/tag:wsl</link>
    <description></description>
    <pubDate>Fri, 19 Jun 2026 13:16:21 +0000</pubDate>
    <item>
      <title>What would make WSL2 perfect for PHP development?</title>
      <link>https://arturo.linar.es/what-would-make-wsl2-perfect-for-php-development?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[I&#39;ve been using WSL2 to develop Drupal sites for some months now, and it has been a surprise to me how well it works. I have native Linux speed and great tools (I use Sublime through X server and VS Code).&#xA;!--more--&#xA;However, there&#39;s a small issue that if solved, would make the development experience perfect: DNS resolution to dev environments. I&#39;ll describe how I work to illustrate what I mean with this.&#xA;&#xA;I use Docksal to manage all my development environments on a WSL2 distribution using docker. So, to create a new Laravel project I would normally do this:&#xA;&#xA;From there I can access the project using the generated local address from Linux. Docksal uses dnsmasq to resolve these addresses:&#xA;&#xA;$ curl http://helloworld.docksal&#xA;!DOCTYPE html&#xA;html lang=&#34;en&#34;&#xA;    head&#xA;        meta charset=&#34;utf-8&#34;&#xA;        meta name=&#34;viewport&#34; content=&#34;width=device-width, initial-scale=1&#34;&#xA;...&#xA;&#xA;However, I cannot access that address from Windows. What I&#39;ve been doing until now is to add an entry in my Windows hosts file to redirect these new address to localhost:&#xA;&#xA;127.0.0.1     helloworld.docksal&#xA;&#xA;But once I added this entry, the site is still not accessible from Windows. I need to run a powershell script that I took from a github issue to create firewall rules, so I can actually access it.&#xA;&#xA;I haven&#39;t found a solution for this yet, but what I would love to see is:&#xA;&#xA;The local address created in Linux doesn&#39;t require me to add a hosts entry in Windows.&#xA;The firewall rules are automatically updated to allow access.&#xA;&#xA;Installing a custom DNS entry&#xA;&#xA;To solve the first issue I tried to use a custom DNS proxy (Acrylic) to redirect all .docksal addresses back to localhost, like I&#39;m doing with the hosts file. But when I try to execute the server it fails to start because UDP port is already in use:&#xA;&#xA;2020-02-12 10:29:00.233 [E] TDnsResolver.Execute: TDualUdpServerCommunicationChannel.Bind: Binding to IPv4 address failed with Windows Sockets error code 10048.&#xA;&#xA;What is using port 53 (the standard DNS port)? I used tcpview to find out. &#xA;&#xA;It looks it is svchost. Using the PID and the Process Explorer I found that it was related to a service called Shared Access.&#xA;&#xA;I had walked so far to stop digging now, so I opened the services and looked for ICS (maybe the initials for Internet Connection Sharing in English) and found it was configured to start manually.&#xA;&#xA;I was feeling brave and tried to stop it, but I couldn&#39;t do it. It refused to stop with an error dialog that said (in a loose translation): &#34;Windows couldn&#39;t stop the service in the local computer&#34;. Nice. I switched the service to Disabled* and decided to reboot. Upon reboot, it was enabled again, set to start in &#34;Manual&#34; mode. So no luck so far to enable a custom DNS Proxy.&#xA;&#xA;Enabling the firewall by default&#xA;&#xA;I&#39;m running the script I found in github manually when I can&#39;t access the sites in WSL2 (normally after a reboot), and since I don&#39;t often reboot I could keep doing it.&#xA;&#xA;I don&#39;t know if the script  creates security issues, but I if I get tired of running it manually I could configure it to run every time I boot or every hour even. &#xA;&#xA;Update 2021-04-28: It is possible to run the script from WSL2. Since I&#39;musing fish shell, I created the alias winfirewall to run it:&#xA;&#xA;alias --save winfirewall &#39;powershell.exe start-process PowerShell -verb runas &#34;C:\Users\alinares\firewall_rules.ps1&#34;&#39;&#xA;&#xA;#windows #wsl]]&gt;</description>
      <content:encoded><![CDATA[<p>I&#39;ve been using WSL2 to develop Drupal sites for some months now, and it has been a surprise to me how well it works. I have native Linux speed and great tools (I use Sublime through X server and VS Code).

However, there&#39;s a small issue that if solved, would make the development experience perfect: <strong>DNS resolution to dev environments</strong>. I&#39;ll describe how I work to illustrate what I mean with this.</p>

<p>I use <a href="https://docksal.io" rel="nofollow">Docksal</a> to manage all my development environments on a WSL2 distribution using docker. So, to create a new Laravel project I would normally do this:</p>

<p><img src="https://i.snap.as/9j7tIIc.image" alt=""/></p>

<p>From there I can access the project using the generated local address <strong>from Linux</strong>. <a href="https://docs.docksal.io/core/system-dns/" rel="nofollow">Docksal uses dnsmasq</a> to resolve these addresses:</p>

<pre><code>$ curl http://helloworld.docksal
&lt;!DOCTYPE html&gt;
&lt;html lang=&#34;en&#34;&gt;
    &lt;head&gt;
        &lt;meta charset=&#34;utf-8&#34;&gt;
        &lt;meta name=&#34;viewport&#34; content=&#34;width=device-width, initial-scale=1&#34;&gt;
...
</code></pre>

<p>However, I cannot access that address from Windows. What I&#39;ve been doing until now is to add an entry in my Windows <code>hosts</code> file to redirect these new address to localhost:</p>

<pre><code>127.0.0.1     helloworld.docksal
</code></pre>

<p>But once I added this entry, the site is still not accessible from Windows. I need to run a powershell script that I took from a <a href="https://github.com/microsoft/WSL/issues/4150#issuecomment-504209723" rel="nofollow">github issue</a> to create firewall rules, so I can actually access it.</p>

<p><img src="https://i.snap.as/LYWPUI0.png" alt=""/></p>

<p>I haven&#39;t found a solution for this yet, but what I would love to see is:</p>
<ol><li>The local address created in Linux doesn&#39;t require me to add a hosts entry in Windows.</li>
<li>The firewall rules are automatically updated to allow access.</li></ol>

<h2 id="installing-a-custom-dns-entry" id="installing-a-custom-dns-entry">Installing a custom DNS entry</h2>

<p>To solve the first issue I tried to use a custom DNS proxy (<a href="https://mayakron.altervista.org/support/acrylic/Home.htm" rel="nofollow">Acrylic</a>) to redirect all <code>*.docksal</code> addresses back to localhost, like I&#39;m doing with the hosts file. But when I try to execute the server it fails to start because UDP port is already in use:</p>

<pre><code>2020-02-12 10:29:00.233 [E] TDnsResolver.Execute: TDualUdpServerCommunicationChannel.Bind: Binding to IPv4 address failed with Windows Sockets error code 10048.
</code></pre>

<p>What is using port 53 (the standard DNS port)? I used <a href="https://docs.microsoft.com/en-us/sysinternals/downloads/tcpview" rel="nofollow">tcpview</a> to find out.</p>

<p><img src="https://i.snap.as/j17rMRc.image" alt=""/></p>

<p>It looks it is <code>svchost</code>. Using the <strong>PID</strong> and the <a href="https://docs.microsoft.com/en-us/sysinternals/downloads/process-explorer" rel="nofollow">Process Explorer</a> I found that it was related to a service called <strong>Shared Access</strong>.</p>

<p><img src="https://i.snap.as/JGFsCGu.png" alt=""/></p>

<p>I had walked so far to stop digging now, so I opened the services and looked for <em>ICS</em> (maybe the initials for <em>Internet Connection Sharing</em> in English) and found it was configured to start manually.</p>

<p><img src="https://i.snap.as/ihhsMKM.png" alt=""/></p>

<p>I was feeling brave and tried to stop it, but I couldn&#39;t do it. It refused to stop with an error dialog that said (in a loose translation): “Windows couldn&#39;t stop the service in the local computer”. Nice. I switched the service to <em>Disabled</em> and decided to reboot. Upon reboot, it was enabled again, set to start in “Manual” mode. So no luck so far to enable a custom DNS Proxy.</p>

<h2 id="enabling-the-firewall-by-default" id="enabling-the-firewall-by-default">Enabling the firewall by default</h2>

<p>I&#39;m running the script I found <a href="https://github.com/microsoft/WSL/issues/4150#issuecomment-504209723" rel="nofollow">in github</a> manually when I can&#39;t access the sites in WSL2 (normally after a reboot), and since I don&#39;t often reboot I could keep doing it.</p>

<p>I don&#39;t know if the script  creates security issues, but I if I get tired of running it manually I could configure it to run every time I boot or every hour even.</p>

<p><strong>Update 2021-04-28</strong>: It is possible to run the script from WSL2. Since I&#39;musing fish shell, I created the alias <code>winfirewall</code> to run it:</p>

<pre><code>alias --save winfirewall &#39;powershell.exe start-process PowerShell -verb runas &#34;C:\Users\alinares\firewall_rules.ps1&#34;&#39;
</code></pre>

<p><a href="https://arturo.linar.es/tag:windows" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">windows</span></a> <a href="https://arturo.linar.es/tag:wsl" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">wsl</span></a></p>
]]></content:encoded>
      <guid>https://arturo.linar.es/what-would-make-wsl2-perfect-for-php-development</guid>
      <pubDate>Sat, 01 Aug 2020 19:36:55 +0000</pubDate>
    </item>
  </channel>
</rss>