Unable to connect to guest server from host

Discussions about using Linux guests in VirtualBox.
Post Reply
rlayte
Posts: 2
Joined: 3. Apr 2011, 14:04
Primary OS: Mac OS X Leopard
VBox Version: OSE Debian
Guest OSses: Ubuntu

Unable to connect to guest server from host

Post by rlayte »

I'm using virtualbox to run an Ubuntu server from os x. I have NAT and bridged connections set up and I am able to ping back and forth, ssh into the guest box, transfer files with scp, etc. However, when I start the Django development server I'm unable to view this from the host.

Code: Select all

$ - manage.py runserver 0.0.0.0:8000
When viewing http://192.168.56.1:8000 from the host the page is unable to load. If I curl this address from the Ubuntu guest then the expected holding page is returned.

If I browse to http://192.168.56.1 without the port set, it shows my hosts localhost. So presumably the problem is to do with the host not being able to distinguish between itself and the guest?

Here are the ip details for the guest machine, obtained from host:

Code: Select all

vboxnet0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
ether 0a:00:27:00:00:00 
inet 192.168.56.1 netmask 0xffffff00 broadcast 192.168.56.255
Within the Ubuntu server I get the following, the first is for the NAT adapter the second is the bridged connection:

Code: Select all

eth0      Link encap:Ethernet  HWaddr 08:00:27:1f:cd:51  
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe1f:cd51/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1955 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1080 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:173919 (173.9 KB)  TX bytes:159672 (159.6 KB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:cf:e8:7f  
          inet addr:192.168.56.1  Bcast:192.168.56.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fecf:e87f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:22205 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1867168 (1.8 MB)  TX bytes:468 (468.0 B)
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Unable to connect to guest server from host

Post by Sasquatch »

You've got an IP conflict there. The IP on the Host and the Guest, 192.168.56.1, they are not shared. You have set NAT and Host-Only, which means you have a NAT network for internet access (that's fine) and a connection without any limitations between the Host and Guest. But in order to get it fully operational, you must use different IP addresses. Now they have the same and when you try to access the IP, it will refer to the machine itself, instead of the machine you want.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
rlayte
Posts: 2
Joined: 3. Apr 2011, 14:04
Primary OS: Mac OS X Leopard
VBox Version: OSE Debian
Guest OSses: Ubuntu

Re: Unable to connect to guest server from host

Post by rlayte »

What are the steps required to use seperate IP addresses? The second adapter I have set to bridged (en1: Airport), should this be set to host-only?
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Unable to connect to guest server from host

Post by Sasquatch »

Please read chapter 6 of the User Manual and learn a thing or two about networking if you have no clue as to what to do and how the magic works.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Post Reply