Тёмный

WSL 2 Networking 

David Bombal
Подписаться 2,5 млн
Просмотров 207 тыс.
50% 1

How do you access WSL 2 Virtual Machines remotely? I'll show you how WSL2 networking works and I'll also show you how to configure the proxy service on your Windows 10 computer to allow connections to your WSL virtual machines. I'll also explain the configuration of the Windows Firewall.
WSL 2 changes the way networking is configured compared to WSL 1. You need to enable proxy of traffic and you need to permit the traffic through the Windows firewall.
Menu:
Overview: 0:00
Network Setup: 0:48
Microsoft Documentation: 1:11
Virtual and Physical Networks: 2:12
Testing from Mac: 6:35
Port Proxy Command: 7:07
Testing from Mac Again: 8:24
Firewall Rules: 9:40
GitHub 4150 Script: 11:09
Pings fail: 13:05
WSL commands:
netsh interface portproxy add v4tov4 listenport=3390 listenaddress=0.0.0.0 connectport=3390 connectaddress=192.168.170.227
Firewall rules:
- Go to control panel and open advanced firewall rules
- allow port 3390 through firewall
github.com/microsoft/WSL/issu...
WSL 2 Playlist:
• WSL 2 (Windows Subsyst...
Good links:
WSL 2 Proxy Script: github.com/microsoft/WSL/issu...
Microsoft GUI announcement: devblogs.microsoft.com/comman...
Ubuntu WSL2 GUI Install: In Ubuntu WSL:
dev.to/darksmile92/linux-on-w...
WSL 2 install: docs.microsoft.com/en-us/wind...
Docker for WSL2: docs.docker.com/docker-for-wi...
What is WSL? docs.microsoft.com/en-us/wind...
WSL documentation: docs.microsoft.com/en-us/wind...
WSL 2 Announcement: devblogs.microsoft.com/comman...
WSL2
WSL 2
WSL 2 Networking
WSL 2 Proxy
WSL proxy
Docker
Ubuntu 20.04
Ubuntu GUI
WSL 2 Ubuntu GUI
WSL Ubuntu GUI
WSL 2
WSL 1
Ubuntu 18.04
windows subsystem for linux
wsl2 ubuntu gui
#wsl2 #ubuntu #windows

Наука

Опубликовано:

 

25 июн 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 293   
@davidbombal
@davidbombal 4 года назад
Menu: Overview: 0:00 Network Setup: 0:48 Microsoft Documentation: 1:11 Virtual and Physical Networks: 2:12 Testing from Mac: 6:35 Port Proxy Command: 7:07 Testing from Mac Again: 8:24 Firewall Rules: 9:40 GitHub 4150 Script: 11:09 Pings fail: 13:05 WSL commands: netsh interface portproxy add v4tov4 listenport=3390 listenaddress=0.0.0.0 connectport=3390 connectaddress=192.168.170.227 Firewall rules: - Go to control panel and open advanced firewall rules - allow port 3390 through firewall github.com/microsoft/WSL/issues/4150 Good links: WSL 2 Proxy Script: github.com/microsoft/WSL/issues/4150 Microsoft GUI announcement: devblogs.microsoft.com/commandline/the-windows-subsystem-for-linux-build-2020-summary/ Ubuntu WSL2 GUI Install: In Ubuntu WSL: dev.to/darksmile92/linux-on-windows-wsl-with-desktop-environment-via-rdp-522g WSL 2 install: docs.microsoft.com/en-us/windows/wsl/install-win10 Docker for WSL2: docs.docker.com/docker-for-windows/wsl/ What is WSL? docs.microsoft.com/en-us/windows/wsl/about WSL documentation: docs.microsoft.com/en-us/windows/wsl/ WSL 2 Announcement: devblogs.microsoft.com/commandline/announcing-wsl-2/
@gijduvon6379
@gijduvon6379 3 года назад
Hi David! What if I need several port available in my wsl-based OS? In my case I need 26257 and 8080 ports. How can access via these if only 3390 will route to my wsl-based OS?
@networktastic
@networktastic 4 года назад
Thanks David, much appreciated. The proxy command was the thing I was unaware of. These WSL2 videos are introducing a bunch of missing pieces that are making what I know already much more useful.
@davidbombal
@davidbombal 4 года назад
You're very welcome Kevin! Glad the videos are helping :)
@rudiklein
@rudiklein Год назад
Your explanations are very clear. This 2 year old video is still relevant. I'm running Ubuntu on WSL 2 on W11 and your video's saved me a lot of time. Thanks!
@victorbacega9699
@victorbacega9699 3 года назад
David, thank you very much! I had a problem developing an application using the Expo platform on WSL 2, and the mobile phone couldn't connect to WSL or Node JS Server, with your video I was able to understand how the network works on WSL2 and used the netsh command to free the application ports. Thank you so much!
@DominicFlynn
@DominicFlynn 2 года назад
I like how you show everyone the documentation you use. Great way to teach.
@bdubs2437
@bdubs2437 2 года назад
Absolutely love your videos, just coming back from 12 years away from Linux. Your videos are fantastic!!
@sergiomancera9225
@sergiomancera9225 3 года назад
Thank you again David. This video unleashes new possibilities for WSL2. Fine work you do getting this information and explaining to us. Again Saludos desde México.
@keivan_adak
@keivan_adak 4 года назад
Theachers like you are not easy to find in the 🌎 Thanks 👏👏👏👏👏
@davidbombal
@davidbombal 4 года назад
Thank you Keivan!
@011sale
@011sale Год назад
Excellent video, the way you explained the matter in such a simple way plus providing so much valuable info helped me out a lot! Amazing how even after 2 years this is still usable.
@uday_kiran
@uday_kiran 2 года назад
I searched around for the complete guide for the process of Getting GUI. Thanks David. I started to learn from you...
@georgealan7772
@georgealan7772 3 года назад
Thank you very much!!! this was what was missing for me I managed to configure my development environment in react-native in wsl2. I was days trying to connect the Axios backend to port 10.0.2.2:3333 with the Android Studio avd emulator 2 days ago and I hadn't been able to. I tried many things without success and now this video was what was missing, and that made it successful. Thank you very much.
@ThePumbaadk
@ThePumbaadk 4 года назад
This is great just what I was looking for, thanks David
@davidbombal
@davidbombal 4 года назад
Thank you. Glad the video helped you :)
@bekman95
@bekman95 2 года назад
Great ! Many many thanks, I was struggling with these stuff. Thank you David.
@TAVG333
@TAVG333 Год назад
Thank you for this! I have been trying to get WSL2 to work with VS Code Live Server for so long and this solution worked! It was the windows firewall portion I had been missing to allow the port :)
@orleydoss3171
@orleydoss3171 3 года назад
Very detailed tutorial 👍 Thank you sir!
@jbenini
@jbenini 4 месяца назад
Your explanation was amazing. I appreciate your content. Thank you, mate!
@prasannakumara6987
@prasannakumara6987 4 года назад
thanks David you improved my knowledge.
@davidbombal
@davidbombal 4 года назад
You are welcome Prasanna
@nokswift
@nokswift 2 года назад
Thank you for such an easy to follow tutorial.
@bharcooldude
@bharcooldude 4 месяца назад
Just used this video to access Immich over local network which I had installed in my WSL 2 Ubuntu. Thanks!
@vtgus
@vtgus 3 года назад
Great explanation David. The beginning was redundant but it works fine to emphasis what IP comes from what node in the network. I would add that this mostly work as it is described but in scenarios when you are using a free port and not reserved like port 80(HTTP) which requires additional steps to get openned
@BenjaminBiswas
@BenjaminBiswas 2 года назад
Great video tutorial about WSL networking, I learned lot's of from your tutorials. Thanks.
@user-go9zr4jk4o
@user-go9zr4jk4o Год назад
Thank you, David. You literally save my day!
@gastonsalaya
@gastonsalaya 3 года назад
Hi David! Your explanation was useful for me , and now I can execute my django web app from the Ubuntu app for Windows 10 and access to the app from my Android device!! Thank you very much!!!!😄👍👍
@agusttt
@agusttt 3 года назад
thank you for writing the command we all came to get on the comments. you are the one.
@michaelcooper5490
@michaelcooper5490 2 года назад
Great video David thanks for the info. I was able to answer my own question by watching your previous video. Thanks again for all the hard work .....
@cuberos7430
@cuberos7430 2 года назад
I clarify several doubts that I had. Thanks a lot !!.🙌
@askanioff
@askanioff Год назад
Genius!! Thank you very much. So many hours wasted until I reach your video.
@KennyGJr
@KennyGJr 3 года назад
This is a great video. I'm new to the whole WSL 2 environment, cause I've been using VMware, but I'll be trying this out on my other laptops for sure. Thanks for the video David, much appreciated. ;-)
@abdulsamihamedi5584
@abdulsamihamedi5584 4 года назад
Big fan david sir!!! Learned a lot from this video looking forward to learn something new from you again 😊
@davidbombal
@davidbombal 4 года назад
Thank you Sameer
@pasanmadhuranga9545
@pasanmadhuranga9545 2 месяца назад
Thanks David, for the clear explanation, you're an rockstart😍⭐⭐
@cloudtech273
@cloudtech273 2 года назад
This was fantastic. Thanks David !
@DomThePsy
@DomThePsy Месяц назад
Thanks for that awsome tutorial!! finally :) good explained. now i can finally connect remote to my wsl machines :)
@shervinrad100
@shervinrad100 3 года назад
everything i needed thank you so so so much!!!
@asaf158
@asaf158 3 года назад
I LOVE YOUR CHANNEL!!! you are amazing! Thanks
@davidwarshawsky1559
@davidwarshawsky1559 11 месяцев назад
I watched the whole video just to figure out I needed to turn off my firewall. Thank you
@DemolaOkesola
@DemolaOkesola 3 года назад
David is the Bomb... All! Thanks David 👌
@sumitsrivastava1021
@sumitsrivastava1021 Год назад
Where were you till now :) I loved your videos. So much best explained content.. May god Bless you and you be a biggest youtuber.
@anwarizzaldin
@anwarizzaldin 3 года назад
David, I am from Indonesia..I am new follower u..nice to meet this ..coz your explanation is always clear
@somaliya
@somaliya 2 года назад
Thanks so much, this video really helped me. I was building ReactJS app inside WSL 2 and wanted to test the app an other computer
@rishabhtomar2174
@rishabhtomar2174 4 года назад
Thanks a lot david. You are such an idol for me. Love from india🇮🇳
@davidbombal
@davidbombal 4 года назад
Thank you!
@murilo.goedert
@murilo.goedert Год назад
You saved my life! Thanks
@xaviercruzPT
@xaviercruzPT Год назад
you are the best, now i can watch plex locally on my tv so I wont lose quality
@luisfelipedasilva7128
@luisfelipedasilva7128 Год назад
Great video, man. Thx for save us
@GuisepeCamoli
@GuisepeCamoli 3 года назад
Greetings from Brazil! Super content!
@zihaosong1514
@zihaosong1514 2 года назад
Absolutely loving this
@fabrice9848
@fabrice9848 3 года назад
thank your for this video, never disappointed
@dominiquerakotonirina5697
@dominiquerakotonirina5697 Год назад
Thanks David, really appreciated.
@kindalost1
@kindalost1 2 года назад
David - great video! thank you.
@hambaku7318
@hambaku7318 3 года назад
YOU ARE AN ABSOLUTE SAINT, I CANNOT THANK YOU ENOUGH FOR THIS TUTORIAL MAN! OH WOOOOOOOOOOOOOOOOOOOOW
@alfonsojosemateoshoyos7615
@alfonsojosemateoshoyos7615 3 года назад
Great video David!
@Lipe007_br
@Lipe007_br 3 года назад
thanks a lot man, you saved my life! :)
@bouhannacheabdallah
@bouhannacheabdallah 3 года назад
Nice work of explanation.
@snowblindu
@snowblindu 29 дней назад
This helped a lot thank you!
@PedrodosSantosPereira
@PedrodosSantosPereira 3 года назад
You helped me a lot, thank you!
@erusman727
@erusman727 3 года назад
Appreciate your help with networking on WSL2. Just sub'd thanks!
@patricio0
@patricio0 9 месяцев назад
Excellent video.
@Magotek8416
@Magotek8416 Год назад
Amazing video!
@vladislavkaras491
@vladislavkaras491 Год назад
Thanks for the video!
@ibrahimabdeltawab6418
@ibrahimabdeltawab6418 4 года назад
Thanks so much David ❤️
@davidbombal
@davidbombal 4 года назад
Thank you Ibrahim
@michaelanderson7902
@michaelanderson7902 4 года назад
That's what I've been wondering why I couldn't ping my wsl2 ubuntu distro thank you very much David this has been helpful
@davidbombal
@davidbombal 4 года назад
Really happy to hear that Michael. Yes, a bit of a paradigm shift this... but you are basically doing networking and running firewalls within Windows :)
@michaelanderson7902
@michaelanderson7902 4 года назад
@@davidbombal Thank you David
@amarashfaq8359
@amarashfaq8359 4 года назад
Amazing video! Thank you David
@davidbombal
@davidbombal 4 года назад
Glad you liked it!
@amarashfaq8359
@amarashfaq8359 4 года назад
@@davidbombal :D
@azelbane87
@azelbane87 3 года назад
ABSOLUTLY A W S O M E !! that was exactly what I was looking for and also the links you provided were the ones I landed on while searching the web!!! THANK YOU (all Educational-youtubers) FOR YOUR TIME AND ENERGY in DOING THIS! As usual the walkthrough and the explanations are PERFECT and crystal clear for anybody! WE LUV U D.Bomb
@Siddid
@Siddid 2 года назад
thanks helped me a lot in my web development
@Michaelmaertzdorf
@Michaelmaertzdorf 3 года назад
Option 2: Bridge mode Solution: Switch from NAT to Bridge mode WSL2 comes by default in NAT mode. There the wsl2 system has another ip in another subnet than the host. The PC is from external peers only visible by the windows IP and the wsl2 ip/net is hidden/internal. So all traffic would need to be accepted by the windows IP and then forwarded to the wsl2 ip (port forwarding). There is another mode called bridge mode. In bridge mode your network interface card will be shared to the wsl2 system, and it will get its own IP/Net in wsl2. So in effect your network card is shared to both systems (windows / wsl2) and will have two IPs, as if you'd have two systems with its own network card each. Cool thing: You will never have port conflicts when Windows uses the same port as well, as your wsl2 app (like 111). Enable bridge mode Open Hyper-V Manager as administrator Select your pc, open Virtual Switch Manager Select WSL Set to external network Select the network card the traffic runs through Then login to wsl2 terminal and configure an IP address. E.g. sudo ip addr add 192.168.0.116/24 dev eth0 You need to use another free IP (not your Windows IP). If your network has a DHCP server your wsl can get one by: sudo ip addr flush dev eth0 sudo dhclient eth0 make sure to start / enable the xrdp service in your linux desktop else you will not be able to start an RDP session.
@null_phase
@null_phase 3 года назад
How does this work in regards to the wsl reroling a new IP on host machine reboot
@null_phase
@null_phase 3 года назад
everytime you start wsl2 it will remake the wsl virtual switch and have it set to incorrect.. i tried script in vid and still not reachable
@jaromirvalek8120
@jaromirvalek8120 Год назад
Thank You so much I have been trying to crack it since 2 days.. Finally it worked.. thanks
@user-qo9ho8oj7k
@user-qo9ho8oj7k Год назад
you are a life saver.
@naninca
@naninca Год назад
Thanks this help me a lot.
@NGANguyenBinhVTID
@NGANguyenBinhVTID 16 дней назад
Thank you a lot, you made my day
@ganeshchippa1
@ganeshchippa1 4 года назад
Good content. Thank You Sir
@davidbombal
@davidbombal 4 года назад
Thank you Ganesh
@sahilsagwekar
@sahilsagwekar 11 месяцев назад
I love you so much man!!!
@allezvenga7617
@allezvenga7617 3 года назад
Thanks for your sharing 👍
@mariembuenaventura1278
@mariembuenaventura1278 4 года назад
Thanks dad! Didn't skip an ad.
@davidbombal
@davidbombal 4 года назад
I appreciate that!
@konstantinosvlitakis
@konstantinosvlitakis 4 года назад
Thank you David for yet another great video! I was wondering if it is possible to connect your Windows 10 Home laptop with an ethernet cable and then create vlans on the laptop interface (as a trunk interface) and assign each WSL2 virtual machine (ubuntu instances) on a different vlan. Did you happen to come across such an information during your research on WSL2?
@Xewl
@Xewl 3 года назад
Came here after researching and hitting the GH issues etc. Good explanation. I only wish it wouldn't be such a pita -.- I already have Shayne's hacks in place, had it for WSL1 too. I needed WSL2 for docker & they take away bridge mode; that's ludicrous. On the verge of just switching to Linux all by itself. xD
@arriyari
@arriyari Год назад
you save my life 🥺
@wingwing2683
@wingwing2683 2 года назад
Thanks David!
@FajarSuryawan
@FajarSuryawan 3 года назад
Thanks, David. A wonderful series on WSL2! I have a question. Is it possible to have more than 1 Linux on a Windows 10, and have all the three connected? Possibly on the same subnet? Suppose I have Ubuntu and Kali on the same Windows 10.
@AbulHasanLakhani
@AbulHasanLakhani 3 года назад
Hi David, Thanks for this. Where do you run that PS script from? From your host machine or from your WSL2 Ubuntu machine? I would assume it would be from my host machine which is Windows 10
@fruitsbasket6141
@fruitsbasket6141 3 года назад
i like your network speed
@robisadev
@robisadev 6 месяцев назад
I honestly wanted to slap myself after trying this for every evening for three days and only after reaching today Firewall Rules did I figure out why everything I was trying was not working. That should have been step 5!
@jlocana1
@jlocana1 3 года назад
thanks you are the best of the best
@waasabbas
@waasabbas 4 года назад
Hi David.Thanks for every thinge you are doing in Yourube Or Udemy. I passed My CCNA today 😂😂😂.
@davidbombal
@davidbombal 4 года назад
Fantastic! Congratulations!
@user-uu1bx4xv1s
@user-uu1bx4xv1s 3 года назад
so helpful
Год назад
Very nice tutorial, David!. I used it to configure ssh access from a chromebook to Ubuntu in a WSL and I managed to get it working. Thanks!!! I have to run the netsh command everytime but it's ok for me. One question: Is it safe to have the port 22 open in Windows Firewall Defender (with Public domain unchecked?) Thanks again for your help. Cheers!
@alexandrecaldeira9522
@alexandrecaldeira9522 3 года назад
LIFE SAVER!
@zeonsoulon4433
@zeonsoulon4433 3 года назад
thx so much sir
@ctoxyz
@ctoxyz Год назад
#excellent vids
@nsteblay
@nsteblay 3 года назад
Thank you!
@SachinKumar-qk9yu
@SachinKumar-qk9yu 3 года назад
Hi David thanks for the valuable information. I have a question when I connect cisco VPN in local laptop there is network connectivity issues inside WSL2 please help on this
@ryanlin1014
@ryanlin1014 3 года назад
Hi David, what a useful video for me and I have one more question. After run the netsh command line between the host computer and wsl2, if the host computer need the proxy(proxy script or proxy server which setting in windows network and internet) to access the external website, is it this proxy also in effect the wsl2? The wsl2 can access the external website by this proxy?
@refaiabdeen5943
@refaiabdeen5943 Год назад
Cheers Mate
@umairm8595
@umairm8595 4 года назад
Hi David thanks for the video, What I was wondering is that is there a GNS3 VM in WSL2 virtual machine that I could use to integrate in GNS3 or EVE-NG WSL 2 instead of using vmware player?
@petrostrak7737
@petrostrak7737 3 года назад
Great video thanks! One thing opened to question. Could you establish a vpn connection on wsl2 (let's say via openfortivpn to connect to office) and open a remote desktop from win10 to that vpn connection?
@alejandrorodriguez3771
@alejandrorodriguez3771 3 года назад
David, it would be very good if you made a video about the interaction between 2 WSL VM in order to test, for example, kali tools vs ubuntu. In order to do that, the 2 VMs need to have 2 different IP addr in the same subnet (connected to the same vshiwtch) or with different IP subnet routable through the windows host (I dont know if it is posible). When you boot 2 WSL VMs, they have the same IP addr, it is like if they were connected to different vshwitch with the same ip subnet but with the same default Gateway. It is also extrange to me that the MAC address in the ARP table of the windows host, is the same for both VMs. Thanks and sorry for my english.
@nikhilranka9660
@nikhilranka9660 2 года назад
Thanks for the detailed tutorial. Any tutorials on getting WSL2 to connect to the internet with VPN turned on on Windows?
@BattousaiHBr
@BattousaiHBr 3 года назад
hello david. since the dynamic IP for the WSL VM changes every boot, wouldn't it be easier to instead NAT the port to the localhost IP? since, as we can see at 4:45 it also works. this way you don't need to bother with scripts. another option, wouldn't it be possible to force the IP to be static from the VM side? with the usual ifcfg-eth0 file.
@yoginugroho8917
@yoginugroho8917 Год назад
thanks sir
@gabrielcastro832
@gabrielcastro832 2 года назад
Thanks David, have a question: Do you know how to configure a static ip address to the wsl2 ubuntu
@thelazyprogrammer_
@thelazyprogrammer_ 4 года назад
Thank you sir.
@davidbombal
@davidbombal 4 года назад
Thank you for watching Maxwell
@thelazyprogrammer_
@thelazyprogrammer_ 4 года назад
@@davidbombal I really admire your style and the way you teach. Your courses are helping me a lot. Keep them coming sir.
@edwardhoffenheim3249
@edwardhoffenheim3249 4 года назад
another question since you're on the topic on networking. How do you access local host on WSL2? From my searches it seems its not as intuitive as just using "localhost" like in WSL. So currently can't do database on a windows hosted database from WSL2.
Далее
WSL 2: Getting started
20:34
Просмотров 692 тыс.
Windows Terminal: Finally!
17:04
Просмотров 391 тыс.
Повага | GOVOR TikTok #govor #shots
00:53
Просмотров 290 тыс.
小路飞被臭死啦!#海贼王#路飞
00:27
Просмотров 2,1 млн
The Ultimate #WSL2 Guide - Part 1 - Tour
35:13
Просмотров 20 тыс.
Proxmox NETWORKING: VLANs, Bridges, and Bonds!
25:09
Просмотров 130 тыс.
WSL2 Ubuntu GUI
13:51
Просмотров 582 тыс.
The Pros and Cons of Linux in Windows
10:48
Просмотров 40 тыс.
iPhone 16 - КРУТЕЙШИЕ ИННОВАЦИИ
4:50
Телефон в воде 🤯
0:28
Просмотров 1,2 млн