How to get rid of vboxnet0 NIC from command line on Windows - windows-10

I have a virtual machine created by vagrant on Ubuntu 14.04 (VirtualBox 5.0.10). It has two NICs. NIC1 is NAT, NIC2 is hostonly.
After importing that machine to VirtualBox 5.1.8 on Windows 10 I cannot run it as VBox complains that vboxnet0 (adapter 2) cannot be found.
If I show VM info in command line at this point (VBoxManage showvminfo "myvm") NIC2 says:
Attachment: Host-only Interface 'vboxnet0'
.
I found a workaround: disable NIC2 in VBox GUI and then enable it again. If I do this and run showvminfo again then NIC2 says:
Attachment: Host-only Interface 'VirtualBox Host-Only Ethernet
Adapter'
and machine will boot.
I'm looking for a way to automate this from command line. I tried to do this:
VBoxManage modifyvm "myvm" --nic2 none
VBoxManage modifyvm "myvm" --nic2 hostonly
but then it sets back 'vboxnet0'.
How to force it to set proper Windows hostonly adapter from command line?

Solution:
VBoxManage modifyvm "myvm" --hostonlyadapter2 "VirtualBox Host-Only Ethernet Adapter"

Related

VirtualBox: Host can not SSH to Guest

i'm having some issue with m VirtualBox installation, 6.1.22.
I have a VM with SUSE (SL12P1) for 64bit as a guest operative system, I have already installed the extension package and I'm trying to reach the guest from the host-system (Windows10) using ssh.
I have set the network adapter as "Bridge", in this way the guest has a 192.168.120.x IP, which i verified with ifconfig while the host has an IP of 192.168.120.y.
I can ping the guest from the host, but I cannot ssh the guest from the host system.
Notice that:
The firewall has been disabled
I have enabled Hyper-V virtualization.
I have tried setting the network adapter as NAT, and use port forwarding, but the ssh does not work either
The firewall for SuSE was active by default, after disabling it everything worked.

net.ipv4.ip_forward lxc vm ping DUP

I run LXC Linux containers and so I have net.ipv4.ip_forward=1 set on the host so that I can ping internet (google.com) from inside the LXC container.
However, when I run VirtualBox VMs in the same environment and bridge to the wlan wireless interface I get duplicate ICMP packets (DUP!). I can stop the duplicate packets in the VirtualBox VM by setting net.ipv4.ip_forward=0 on the host, but then this breaks the resolution of internet in the LXC containers.
How can I prevent the DUP! pings in the VM and leave net.ipv4.ip_forward=1 set? Thanks.

scan and connect to wifi from linux terminal on virtual machine

I am trying to scan wifi networks via Linux terminal running on a virtual machine. I am running virtual machine on Mac OS. On MAC terminal, I can see all WIFI networks using (airport) command and can connect to one network.
The NetworkAdapter setting for Vistual machine is set to "Share with MAC".
On Linux terminal, When I do ifconfig -a, I get
eth0 & lo
However, when I type : sudo iwlist eht0 scan , I get error message:
sudo iwlist eht0 scan
Can someone help that how I can do that with Linux running on virtual machine ? ? What I am doing wrong . .
On every VM I've ever seen, the virtual machine emulates the WiFi interface of the host OS (Mac) as an ordinary wired interface to the guest OS (Linux). Therefore you can't scan for WiFi networks from the Linux, because as far as it's concerned, it's not a WiFi interface.
The exception to this would be if you attached a USB WiFi adapter and had the guest OS natively recognize it as a USB device (meaning it would be ignored by the host OS). Note this may not work on some virtual machines; VirtualBox is particuarly bad at recongizing network adapters.
well if you:
nmcli dev wifi
it will show you all the wireless access points (ESSID) available then you can
nmcli dev wifi connect $ESSID password $PASSWORD
example
nmcli dev wifi connect "School Hotspot" password "q5w4e3r2t1y0"
That kinda thang :-)

Cannot access ubuntu server from other machines other than the machine which is hosting the virtual machine which is my ubuntu server

I created a ubuntu server on vmware. I am using it as a file server. I can access it if I am connecting through the machine which hosts the virtual machine. I am not able to do it from other machines which are on the same network. Thanks in advance!
First of all make sure in the setting of the virtual machine that it is in Bridged Adaptor type connectivity.
Give a static ip to the virtual machine using
sudo ifconfig eth0 10.0.0.100 netmask 255.255.255.0
the above is an example. You got what I mean.
3.Third, Try pinging the virtual machine with the base machine running the vbox to make sure they are connected.
ping ipaddress-basemachine
4 . Now if everything is working fine from there then connect with this virtual machine with other base machine using Remote Desktop Viewer or any other similar application.
Specify, the ip-address of the vbox and username, password. It will be able to connect with it now.
5 . If it still is not able to then try to check the firewall rules on both the virtual box machine and the base machine running the vbox using the command
iptables -L

Moving a VirtualBox .vdi Linux machine to a new host computer

I've been happily using an Ubuntu 12.04 VM as a webserver with a static IP running on VirtualBox on my Windows 7 machine for a few months (working on it from the host computer, bridged network connection, accessing via SSH from host and sharing folders through windows).
In /etc/network/interfaces, I've got:
address 192.168.1.112
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameservers 194.168.4.100 194.168.8.100
I tried creating a new VM with it on my Win7 laptop by copying across the .vdi and creating a new VirtualBox machine with it, then changing the static IP to 192.168.1.116, but I'm not getting any network... It can't ping anything, when I try to SSH into the VM, it says "connection rejected" and it doesn't show up anywhere in my Windows network.
Can anyone shed any light?
"Perryg" on the VirtualBox forums solved it:
Edit the /etc/udev/rules.d/70-persistent-net.rules, or you can delete the rules and Linux will configure it on the next boot.
That's all there was to it.

Resources