karandash8 / virtualbox_wsl2 Goto Github PK
View Code? Open in Web Editor NEWPlugin allows Vagrant to properly use VirtualBox as a provider from WSL2.
License: MIT License
Plugin allows Vagrant to properly use VirtualBox as a provider from WSL2.
License: MIT License
I am trying to connect to a Windows VM running on windows host from WSL2. The virtualbox site says its possible to run Windows Server in virtualbox but I cannot see to get past critical issue with hardware acceleration when VB starts.
Has anyone used this to connect to Windows VM?
i faffed about for ages trying to hack manual fixes for vagrant + wsl, manual attempts to do firewall and network changes, but in the end, your plugin was the thing that made it all work.
thank you so much for you contribution to the community ❤️
feel free to close! i just wanted to make sure i expressed my gratitude somehow. i hope seeing an "issue" popping up in your mail didn't cause any undue stress.
I'm on W11 with WSL2 and Debian 11 as guest.
I've installed the plugin but when i make vagrant ssh
on wsl i've a denied issue.
If i make ssh vagrant@localhost -p 2222 -i c:/Users/Amaury/Documents/Documents/Cours/M1/reseau/TP/tp3/VM1/.vagrant/machines/default/virtualbox/private_key
on Powershell it's working well.
My vagrant ssh-config
output :
Host default
HostName 172.17.160.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /mnt/c/Users/Amaury/<My Path>/VM1/.vagrant/machines/default/virtualbox/private_key
IdentitiesOnly yes
LogLevel FATAL
When using wsl-vpnkit it does return address that can't connect to SSH/RDP. I have a fork that does use the same method that wsl-vpnkit by grepping address from /mnt/wsl/resolv.conf instead.
VM is created but the console just hangs at default: SSH auth method: private key
and later times out. I can ssh into the VM using host IP from WSL
Thanks for building this very useful utility!
After installing the virtualbox_WSL2 plugin, I found that it was not working for me. After some troubleshooting, I found that the problem was the Windows Firewall. It worked fine with the firewall disabled.
This should be documented in the README.
The specific problem is that from the host's perspective, the VirtualBox VMs appear to be in the public zone. This cannot be changed (Windows limitation). In addition, depending on your configuration, traffic in or out of the VM may get blocked by the firewall.
I found that the following PowerShell script opens the firewall enough, without completely disabling it. Note: this script only allows DNS traffic, which was the problem for me. You may need to open additional ports.
$adapters=(Get-NetAdapter | Where-Object Name -like 'vEthernet*')
Set-NetFirewallProfile -DisabledInterfaceAliases $adapters.Name
# For VirtualBox, we also need to allow DNS to/from anywhere
# If security is a concern, you could also set -RemoteAddress but we do not do that here
# for flexibility
New-NetFirewallRule -Name UsdDNSReq -DisplayName "Allow DNS Req" -Direction Inbound -LocalPort 53 -Protocol UDP -Action Allow
New-NetFirewallRule -Name UsdDNSResp -DisplayName "Allow DNS Resp" -Direction Inbound -RemotePort 53 -Protocol UDP -Action Allow
New-NetFirewallRule -Name UsdDNSTCPReq -DisplayName "Allow DNS TCP Req" -Direction Inbound -LocalPort 53 -Protocol TCP -Action Allow
New-NetFirewallRule -Name UsdDNSTCPResp -DisplayName "Allow DNS TCP Resp" -Direction Inbound -RemotePort 53 -Protocol TCP -Action Allow
The vagrant landrush plugin adds the VMs to a VM-only DNS server. It works well on Linux, and on Windows/WSL2 with Hyper-V as provider. It does not seem to work with landrush, apparently because the landrush plugin obtains the 127.0.0.1 IP address.
When using the virtualbox_WSL2 plugin and the landrush plugin together, you will get the following error message:
==> myvm: Automatic installation for Landrush IP not enabled
==> myvm: [landrush] Setting up iptables rule on guest for DNS server 10.0.2.3
==> myvm: [landrush] network: :private_network, {:type=>"dhcp", :auto_config=>true, :protocol=>"tcp", :id=>"60b3de88-160b-491e-a0eb-02548fc6d554"}
==> myvm: [landrush] network: :forwarded_port, {:guest=>22, :host=>2222, :host_ip=>"127.0.0.1", :id=>"ssh", :auto_correct=>true, :protocol=>"tcp"}
Guest-specific operations were attempted on a machine that is not
ready for guest communication. This should not happen and a bug
should be reported.
Normally, this error message indicates that the landrush server is not running; the command "vagrant landrush start" would resolve this. However, with virtualbox_WSL2, this solution does not work.
To reproduce:
vagrant plugin install landrush
vagrant landrush start
And in the Vagrantfile, add the following:
instance.landrush.enabled = true
instance.landrush.tld = [ 'vagrant' ]
instance.landrush.upstream '1.1.1.1'
Currently the hostsupdater
Vagrant plugin only updates the hosts
(/etc/hosts
) file on the WSL 2 Linux system, but not also on the Windows host system (C:\Windows\System32\drivers\etc\hosts
). It would be nice if this plugin could somehow add this functionality.
When running vagrant plugin install virtualbox_WSL2
in my wsl ubuntu
I am getting below error
Installing the 'virtualbox_WSL2' plugin. This can take a few minutes...
Vagrant failed to load a configured plugin source. This can be caused
by a variety of issues including: transient connectivity issues, proxy
filtering rejecting access to a configured plugin source, or a configured
plugin source not responding correctly. Please review the error message
below to help resolve the issue:Net::OpenTimeout: Failed to open TCP connection to gems.hashicorp.com:443 (execution expired) (https://gems.hashicorp.com/specs.4.8.gz)
Source: https://gems.hashicorp.com/
It would be great if this plugin also makes SMB/NFS shared folders possible.
Currently there is an error for each share type as some setup is missing.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.