The Computer Oracle

How can I get virtualbox to run with a hosts-only adapter?

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Hypnotic Orient Looping

--

Chapters
00:00 How Can I Get Virtualbox To Run With A Hosts-Only Adapter?
00:25 Accepted Answer Score 57
00:35 Answer 2 Score 4
01:20 Answer 3 Score 13
01:41 Answer 4 Score 1
01:54 Thank you

--

Full question
https://superuser.com/questions/429405/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#macos #ubuntu #virtualbox

#avk47



ACCEPTED ANSWER

Score 57


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

enter image description here




ANSWER 2

Score 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.




ANSWER 3

Score 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




ANSWER 4

Score 1


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.