3

I have Ubuntu 12.04 and Django dev server. To test how it looks in IE, I insalled virtual box and Win7 machine.

It runs successfully, I can ping the host machine (192.168.56.1) from virtual box guest machine.

Network settings:

  • host-only adapter
  • promiscuous mode: allow all

I can't open pages from Django dev server.

I run it as

manage.py runserver 0.0.0.0:8000

or

manage.py runserver 192.168.56.1:8000

192.168.56.1 is in internal ips.

Tried bridged mode. It offers wlan0 and eth0, both have no IP in ifconfig:

eth0      Link encap:Ethernet  HWaddr e8:9d:87:8d:63:2c  
      UP BROADCAST MULTICAST  MTU:1500  Metric:1
      RX packets:0 errors:0 dropped:0 overruns:0 frame:0
      TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
      Interrupt:20 Memory:c4800000-c4820000 

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:1005005 errors:0 dropped:0 overruns:0 frame:0
      TX packets:1005005 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0 
      RX bytes:192815458 (192.8 MB)  TX bytes:192815458 (192.8 MB)

ppp0      Link encap:Point-to-Point Protocol  
      inet addr:10.64.8.162  P-t-P:10.64.64.64  Mask:255.255.255.255
      UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
      RX packets:222243 errors:2 dropped:0 overruns:0 frame:0
      TX packets:182316 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:3 
      RX bytes:207954248 (207.9 MB)  TX bytes:24880374 (24.8 MB)

vboxnet0  Link encap:Ethernet  HWaddr 0a:00:27:00:00:00  
      inet addr:192.168.56.1  Bcast:192.168.56.255  Mask:255.255.255.0
      inet6 addr: fe80::800:27ff:fe00:0/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:0 errors:0 dropped:0 overruns:0 frame:0
      TX packets:2147 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:0 (0.0 B)  TX bytes:386308 (386.3 KB)

wlan0     Link encap:Ethernet  HWaddr d0:df:9a:a2:84:3b  
      UP BROADCAST MULTICAST  MTU:1500  Metric:1
      RX packets:238840 errors:0 dropped:0 overruns:0 frame:0
      TX packets:272881 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:138133962 (138.1 MB)  TX bytes:217297056 (217.2 MB)

Tried NAT mode also. Managed to ping host machide, but not connect to Django (again, the pinged IP is in INTERNAL_IPS).

and it runs correctly. But IE in guest machine can't access http://192.168.56.1:8000.

How should I set up network in the guest machine?

2
  • Do yourself a favor and use bridged networking mode unless you have a very specific reason to use host-only. Commented Mar 22, 2013 at 20:30
  • @Oliver Salzburg: I choose bridged mode, it offers wlan0/eth0, ifconfig shows both have no IP in host machine. Any suggestion?
    – culebrón
    Commented Mar 22, 2013 at 20:41

1 Answer 1

4

Here's the solution.

  • Use NAT as network for the guest machine.
  • Run Django for 0.0.0.0:8000
  • type http://10.0.2.2:8000 in IE.

Write the protocol (http://) in the address explicitly, otherwise IE interprets 10.0.2.2:8000 as something else but host:port. (Maybe as protocol:host or user:password with no host.)

The latter was the last item that I missed in all cases.

1
  • This worked for me, thanks! If anyone else has been messing with this stuff, don't forget to remove any port forwarding you had set up before while trying stuff, as that seemed to stop this from working for me. Commented Aug 15, 2017 at 17:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .