Configure Ubuntu install in WSL2 to get LAN address(es) from router like every other device on the LAN


ronzie

New member
Local time
10:38 PM
Posts
2
OS
Windows 11
I would like my wsl Ubuntu distro to get ip addresses from my router just like every other pc, tablet, and phone in my household so it can interact with the other devices on my LAN. Those addresses are all in 192.168.1.###, but wsl is getting 172.18.148.93 if I'm reading the output of 'ip -c a' correctly. It can connect to some stuff on my LAN, like my NAS, but not to the SiliconDust tv tuner. I have searched the web and even asked ChatGPT, but all I accomplished was to bork my networking on the host machine so badly that I had to use a system restore point to get it working again.

Edition Windows 11 Pro
Version 24H2
Installed on ‎2024-‎12-‎24
OS build 26100.3476
Experience Windows Feature Experience Pack 1000.26100.54.0

wsl -l -v
NAME STATE VERSION
* Ubuntu-24.04 Running 2

I'm hoping this is the correct forum to post this in. If not, please feel free to delete it.
 
Windows Build/Version
26100.3476 / 24H2

My Computer

System One

  • OS
    Windows 11
    Computer type
    PC/Desktop
    Manufacturer/Model
    Dell
The short answer is, you can't. At least not yet anyways. You either need to setup a port proxy because WSL uses NAT or there is a newer feature called mirrormode which allows direct access to WSL from your LAN by using the Windows host's IP address.

Reading and configuration here Accessing network applications with WSL
 

My Computer

System One

  • OS
    Windows 11
The short answer is, you can't. At least not yet anyways. You either need to setup a port proxy because WSL uses NAT or there is a newer feature called mirrormode which allows direct access to WSL from your LAN by using the Windows host's IP address.

Reading and configuration here Accessing network applications with WSL
I put the following in my .wslconfig:

[wsl2]
networkingMode=mirrored
dnsTunneling=true
autoProxy=true

and ran the following from an admin powershell terminal:
Set-NetFirewallHyperVVMSetting -Name '{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}' -DefaultInboundAction Allow

Then restarted wsl with
wsl --shutdown

In Ubuntu I got this from 'ip -c a'

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet 10.255.255.254/32 brd 10.255.255.254 scope global lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether 5c:80:b6:8b:74:6e brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 6c:2b:59:eb:48:8f brd ff:ff:ff:ff:ff:ff
inet 192.168.1.187/24 brd 192.168.1.255 scope global noprefixroute eth1
valid_lft forever preferred_lft forever
inet6 2600:4041:300:1c00:40:7e55:bcd6:a31e/128 scope global nodad noprefixroute
valid_lft forever preferred_lft forever
inet6 2600:4041:300:1c00:db60:3223:966e:d999/64 scope global nodad deprecated noprefixroute
valid_lft forever preferred_lft 0sec
inet6 fe80::6128:e85f:e5cf:f74f/64 scope link nodad noprefixroute
valid_lft forever preferred_lft forever
4: loopback0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:15:5d:a6:5a:35 brd ff:ff:ff:ff:ff:ff

Which seems to show Ubuntu now has the same LAN ip as Windows 11. However 'hdhomerun_config discover' still returns 'no devices found', and my Linux vpn is broken and MBAM in Windows started freaking out about "compromised" websites being blocked and also a bunch of blocked port scans, so I guess I'd better figure out how to put it back the way it was before I get hacked?
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    PC/Desktop
    Manufacturer/Model
    Dell
@ronzie

You need to enable a Network Bridge -- I suggest forget WSL and install Ubuntu on Hyper-V as a full VM then you can use an "External switch" to provide the bridge. -- Wifi also works and you should then get an IP address that is acessible on your Lan, Host / Guest communicaltion is fine etc etc.

Hyper-V is really OK now.For file transfer simply use SAMBA / Filezilla etc. For adding pysical HDD's in the vmconfig on Hyper-V add Physical disk for each HDD you want to have connected to the VM -- note Offline those disks to Windows first via diskpart.

You only need a small amount of memory / disk space for the VM -- WSL was a good idea when it first came out but I'd suggest now simply use a proper VM -- you can also then run a full GUI as well.

Helps also on the Windows host to install openssh-server via the add optional features. start it automatically too and enable sshd on the VM.

E.G : Host windows system :

Skjámynd 2025-03-31 151513.webp

IP address 192.168.1.192

Hyper-V Linux VM system

Skjámynd 2025-03-31 151705.webp


IP address 192.168.1.144

Machines acessible both ways via ping. ssh, filezilla etc etc.

Cheers

jimbo
 
Last edited:

My Computer

System One

  • OS
    Windows XP,7,10,11 Linux Arch Linux
    Computer type
    PC/Desktop
    CPU
    2 X Intel i7

Latest Support Threads

Back
Top Bottom