Skip to content

Bridged networking: WSL's dhcpcd.conf has a typo (broadcast), so DNS is never requested and /etc/resolv.conf is empty #41539

Description

@DesertRatUa

Windows Version

Microsoft Windows [Version 10.0.19045.6456]

WSL Version

2.7.13.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

6.18.33.2-microsoft-standard-WSL2

Distro Version

Ubuntu 26.04 LTS (also reproducible from the system distro, Microsoft Azure Linux 3.0)

Other Software

DHCP server on the LAN is Pi-hole FTL (dnsmasq-pi-hole-v2.92rc1). Any DHCP server that only returns options listed in the client's Parameter Request List (dnsmasq, Kea, ISC dhcpd) is affected.

Repro Steps

.wslconfig:
[wsl2]
networkingMode=bridged
vmSwitch=WSL-Bridge
Use a DHCP server that only sends options the client asks for (Pi-hole / dnsmasq defaults).
Start a distro and look at /etc/resolv.conf (symlink to /mnt/wsl/resolv.conf).

Expected Behavior

/mnt/wsl/resolv.conf contains the nameserver (and domain/search) lines handed out by DHCP, like the Windows host gets on the same bridge.

Actual Behavior

eth0 gets an IP address and default route from DHCP, but resolv.conf has no nameserver at all:

$ cat /etc/resolv.conf

Generated by dhcpcd

/etc/resolv.conf.head can replace this line

/etc/resolv.conf.tail can replace this line

Diagnostic Logs

Root cause
StartDhcpClient() in src/linux/init/main.cpp writes this dhcpcd.conf and runs dhcpcd -w -4 -f /dhcpcd.conf eth0:

option subnet_mask, routers, broadcast, domain_name, domain_name_servers, domain_search, host_name, interface_mtu
noarp
timeout {}
dhcpcd has no option called broadcast; option 28 is broadcast_address. dhcpcd 10.0.8 (the version in the system distro) rejects the entire option line:

unknown option: subnet_mask, routers, broadcast, domain_name, domain_name_servers, domain_search, host_name, interface_mtu
so domain_name_servers, domain_name, domain_search, host_name and interface_mtu are never put in the Parameter Request List. A DHCP server that honours the PRL therefore omits option 6, and dhcpcd's 20-resolv.conf hook writes a resolv.conf with no nameservers.

Proof (run as root in the system distro, wsl --system -u root)
WSL's config, test mode (-T), OFFER has no DNS:

printf 'option subnet_mask, routers, broadcast, domain_name, domain_name_servers, domain_search, host_name, interface_mtu\nnoarp\ntimeout 30\n' > /tmp/w.conf

dhcpcd -T -4 -f /tmp/w.conf eth0

unknown option: subnet_mask, routers, broadcast, domain_name, domain_name_servers, domain_search, host_name, interface_mtu
eth0: offered 192.168.1.40 from 192.168.1.12
new_dhcp_server_identifier=192.168.1.12
new_ip_address=192.168.1.40
new_routers=192.168.1.12
Same config with broadcast -> broadcast_address, OFFER now carries DNS:

sed -i 's/broadcast,/broadcast_address,/' /tmp/w.conf

dhcpcd -T -4 -f /tmp/w.conf eth0

eth0: offered 192.168.1.40 from 192.168.1.12
new_domain_name_servers=192.168.1.12
new_domain_name_servers=192.168.1.12
...
The Windows host on the same vSwitch (ipconfig /all) receives DNS Servers: 192.168.1.12 from the same server, confirming the server is fine and the client request is what differs.

Fix
One-word change in src/linux/init/main.cpp (StartDhcpClient): broadcast -> broadcast_address. Patch attached / PR to follow.

Workarounds
Distro side: [network] generateResolvConf=false in /etc/wsl.conf and configure DNS statically (e.g. via systemd-resolved).
Server side (dnsmasq): dhcp-option-force=option:dns-server, so option 6 is sent even when not requested.

Activity

github-actions commented on Sep 8, 2026

@github-actions
Contributor

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise, please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The script will output the path of the log file once done.

If this is a networking issue, please use .\collect-wsl-logs.ps1 -LogProfile networking instead, following the instructions in Collect WSL logs for networking issues

Once completed please upload the output files to this GitHub issue.

See Collect WSL logs (recommended method).

If you choose to email these logs instead of attaching them to the bug, please send them to [email protected] with the GitHub issue number in the subject, and include a link to your GitHub issue comment in the message body, and reply with '/emailed-logs'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions