Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I want to install a linux debian in virtual box and on debian an apache webserver. After this, I'd like to access it form my mac via browser like http://myvirtualbox:80/myfolder. The goal is to "dry" test the apache configuration before performing it on a live debian server... is this setting possible and if so, how?

UPDATE: After choosing "Internal" I tried to determine the IP-address...

root@straubedebian:~# ip addr eth0
Command "eth0" is unknown, try "ip addr help".
root@straubedebian:~# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:37:f8:b2 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::a00:27ff:fe37:f8b2/64 scope link 
       valid_lft forever preferred_lft forever
3: pan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN 
    link/ether f2:cf:03:a1:c0:99 brd ff:ff:ff:ff:ff:ff
root@straubedebian:~# ifconfig
eth0      Link encap:Ethernet  Hardware Adresse 08:00:27:37:f8:b2  
          inet6-Adresse: fe80::a00:27ff:fe37:f8b2/64 Gültigkeitsbereich:Verbindung
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metrik:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:25 errors:0 dropped:0 overruns:0 carrier:0
          Kollisionen:0 Sendewarteschlangenlänge:1000 
          RX bytes:0 (0.0 B)  TX bytes:5069 (4.9 KiB)

lo        Link encap:Lokale Schleife  
          inet Adresse:127.0.0.1  Maske:255.0.0.0
          inet6-Adresse: ::1/128 Gültigkeitsbereich:Maschine
          UP LOOPBACK RUNNING  MTU:16436  Metrik:1
          RX packets:753 errors:0 dropped:0 overruns:0 frame:0
          TX packets:753 errors:0 dropped:0 overruns:0 carrier:0
          Kollisionen:0 Sendewarteschlangenlänge:0 
          RX bytes:59097 (57.7 KiB)  TX bytes:59097 (57.7 KiB)

There's no ip address I can use :-)

After that I switched to "Host-only" and again no ip-address:

root@straubedebian:~# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:37:f8:b2 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::a00:27ff:fe37:f8b2/64 scope link 
       valid_lft forever preferred_lft forever
3: pan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN 
    link/ether f2:cf:03:a1:c0:99 brd ff:ff:ff:ff:ff:ff

Is this a debian issue or a misconfiguration in VirtualBox?

share|improve this question
add comment

1 Answer 1

up vote 5 down vote accepted
  • Set up Host-Only, Internal or Bridged Networking. Whenever you change the virtual machine's network configuration you need to inform the operating system within that virtual machine of that change. The easiest way is to simply reboot the virtual machine.
  • Look up the virtual machine's IP-Adress using ip addr eth0.
  • Verify basic connectivity using ping <ip-address from previous step> from your mac's terminal.
  • Edit your mac's /etc/hosts using sudo vim /etc/hosts (or use an editor like text mate that can elevate privileges by itself). Add a line that looks like this: <ip-address as above> myvirtualbox anothername yetanothername

A more powerful approach, albeit maybe only for a more console-savvy audience is Vagrant.

share|improve this answer
    
Thank you very much for this explanation! Only one question: where to perform the first step? –  strauberry Jun 23 '11 at 10:51
    
When you set up your virtual machine (or after it is created in the preferences) –  jjungnickel Jun 23 '11 at 11:12
    
Ok, I updated my question... –  strauberry Jun 23 '11 at 12:15
    
You need to reboot the virtual machine (or refresh your dhcp-lease). –  jjungnickel Jun 23 '11 at 12:30
    
AW-SOME :-) Thank you –  strauberry Jun 23 '11 at 12:37
add comment

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.