How to fix/set up routing from host to guest on VirtualBox?


Jonathan

I am using Debian Stretch to run a Debian jessie guest. I have a guest setup using NAT and a host-only adapter. When I try to ping my guests from the host, my pings are routed to my wireless internet adapter instead of the virtual network.

From ifconfig -a, virtual host network only:

vboxnet1: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        inet 172.16.57.1  netmask 255.255.0.0  broadcast 172.16.255.255
        ether 0a:00:27:00:00:01  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

and my wireless adapter:

wlp4s1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.103  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::218:39ff:fe19:2edd  prefixlen 64  scopeid 0x20<link>
        ether 00:18:39:19:2e:dd  txqueuelen 1000  (Ethernet)
        RX packets 473074  bytes 138461228 (132.0 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 438482  bytes 389764274 (371.7 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

My routing table:

$ netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 wlp4s1
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 wlp4s1

I'm hoping there will be some routing netstat -rnin the next job of directing the relevant traffic to only virtual hosts , but I can't see that.

When I try to ping my guest (puffin) from the host:

$ ping puffin
PING puffin (172.16.57.101) 56(84) bytes of data.
From 1-128-201-31.ftth.glasoperator.nl (31.201.128.1) icmp_seq=1 Packet filtered

I statically set the guest's IP address (on the eth1/host-only adapter) to 172.16.57.1​​01 (and it's up), and disabled dhcp on vboxnet1 (the host-only network).

edit:

I found the following problems:

ip link
...
5: vboxnet1: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
    link/ether 0a:00:27:00:00:01 brd ff:ff:ff:ff:ff:ff
Jonathan

Apparently VirtualBox can't start vboxnet0/vboxnet1, I noticed this when I did:

$ ping -I vboxnet1 puffin
connect: Network is unreachable

can find the problem

$ip link
(...)
5: vboxnet1: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
    link/ether 0a:00:27:00:00:01 brd ff:ff:ff:ff:ff:ff

The following resolved the issue:

sudo ip link up vboxnet1

Now I get:

$ip link
(...)
5: vboxnet1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether 0a:00:27:00:00:01 brd ff:ff:ff:ff:ff:ff

More details can be found:

Related


How to fix/set up routing from host to guest on VirtualBox?

Jonathan I am using Debian Stretch to run a Debian jessie guest. I have a guest setup using NAT and a host-only adapter. When I try to ping my guests from the host, my pings are routed to my wireless internet adapter instead of the virtual network. From ifconf

How to access Apache from host (on VirtualBox guest)?

urok93 I have Apache installed on an Ubuntu VM. When I go into the client machine and load Firefox, I can see that Apache is running fine when I browse to localhost. I want to access the same page through the host. I tried using the guest's IP address, but not

How to access Apache from host (on VirtualBox guest)?

urok93 I have Apache installed on an Ubuntu VM. When I go into the client machine and load Firefox, I can see that Apache is running fine when I browse to localhost. I want to access the same page through the host. I tried using the guest's IP address, but not

How do I SSH to a VirtualBox guest from outside the host?

Jordan I have an Ubuntu VM running on my Windows 7 computer. How can I set it up so that the web server can be accessed from outside via SSH? I found some steps ( setting up SSH access between the VirtualBox host and the guest VM ) to ssh the guest from the ho

How do I SSH to a VirtualBox guest from outside the host?

Jordan I have an Ubuntu VM running on my Windows 7 computer. How can I set it up so that the web server can be accessed from outside via SSH? I found some steps ( setting up SSH access between the VirtualBox host and the guest VM ) to ssh the guest from the ho

How to copy paste from Ubuntu VirtualBox guest to Windows host?

Misha Moroshko I'm running VirtualBox 4.1.4 on a Windows 7 laptop with an Ubuntu 11.10 guest. I want to copy text from Ubuntu terminal and paste it into a file on Windows host. For some reason this doesn't work. Any ideas? Soekarno Start your VM, then install

How to copy paste from Ubuntu VirtualBox guest to Windows host?

Misha Moroshko I'm running VirtualBox 4.1.4 on a Windows 7 laptop with an Ubuntu 11.10 guest. I want to copy text from Ubuntu terminal and paste it into a file on Windows host. For some reason this doesn't work. Any ideas? Soekarno Start your VM, then install

How to provide internet access to HOST from GUEST in VirtualBox

Chitholian I'm running a Windows 7 guest OS on a Fedora Linux host (in VirtualBox-6). I have a GSM USB modem. I can connect the modem to the host and have access to both the host and the guest, but cannot make USSD or VOICE calls; because the linux driver (and

How to retrieve host IP from Nat VirtualBox Guest?

Dfaure I have a Windows 7 host that handles VirtualBox debian guests with nat. This guest is running some web services accessible from outside via port redirection. I need to provide external access to these services via url, but I can't rely on proper dns res

VirtualBox - how to pass modem from ubuntu host to windows guest

Carlos Castellanos Is it possible to pass a USB modem that is not recognized by the host Ubuntu 15.04 to a Windows guest? , I have Windows drivers and I want to use dialup while keeping my Ubuntu host. what should I do? Can any other virtualization software he

How do I SSH to a VirtualBox guest from outside the host?

Jordan I have an Ubuntu VM running on my Windows 7 computer. How can I set it up so that the web server can be accessed from outside via SSH? I found some steps ( setting up SSH access between the VirtualBox host and the guest VM ) to ssh the guest from the ho

How to copy paste from Ubuntu VirtualBox guest to Windows host?

Misha Moroshko I'm running VirtualBox 4.1.4 on a Windows 7 laptop with an Ubuntu 11.10 guest. I want to copy text from Ubuntu terminal and paste it into a file on Windows host. For some reason this doesn't work. Any ideas? Soekarno Start your VM, then install

How to retrieve host IP from Nat VirtualBox Guest?

Dfaure I have a Windows 7 host that handles VirtualBox debian guests with nat. This guest is running some web services accessible from outside via port redirection. I need to provide external access to these services via url, but I can't rely on proper dns res

VirtualBox - how to pass modem from ubuntu host to windows guest

Carlos Castellanos Is it possible to pass a USB modem that is not recognized by the host Ubuntu 15.04 to a Windows guest? , I have Windows drivers and I want to use dialup while keeping my Ubuntu host. what should I do? Can any other virtualization software he

Access site on host from guest using VirtualBox?

Gilchaz I'm running VirtualBox on a Mac (host) and the VM used is Windows 7 (guest). VirtualBox is set up to use a NATnetwork adapter and has internet access (google, msn, etc.) fine, but I'm hosting a site on a Mac (host) so I can't access it from the VM. The

SSH to Ubuntu host from Ubuntu VirtualBox guest?

Mountain X I want to SSH into my host (Kubuntu 12.04 64bit) from a VirtualBox guest running 32bit Ubuntu 12.04. The host has the latest VirtualBox from the Ubuntu repositories (4.1.12). The guest is a preconfigured VM that I downloaded from VirtualBoxImages.co

Access VPN host by name from VirtualBox guest

username I have an Ubuntu guest running under VirtualBox on a W10 host with VPN. I've set up the host-only adapter and the NAT adapter as suggested in other answers here, and everything works fine. The only problem is from the guest that I can't access the hos

Connect to host from VirtualBox guest OS?

Naftuli Kay I essentially want to access my host from a guest in VirtualBox. Is there an IP address for my host that I can use from the guest? Are additional steps required to set this up? I want to access the host's Apache, FTP and SSH services. Naftuli Kay T

Access site on host from guest using VirtualBox?

Gilchaz I'm running VirtualBox on a Mac (host) and the VM used is Windows 7 (guest). VirtualBox is set up to use a NATnetwork adapter and has internet access (google, msn, etc.) fine, but I'm hosting a site on a Mac (host) so I can't access it from the VM. The

SSH to Ubuntu host from Ubuntu VirtualBox guest?

Mountain X I want to SSH into my host (Kubuntu 12.04 64bit) from a VirtualBox guest running 32bit Ubuntu 12.04. The host has the latest VirtualBox from the Ubuntu repositories (4.1.12). The guest is a preconfigured VM that I downloaded from VirtualBoxImages.co

Access VPN host by name from VirtualBox guest

username I have an Ubuntu guest running under VirtualBox on a W10 host with VPN. I've set up the host-only adapter and the NAT adapter as suggested in other answers here, and everything works fine. The only problem is from the guest that I can't access the hos

Connect to host from VirtualBox guest OS?

Naftuli Kay I essentially want to access my host from a guest in VirtualBox. Is there an IP address for my host that I can use from the guest? Are additional steps required to set this up? I want to access the host's Apache, FTP and SSH services. Naftuli Kay T

VirtualBox: How to sync host and guest time?

Kunitaka The time in my guest VM is about 20-30 minutes faster than the host time. What can I do so that the time in the guest is the same as the time on the host? Nikita Krupenko For Linux hosts, first install the DKMS (Dynamic Kernel Module Support) package

VirtualBox: How to sync host and guest time?

Kunitaka The time in my guest VM is about 20-30 minutes faster than the host time. What can I do so that the time in the guest is the same as the time on the host? Nikita Krupenko For Linux hosts, first install the DKMS (Dynamic Kernel Module Support) package