VirtualBox VM cannot connect to internet via NAT


totem

I'm trying to figure out why my guests can't connect to the internet when they're connected to a NAT network. I have provided screenshots of the settings below. I only have this problem on lubuntu. My friend and I both work on 2 different linux systems with all default settings without any modifications.

ifconfigDoing it on the guest tells me that there is an IP assigned in the range shown in the first picture below (it's just the default). I haven't changed any of its default settings other than what's shown below.

BTW, I have the same problem with any VM I install on VirtualBox with lubuntu as host OS. Bridged and host-only connections work fine.

VirtualBox Preferences:

VirtualBox Preferences

Guest network settings:

Guest network settings

edit:

Some information about system and network settings:

cat /etc/network/interfaces

auto lo
iface lo inet loopback

Guest OS: lubuntu 17.04

OS host: lubuntu 17.04

VirtualBox version: 5.1.22_Ubuntur115126 (output of VBoxManage --version)

(Sorry, can't capture the whole screen. My screen capture tool can't get close-ups from the virtual machine) ifconfig -a: enter image description here

route-n: enter image description here

arp -n: enter image description here

Every

Update : In conclusion, you are using the NAT-Network/NAT-Service interface . This is a different interface type than the similarly named NAT interface . The differences are well described in this blog post:

When you switched from a NAT-Network Interface to a NAT interface you were able to access the internet from your VM without additional configuration. Since this was your ultimate goal, we didn't continue to diagnose what was causing trouble for your NAT-Network interface.

The original solution follows.


I don't know enough to make a certain diagnosis based on the information you've provided so far, but one possibility is that there's a conflict between the VirtualBox network configuration on the host and the network configuration on the guest.

I suggest trying to start from a working NAT configuration with port-forwarding to allow for SSH access to the guest. There are several reasons for this:

  1. You aren't able to copy text from the guest in your current situation.

  2. It is often helpful in debugging to start from a situation in which everything is working and then work your way back towards the problem.

  3. In my experience is the NAT interface is the most painless and least error-prone method of getting internet access for a VirtualBox guest.

You can do this via the GUI, but I'll include command-line examples for concreteness.

First let's remove all of network interface cards:

for n in 1 2 3 4 5 6 7 8; do
    vboxmanage modifyvm "${VMNAME}" --nic${n} none
done

Now let's add a single NAT interface:

vboxmanage modifyvm "${VMNAME}" --nic1 NAT

Let's sanity-check the NIC configuration:

vboxmanage showvminfo "${VMNAME}" | grep '^NIC'

The output should something like this:

NIC 1:          MAC: 08002784C3DE, Attachment: NAT, Cable connected: on,
                Trace: off (file: none), Type: Am79C973, Reported speed: 0
                Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
NIC 1 Settings: MTU: 0, Socket (send: 64, receive: 64), TCP Window (send:64, receive: 64)
NIC 2:           disabled
NIC 3:           disabled
NIC 4:           disabled
NIC 5:           disabled
NIC 6:           disabled
NIC 7:           disabled
NIC 8:           disabled

Now let's add a port-forwarding rule for ssh. Here is an example which maps port 2222 on the host to port 22 on the guest:

vboxmanage modifyvm "${VMNAME}" --natpf1 ssh,tcp,,2222,,22

Boot the VM and test the SSH connection. If you already have SSH running on the guest then you can boot it in headless mode:

vboxmanage startvm --type headless "${VMNAME}"

Log in to the guest via ssh:

ssh -p 2222 localhost

Note that you don't need to know the guest's IP address because of the port forwarding rules. If you have access to this, you can update your post and we can try to find out what's wrong with the "NAT Network" configuration.

Also, you might want to try downloading a preconfigured VM from the Virtual Boxes website . Apparently they have some lubuntu images .

Related


VirtualBox VM cannot connect to internet via NAT

totem I'm trying to figure out why my guests can't connect to the internet when they're connected to a NAT network. I have provided screenshots of the settings below. I only have this problem on lubuntu. My friend and I both work on 2 different linux systems w

VirtualBox VM cannot connect to internet via NAT

totem I'm trying to figure out why my guests can't connect to the internet when they're connected to a NAT network. I have provided screenshots of the settings below. I only have this problem on lubuntu. My friend and I both work on 2 different linux systems w

Connect to Ubuntu VM on Virtualbox via putty and access internet

Maha I want to run Ubuntu on VirtualBox. I have downloaded the prepared virtual machine online. Also tried running the VM. Now I want to have internet connection on this machine and also want to connect to Ubuntu 32bit Guest OS from my host machine (Windows 7

Connect to Ubuntu VM on Virtualbox via putty and access internet

Maha I want to run Ubuntu on VirtualBox. I have downloaded the prepared virtual machine online. Also tried running the VM. Now I want to have internet connection on this machine and also want to connect to Ubuntu 32bit Guest OS from my host machine (Windows 7

Unable to connect CentOS VM to internet (NAT connection)

Gordisk So, after battling the VMWare networking giant for a day, I decided to give in and ask for help. I'm running a CentOS 6 image on Windows 7 with NAT on VMWare Workstation 8.0.2 build-591240 and for some reason I can no longer connect to the internet wit

Can't connect to internet in VirtualBox VM - Ubuntu

Milad Na I have installed Ubuntu on a VM in VirtualBox and created 2 clones from it. Everything was fine, but after a while the internet connection failed for all VMs in VirtualBox. Here are the network settings: bridge adapter allow all (I also checked allow

Can't connect to internet in VirtualBox VM - Ubuntu

Milad Na I have installed Ubuntu on a VM in VirtualBox and created 2 clones from it. Everything was fine, but after a while the internet connection failed for all VMs in VirtualBox. Here are the network settings: bridge adapter allow all (I also checked allow

Can't connect to internet in VirtualBox VM - Ubuntu

Milad Na I have installed Ubuntu on a VM in VirtualBox and created 2 clones from it. Everything was fine, but after a while the internet connection failed for all VMs in VirtualBox. Here are the network settings: bridge adapter allow all (I also checked allow

Unable to connect to VirtualBox VM from Kubuntu host using NAT

Gilberts I am using Kubuntu 13 as host and Xubuntu 12 as guest. In the VM network options, I selected NAT, and like 127.0.0.1:23 => 10.0.2.15:22. I can access the internet from the guest, but when I try to SSH to the guest, I get connection refused. Recently I

Virtualbox Ubuntu 17.04 cannot connect to internet

Language Azat I have upgraded Ubuntu 16.04 LTS to 17.04 last two days ago. Since then I've been trying to connect to the internet and trying to change the "Bridged Adapter" under Settings > Network. Leave on "NAT" (as the default option); still useless. I've t

Virtualbox Ubuntu 17.04 cannot connect to internet

Language Azat I have upgraded Ubuntu 16.04 LTS to 17.04 last two days ago. Since then I've been trying to connect to the internet and trying to change the "Bridged Adapter" under Settings > Network. Leave on "NAT" (as the default option); still useless. I've t

Headless VirtualBox VM NAT Networking

Brock Hensley I have a remote linux server that is only accessible via SSH. My goal is to host multiple virtual machines on this host server using VirtualBox. The host server has 1 IP address so will be routed to the VM using NAT, for example 10022 will be for

Headless VirtualBox VM NAT Networking

Brock Hensley I have a remote linux server that is only accessible via SSH. My goal is to host multiple virtual machines on this host server using VirtualBox. The host server has 1 IP address so will be routed to the VM using NAT, for example 10022 will be for

Virtualbox NAT network not connected to internet

Asarluhi I installed Ubuntu Server 16.04.3 in two Virtualbox virtual machines , then created the NAT network and DHCP server using the following commands in the host machine: $ vboxmanage natnetwork add --netname testlab --network "10.10.10.0/24" --enable $ vb

Virtualbox NAT network not connected to internet

Asarluhi I installed Ubuntu Server 16.04.3 in two Virtualbox virtual machines , then created a NAT network and DHCP server using the following commands in the host machine: $ vboxmanage natnetwork add --netname testlab --network "10.10.10.0/24" --enable $ vbox

Virtualbox NAT network not connected to internet

Asarluhi I installed Ubuntu Server 16.04.3 in two Virtualbox virtual machines , then created the NAT network and DHCP server using the following commands in the host machine: $ vboxmanage natnetwork add --netname testlab --network "10.10.10.0/24" --enable $ vb

Putty cannot connect to second VirtualBox VM on Windows 10 host

h I am running VirtualBox on Windows 10. I've been using PuTTY to connect to my Ubuntu 16.04 VM for a while now. I finally decided to use Ubuntu18.xx. So I started a new VM and configured it like I would configure a 16.04 VM. I added SSH keys and went through

Putty cannot connect to second VirtualBox VM on Windows 10 host

h I am running VirtualBox on Windows 10. I've been using PuTTY to connect to my Ubuntu 16.04 VM for a while now. I finally decided to use Ubuntu18.xx. So I started a new VM and configured it like I would configure a 16.04 VM. I added SSH keys and went through

Putty cannot connect to second VirtualBox VM on Windows 10 host

h I am running VirtualBox on Windows 10. I've been using PuTTY to connect to my Ubuntu 16.04 VM for a while now. I finally decided to use Ubuntu18.xx. So I started a new VM and configured it like I would configure a 16.04 VM. I added SSH keys and went through

Putty cannot connect to second VirtualBox VM on Windows 10 host

h I am running VirtualBox on Windows 10. I've been using PuTTY to connect to my Ubuntu 16.04 VM for a while now. I finally decided to use Ubuntu18.xx. So I started a new VM and configured it like I would configure a 16.04 VM. I added SSH keys and went through

Unable to connect VM in VirtualBox

jayftw I couldn't find any help anywhere, so I wanted to ask a question here. I have two VirtualBox VMs, one Fedora 23 and one Windows7. I'm trying to get them to communicate via VirtualBox using a virtual network (I hope that's the correct term). I have tried