First Time NAT Port Forwarding not working as expected (ANSWERED)

This is for discussing general topics about how to use VirtualBox.
Post Reply
147RHA
Posts: 2
Joined: 13. Oct 2016, 11:29

First Time NAT Port Forwarding not working as expected (ANSWERED)

Post by 147RHA »

This is a first venture into accessing web services on the guest via the host. I am using NAT port forwarding which is failing as explained in the setup/scenario detailed below. I believe I am trying something straightforward, but accept I may be misunderstanding some basic principle. I have been drawn into various other forum posts on the same subject but find the specifics of each case do not help me. Would appreciate any guidance - Thanks

So the basic set-up is:

VirtualBox 5.1.6
Host OS = Windows7
Guest OS = Linux 6.8

And these are the details leading to my bad test:

1. From within the Linux guest, ifconfig shows this:

eth0 Link encap:Ethernet HWaddr 08:00:27:CB:72:DB
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fecb:72db/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1117801 errors:0 dropped:0 overruns:0 frame:0
TX packets:302665 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1406849964 (1.3 GiB) TX bytes:18307823 (17.4 MiB)

2. From within the guest, I can successfully access the web service via a browser using the IP address from 1 above:

//10.0.2.15:19000/aps

3. Port forwarding is set up like this:

Name: ToVMGuest
Protocol: TCP
Host IP: 127.0.0.1
Host Port: 19000
Guest IP: 10.2.0.15
Guest Port: 19000

4. And netstat on the Windows host shows me the following:

netstat -na | find "19000"
TCP 127.0.0.1:19000 0.0.0.0:0 LISTENING

5. NAT details from Vbox.log (attached) include the following:

00:00:01.150368 NAT: Guest address guess set to 10.0.2.15 by initialization
00:00:01.158116 NAT: Set redirect TCP 127.0.0.1:19000 -> 10.0.2.15:19000

6. BUT, when trying a connection like this via a browser to the same web service from the Windows host it fails - "This page can't be displayed"

//127.0.0.1:19000/aps
Attachments
VBox.log
(121.24 KiB) Downloaded 12 times
Last edited by 147RHA on 14. Oct 2016, 12:17, edited 1 time in total.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: First Time NAT Port Forwarding not working as expected

Post by Perryg »

I would verify that the port is actually open in the guest. Most OL firewall rules are in fact off by default.
147RHA
Posts: 2
Joined: 13. Oct 2016, 11:29

Re: First Time NAT Port Forwarding not working as expected

Post by 147RHA »

Thanks for your suggestion - This is ANSWERED

The guest/firewall/iptables were set up as per the default post OS install, so I am guessing that the FORWARD chain was denying connections.

Just to prove the theory I stopped the iptables service entirely (/etc/init.d/iptables stop) and was able to successfully access guest services via the host browser - BREAKTHROUGH

I will find out how to set up the FORWARD chain properly outside of this thread - thanks again
Post Reply