40

I'm trying to setup a Hosts-only Adapter so I can connect to it. It says that invalid settings detected and the name: drop-down isn't populated. What am I doing wrong and how can I rectify it?

My Host is and my guest is .

enter image description here

5
  • Why are you using Host only Adapter, it's primarily for communication between hosts, use NAT instead
    – HackToHell
    May 27, 2012 at 15:24
  • @HackToHell I'm using it so I can http into the guest OS.
    – Kit Sunde
    May 27, 2012 at 15:32
  • By http, you mean run a web server in the guest, NAS will work, Host Only is not neeeded
    – HackToHell
    May 27, 2012 at 15:33
  • 1
    @HackToHell I'd prefer not to do port forwarding and couple my local machine ports to the VM. I'd like to be able to access the VM on an IP I've assigned it, but not have to adapt to an external DHCP server. So I'm trying to go down this route: stackoverflow.com/a/2047646/29347
    – Kit Sunde
    May 27, 2012 at 15:48
  • 9
    @HackToHell, Host Only is needed in a couple of scenarios which is why every VM provider offers it. This is not helpful input. Aug 3, 2012 at 15:18

4 Answers 4

56

It seems like these adapters are added in Virtual Box -> preferences -> network.

enter image description here

7
  • 3
    wow that did the trick! +1!
    – FLY
    Aug 3, 2012 at 9:20
  • 8
    wow indeed, who writes user interfaces like this? Aug 3, 2012 at 15:13
  • wow somebody wants all vm to be accessible! that's why.
    – CppLearner
    Mar 31, 2013 at 5:15
  • note: I've encountered situation where "preferences" menu item is not displayed. Restart virtual box if encountered and it should show up.
    – harschware
    Mar 17, 2015 at 17:58
  • Actually, no restart needed. This happens when the "Oracle VM Virtual Manager" is not the foreground window. If your VM is the foreground window it will be missing from the "VirtualBox VM" menu. As of VBox 4.3.18
    – harschware
    Mar 17, 2015 at 18:15
13

Since Virtualbox 5.2.xxx, the location to create a host-only network has now changed to File -> Host Network Manager...

Clicking on the Create button in the Host Network Manager window will create a host-only network called vboxnet0, which you can then use within the VM settings.

1
  • You're life saver, thank you! :-)
    – Cromax
    Feb 12 at 21:01
4

In order to have bidirectional access please follow next steps ...

It's very important that after (Virtual Box -> Preferences -> Network -> vboxnet0) to configure your firewall.

  1. Allow routing (ip.forwarding)
  2. Allow NAT through fireall

OSX firewall sample

    # (I) Firewall config /etc/sysctl.conf
    sysctl -w net.inet.ip.forwarding=1 net.inet.ip.fw.enable=1
    sysctl -a net.inet.ip.forwarding net.inet.ip.fw.enable

    ipfw list
    ... shoud have ....
    net.inet.ip.forwarding=1
    net.inet.ip.fw.enable=1


    # (II) Enable nat access to /etc/pf.conf
    #============add your host-only vlan =================
    # this commented lines doesn't work after computer reboot
    #nat on en0 from vboxnet0:network -> (en0)
    #nat on en3 from vboxnet0:network -> (en3)
    # this will work in any situation
    nat on en0 from 10.1.100.0/24 to any -> (en0)
    nat on en3 from 10.1.100.0/24 to any -> (en3)        
    #==========================        

    # Reload pf
    pfctl -f /etc/pf.conf
    pfctl -e

Enjoy

1
  • I'm confused by this answer. Immediately after changing my VM network to Host-only adapter, I looked on OSX host for /etc/sysctl.conf but the file was not there. I checked ifconfig on the guest to see the new adapter present, but did not have an IP4 address. I checked for that file on CentOS6.6 guest and found it, found 'net.ipv4.ip_forward = 0'. set it to 1, saved file, and immediately a IPV4 address became available. I could use it to ssh to the VM from the host and another guest configured the same way.
    – harschware
    Mar 17, 2015 at 18:19
0

You can do it command line (since the UI location is not consistent) like so: VBoxManage hostonlyif create. This will create a vboxnet0 interface ready for use.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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