Debian 10 Wireless access from within a VirtualBox VM

KenHorse

New Member
Joined
Mar 12, 2021
Messages
17
Reaction score
6
Credits
137
Seems the normal conventions don't work as I can't seem to use the usual methods of configuring wpa_supplicant to get wireless working.

ifconfig reports no LAN connection (there isn't) but does report wireless with an IP of 10.0.2.15. I have no idea as my LAN (and wireless router) uses a 192.x.x.x subnet

So am I not able to get a wireless connection from within the VM?
 


Adithyansm

Active Member
Joined
Nov 11, 2021
Messages
212
Reaction score
86
Credits
1,514
Do you have an external wifi adapter
 

gvisoc

Well-Known Member
Joined
May 29, 2020
Messages
416
Reaction score
486
Credits
4,265
If you just want to have internet connectivity from the VM, you don't need to mess with the wireless; VirtualBox will configure for you a default ethernet adapter as attached to NAT. This means that your VM will get internet connectivity through a LAN adapter regardless what kind of network your host machine is connected to.

This is also the default configuration (i.e., you get this without touching anything), so please tell us what exactly did you do.

Like this:

1638159769222.png


KenHorse said:
ifconfig reports no LAN connection (there isn't) but does report wireless with an IP of 10.0.2.15. I have no idea as my LAN (and wireless router) uses a 192.x.x.x subnet

For the looks of it, you are already configuring things attached to NAT, as 10.0.2.15 is the address that the adapters will get privately behind the NAT. What I don't get is why your VM's operating system reports the network adapter as wireless.
 
Last edited:
OP
K

KenHorse

New Member
Joined
Mar 12, 2021
Messages
17
Reaction score
6
Credits
137
This Windows machine I'm running this on doesn't have a hardwired LAN connection - it connects to my LAN via wireless. There is no CAT cable connected at all.

What is interesting is that if I ping from the VM Linux, it does resolve hostnames and pings fine. But I was hoping to be able to connect to the VM from another computer, ie SSH, etc. This is an HP with a native dual band wireless interface
 

dos2unix

Well-Known Member
Joined
May 3, 2019
Messages
1,448
Reaction score
1,053
Credits
8,951
so it doesn't connect or it cant do ssh?

Instead of NAT, change to Bridged. Then it will be on the same subnet as your host machine.
It will see your wifi as a LAN interface. ( likely eth0 )
I've had mixed results running VMs through Wifi.
 

gvisoc

Well-Known Member
Joined
May 29, 2020
Messages
416
Reaction score
486
Credits
4,265
This Windows machine I'm running this on doesn't have a hardwired LAN connection - it connects to my LAN via wireless. There is no CAT cable connected at all.
It doesn't matter. None of my computers have wired network, but the VM can connect through NAT using a virtual wired adapter. Here's the proof: I am on the train to work, using my phone as a hotspot, and you can see the host (Fedora) connected through WiFi, and the Guest (Windows 11) using a virtual wired network adapter with a nice web loaded.

Screenshot from 2021-11-30 07-36-30.png


Again, if you don't touch anything, NAT works by default as I said: Guest OS will use a wired adapter, no matter the host physical machine uses wireless. But it works to access the internet. From the rest of your messages it would seem you're trying to have the VM connected to the rest of your network. If so, go ahead to my next reply.

Still, the kind of virtual network adapter never matters no matter the network mode. What did you exactly do to force the VM to use a virtual wireless adapter?
 
Last edited:

gvisoc

Well-Known Member
Joined
May 29, 2020
Messages
416
Reaction score
486
Credits
4,265
What is interesting is that if I ping from the VM Linux, it does resolve hostnames and pings fine. But I was hoping to be able to connect to the VM from another computer, ie SSH, etc. This is an HP with a native dual band wireless interface
If you want to use the VM as another machine in your network, then you may need to use Bridged mode as @dos2unix said, or NAT Network (which is not the same as "attached to NAT"). This is probably the information we needed to begin with. Before you do, let me re-emphasise that the kind of virtual network adapter (wired ethernet or wifi) doesn't matter; it doesn't relate with your phisical network adapter at all.

Check this resource to understand how every single networking mode of VirtualBox works, and how the network diagram would look like --it's pretty good: https://www.nakivo.com/blog/virtualbox-network-setting-guide/
 
Last edited:
OP
K

KenHorse

New Member
Joined
Mar 12, 2021
Messages
17
Reaction score
6
Credits
137
Instead of NAT, change to Bridged. Then it will be on the same subnet as your host machine.
It will see your wifi as a LAN interface. ( likely eth0 )
I've had mixed results running VMs through Wifi.

This fixed it, thanks!
 

Tolkem

Well-Known Member
Joined
Jan 6, 2019
Messages
1,456
Reaction score
1,177
Credits
10,567
Seems the normal conventions don't work as I can't seem to use the usual methods of configuring wpa_supplicant to get wireless working.
Just so you know, as a security design, VMs can't use wireless connections by default; they all connect via a virtual wired network adapter, regardless of the type of connection the host uses. All you needed to do was let VBox use the virtual network adapter and that was it.
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Linux.org Hosting Donations
Consider making a donation

Members online


Top