Page 1 of 1

[SOLVED] having trouble with port forwarding

Posted: 7. Jan 2014, 18:38
by keith73
I'm having trouble accessing port 5000 on a VirtualBox VM. I have a Windows 7 Host and Ubuntu 12 server guest.
For the Network, I have Adapter 1 setup as Host Only and Adapter 2 as NAT. The 2 adapters was the only solution I could find that allowed me to ssh into the server and to use it as a web server that I can hit domains in a browser. (You're probably asking why I didn't use Bridged. Me too, it's worked for me on other machines, but for some reason won't work on this network but that's a story for another time. )

So I'm trying to run a custom python app that is attempting to communicate via port 5000. When I run that app it tells me:
2014-01-07 11:18:57,521 INFO [werkzeug] * Running on http://127.0.0.1:5000/

I setup Windows firewall to allow VirtualBox access through any ports.

I tried setting up port forwarding on the NAT adapter trying different values for guest/host ip and still can't access port 5000 on guest.
I'm probably missing something obvious. more info below.

I've also looked through some forum posts here and tried to follow along and do what was suggested, but still no dice.
viewtopic.php?f=7&t=44583
http://stackoverflow.com/questions/9537 ... st-to-host

thanks,
- keith

NAT port forward details:

Code: Select all

Protocol: TCP
Host IP: 127.0.0.1 ( tried swapping with guest, no luck )
Host Port: 5000
Guest IP: 192.168.56.101
Guest Port: 5000

On the guest, I ran ifconfig and got the guest IP as 192.168.56.101.

Code: Select all

$ ifconfig
eth0      Link encap:Ethernet  HWaddr 08:00:27:f9:14:83
          inet addr:192.168.56.101  Bcast:192.168.56.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fef9:1483/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:53 errors:0 dropped:0 overruns:0 frame:0
          TX packets:82 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:6898 (6.8 KB)  TX bytes:11691 (11.6 KB)
          Interrupt:10 Base address:0xd020

eth1      Link encap:Ethernet  HWaddr 08:00:27:c6:86:9b
          inet addr:10.0.3.15  Bcast:10.0.3.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fec6:869b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:19 errors:0 dropped:0 overruns:0 frame:0
          TX packets:47 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2551 (2.5 KB)  TX bytes:5079 (5.0 KB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:4 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:240 (240.0 B)  TX bytes:240 (240.0 B)

$

on the host, I run ipconfig on command line and get this:
Windows IP Configuration

Code: Select all

Ethernet adapter Local Area Connection* 13:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . : 

Wireless LAN adapter Wireless Network Connection:

   Connection-specific DNS Suffix  . : [domain redacted]
   IPv4 Address. . . . . . . . . . . : 10.89.196.102
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 10.89.196.1

Ethernet adapter Local Area Connection:

   Connection-specific DNS Suffix  . : [domain redacted]
   IPv4 Address. . . . . . . . . . . : 10.88.189.132
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 10.88.189.1

Ethernet adapter Bluetooth Network Connection:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . : 

Ethernet adapter VirtualBox Host-Only Network:

   Connection-specific DNS Suffix  . : 
   Link-local IPv6 Address . . . . . : fe80::78dc:26fe:dc34:128a%20
   IPv4 Address. . . . . . . . . . . : 192.168.56.1
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 

Tunnel adapter isatap.{887B3ABE-7962-4DCF-890F-71C9D5A12BD9}:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . : 

Tunnel adapter isatap.{FA5526C2-732B-43E3-9CAD-9293F57C0BE5}:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . : 

Tunnel adapter isatap.{00A6B5B6-9391-45E4-B56A-43E63C1E39B7}:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . : 

Tunnel adapter isatap.[domain redacted]:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . : 

Tunnel adapter Teredo Tunneling Pseudo-Interface:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Re: having trouble with port forwarding

Posted: 8. Jan 2014, 20:21
by keith73
turns out port forwarding wasn't really the issue for me. I had to configure my app to run on 0.0.0.0:5000 instead of 127.0.0.1:5000