Connect to Ganache GUI from WSL2

I am attempting to connect to Ganache GUI from WSL2 but assume that I have a firewall setting that is blocking the connection.

Has anyone set this up and has any advice?


1 Like

@abcoathup unfortunately, I don’t have much insight on this. I still use WSL as I haven’t had time to upgrade to WSL2.

Also, I haven’t used Ganache GUI since early this year. After learning that I could fork mainnet with Ganache CLI, I completely switched to that and removed the GUI.

I’m curious, how are you trying to connect the GUI to your WSL2 terminal? Is there an option for this in the GUI?

From what I recall when I was using the GUI, I always used a config file in my project directory that connected to the same port as the GUI for development. This was usually handled in a Truffle config file. I think the GUI defaults to port 7545, but should be visible on the GUI.

Or are you talking about interacting with the GUI directly from WSL2 without a config file or project directory? I’ve always had a project directory with web3.js or ethers.js installed to interact with the blockchain. Maybe you could install globally but I’ve never done this. If you have access to either of these libraries in the terminal though you can instantiate an instance of web3 and specify your provider in WSL2. For a local Ganache instance, this would be something like

var Web3 = require('web3');
var web3 = new Web3('http://localhost:7545');
var web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:7545'));

Not sure if this is very helpful. I’d love to help more if I can, but I just need more details on how you’re trying to connect the two.

1 Like

Here are some resources I found on this:

1 Like

Hi @Jshanks21,

I have Ganache GUI installed on Windows and was trying to access from WSL2.

I don’t have any issues connecting to ganache-cli running on WSL2 so assume it is a firewall issue from node on WSL2 to Ganache GUI on Windows.

I had wondered if you had managed to set this up. Thanks for all the links.

I will probably just use node on Windows to connect to Ganache GUI on Windows until I get a chance to investigate further.


Hi @Jshanks21,

I just tried a DuckDuckGo search for “ganache gui on wsl” and this post is the top search result :smile:


Hahaha glad to know we’re blazing a trail with this one @abcoathup

1 Like

Did you guys find any solution on how to use Ganache gui with wsl2. I only found this thread searching the internet.
Wsl2 is a great initiative by windows and it feels same as ubuntu speeds if your source code resides on ubuntu file system more than on the windows files (/mnt/c/Documents) . Wsl2 doesnt allow linux gui as of now. I found this article on how to setup linux gui in wsl2 but I didnt want to experiment with my new laptop.

Any help is greatly appreciated.

1 Like

Hi @godfather,

Welcome to the community :wave:

I haven’t found/tried a solution. I am also reluctant to mess to much with my setup in case I kill my ability to work.

One option appears to be to use RDP and run a desktop on Linux. I don’t know what the experience would be like though:


I just had this problem using Ubuntu under WSL 2 connecting to the Ganache windows GUI.

Installing ganache-cli locally worked fine (as hinted by @abcoathup, ta), but still could not connect ‘across’ to the Ganache windows GUI.

Fix for me was to change the network settings from the default loopback interface to the WSL one. I also have to open the correct port up in Windows Firewall.

FWIW I’m on the dev channel of Windows Insider, so my WSL is bang up to date.


Hi @Bealers,

Welcome to the community :wave:

Thanks for sharing. I will have to try that out.

I was able to get the Ganache GUI in Windows to connect to a ganache-cli running in WSL2 (ubuntu 20). Start the ganache-cli in WSL2 first and then setup a Ganache Gui workspace in Windows after that, where the server is set to the “ - All Interfaces” host. This was the only way I could get it working :beers:

1 Like

Hi @Argyle,

Welcome to the community :wave:

Thanks for sharing your working method. :pray:

This worked for me. Thank you!


This also worked for me, it appears that the loopback address isn't connectible from wsl2

thanks for this bro, ahaha, it saves my day. lol

You guys are the best, this works flawlessly.

Protip: for anyone where this still doesn't work, once you start your ganache-cli and ganache gui application, make sure you change the port in the GUI to that of the CLI before you save and restart.
E.g. for me:

1 Like

I think I might be trying to do the reverse. I have created a new truffle project on my WSL Ubuntu distro, and now I want to use Ganache GUI to view the state of my project. I couldn't get it to install on Ubuntu so I installed it on Windows 10. Is there a way to view my project on windows 10 when I have created it on Ubuntu with truffle init?

1 Like

Thanks a million !!!!

Thanks, it worked for me now :slight_smile: