I believe that my problem is similar to this question on accessing VirtualBox guest via VPN, but not quite. I am trying to go the other way: I am trying to reach a destination that is accessible to the host via OpenVPN, from the guest.
My VirtualBox guest has a Host-Only Network (vboxnet0
) where the guest is 192.168.56.101
and the host is 192.168.56.1
. The host is a client on an OpenVPN network leading to 10.44.55.55
via its virtual tun1
gateway at 10.9.0.1.
OpenVPN connectivity from the client to the remote is known-good.
On the guest, I defined a route: route add -host 10.44.55.55 gw 192.168.56.1 dev enp0s8
... so that the routing table looks like this:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.1.1 0.0.0.0 UG 0 0 0 enp0s3
10.44.55.55 192.168.56.1 255.255.255.255 UGH 0 0 0 enp0s8
This, as you see, is the IP-address of the host side of the Host-Only Network and the virtual network adapter leading to it.
On the guest, I now tried ping 10.44.55.55
. There was no response, and here is how I have tried to systematically diagnose the problem:
tcpdump -nn icmp
on the host shows that packets are being issued by the client address bound for the target: 192.168.56.101 > 10.44.55.55
. Trouble is, they don't actually get there. Although the host knows a route to 10.44.55.55
and can ping it, and although packets can be seen by tcpdump
on the host, they do not then pass through the tunnel to the destination, as do packets issued by the same command on the host.
tcpdump -nn icmp
executed on the remote side shows that ping packets are not arriving, if the traffic originates from the virtual machine. (Of course, if the host issues ping 10.44.55.55
, the packets do arrive.)
The host is Mac OS/X (El Capitan) and it occurred to me that "maybe this is a packet forwarding problem on the host." Referring now to this thread on packet forwarding in OS X, I found the proper sysctl
command and enabled packet forwarding as described there, but no joy.
Here is how I know that port-forwarding was turned on, on the OS/X host, although it didn't do any good:
$ sysctl -a | grep forw
net.inet.ip.forwarding: 1
I am confident that I am quite close to a solution here, but I just can't quite find the proper network mojo. Thanks in advance ...
Further Note: Still tinkering with this, I tried to define a route to 10.9.0.1
(the OpenVPN portal in question) with similar negative results.