Unable to route http requests to Virtualbox guest from external clients

2

I have a Virtualbox guest running Ubuntu 14.04 and a node.js web server. The Virtualbox host is a Windows 8.1 client. After setting up the node server, I am having some difficulty providing access externally.

The node server is running on port 5005, so normally, I'd simply create a port forwarding rule from the firewall to route all requests for 5005 to the guest IP (192.168.2.13) on the same port. Doing this, I see the requests I make from an external location reach the firewall and being allowed, but the external client never receives a response. If I access the private IP from within the network, it responds as correctly and as expected (so the server is definitely up).

If I try the same process, but run a server on the host machine (rather than a guest VM) it works! This suggests the firewall configuration isn't an issue. I can ping the guest IP from the firewall, so connectivity seems fine.

So, there seems to be something going on in the networking setup for the VM causing a problem, but what? The VB guest is configured with a static IP, using VirtualBox's bridged networking model.

Neither IpTables or UFW is configured to block anything on the guest (that I an tell)

What have I missed?

Andre Lackmann

Posted 2015-10-12T05:53:26.363

Reputation: 131

Answers

1

Turns out the guest didn't have the default gateway set correctly. I was able to tell this by running

route -N

on the guest and it showed there was no default route set. To fix this, I ran

route del default
route add default gw 192.168.2.100 eth1

and the guest can now properly communicate with NAT'd traffic from the internet.

Andre Lackmann

Posted 2015-10-12T05:53:26.363

Reputation: 131