Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am a total newbie to installing and working on server platform. Just to see how things work I went ahead with installing Ubuntu Server (LAMP) 11.10 on Virtualbox installed on a Ubuntu 11.10 desktop version. I used this guide Setup Ubuntu Server on VirtualBox to use as a primary dev environment for the process. I have installed a wiki software (dokuwiki) on the virtual machine as I plan to make use of wiki to keep track of my plans and activities.

In the above article, author mentions this:

For now, I can show you how to use NAT to access your server. I’m NOT a network guy… so there may be a better way. However, I believe that using NAT will keep you padded from the outside network (e.g. at home or at a coffee shot wifi, NAT should work the same in this case.)

I am using NAT configuration as of now but I want to make sure if this is the best way. As everything is only for personal/experimentation I want my wiki and other web-related software(like drupal) which I plan to setup in future on my virtual machine to be accessible only to the host machine. I neither wish to access them from outside PCs nor do I want others to have access to it. In addition I want my server OS on VirtualBox to receive regular online updates.

Therefore, can someone suggest me which network configuration must be chosen by me?

Update: As suggested in an answer I tried using Host-only adapter. After this selection, I am unable to use my wiki at all times. The problems are with:

enter image description here.

  • http://192.168.56.101/dokuwiki/doku.php. This URL works as long as I am not connected to internet from host machine. Once I connect using my USB dongle using wvdial the wiki becomes inaccessible.

Here are the ping results: From host:

chethan@chethan-Lenovo:~$ sudo ping 192.168.56.101
[sudo] password for chethan: 
PING 192.168.56.101 (192.168.56.101) 56(84) bytes of data.
ping: sendmsg: Operation not permitted
ping: sendmsg: Operation not permitted
ping: sendmsg: Operation not permitted
ping: sendmsg: Operation not permitted
.
.
ping: sendmsg: Operation not permitted
ping: sendmsg: Operation not permitted
ping: sendmsg: Operation not permitted
^C
--- 192.168.56.101 ping statistics ---
14 packets transmitted, 0 received, 100% packet loss, time 13104ms

From guest:

ping 117.2xx.1xx.2xx
connect: Network is unreachable
share|improve this question
    
Can the machines ping each other? –  bbaja42 Jan 22 '12 at 16:00
    
I can't ping virtual machine from host: ping: sendmsg: Operation not permitted. If I try the operation from guest I get connect: Network is unreachable. –  Chethan S. Jan 22 '12 at 16:41
    
To ping from host you need sudo. Could you update original question with results from ifconfig on both machines? You might need sudo to run it. –  bbaja42 Jan 22 '12 at 17:59

4 Answers 4

up vote 2 down vote accepted

NAT should work fine; your VM can connect "outward" to the Internet, but outside things can't connect "in" to your VM. Using a host-only network would prevent your VM from making outbound connections to the Internet, e.g. to download updates.

share|improve this answer
    
I was always concerned about getting my OS upadated with host-only connection. Your answer has come at the right time for me. Thank you.. –  Chethan S. Jan 26 '12 at 12:44

Probably the best solution for you will be Host-only adapter. This option allows you to create dedicated virtual adapter, that can be used by host and guest systems. You can read more about Host-only and other network options here

UPDATE: Since your host and guest system are in the same network, you don't need port forwarding, just make sure that guest and host systems are in the same network, eg. host IP: 192.168.64.1
guest IP: 192.168.64.2
Mask: 255.255.255.0
Now you can acces to your wiki with http://192.168.64.2/dokuwiki/doku.php

share|improve this answer
    
mhl, please have a look at my updated question and suggest a remedy if possible. –  Chethan S. Jan 22 '12 at 8:42

As pointed out above please post the output of

sudo ifconfig

both on your host and guest and in both scenarios (when using USB dongle using wvdial and when you don't). Your entire problem seems to be that you don't use the correct ip to contact your guest since you switched to "host-based".

share|improve this answer

As mhl said, host only adapter should work. I use them for my LAMP machines often. You end up getting a unique IP address though, it's usually a different pattern from the IP's your router dole out. (It's so they don't collide, e.g. 10.XXX.XXX.XXX will never collide with the 192.168.XXX.XXX pattern a router may run off of.

SO the trick may to be to find what IP address VirtualBox is giving your machine when you use Host only, one way would be to login to your guest (Ubuntu right?) and run "ifconfig" at the terminal. It will list the (virtual) network hardware and list the ip addresses. One of those should be the key.

When using Host only, you don't need to forward ports from your host to your guest like in NAT, instead you should be able to access it directly... (like mhl said, but with that IP address you should find when you do that ifconfig thing.)

share|improve this answer
    
I have started using host-only option. Now I am unable to access the wiki installation on my virtual machine despite of using the right IP. As I am unable to figure out what's happening I have also posted a new question on AskUbuntu: askubuntu.com/questions/97599/… –  Chethan S. Jan 22 '12 at 15:33
2  
Do not use 33.33.33.XX for your local networks. The 33.0/8 address range is part of the public Internet and is assigned to US DoD. –  grawity Jan 22 '12 at 16:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.