title: Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host
body: <p>I am following a <a href="https://scotch.io/tutorials/get-vagrant-up-and-running-in-no-time" rel="nofollow noreferrer">basic Vagrant tutorial</a> and Vagrant provisions a box on my Ubuntu without complaining. Moreover, I can <code>vagrant ssh</code> into the VM. However, the VM is not reachable from the host: it's not possible to ping it's IP address.</p>
  
  <p><em>What I have achieved:</em></p>
  
  <ul>
  <li>Installed VirtualBox (5.1.24 r117012 (Qt5.5.1)) and Vagrant (1.9.7)
  onto my Ubuntu (16.04.2 LTS) machine. </li>
  <li>Provisioned the VM with <code>vagrant up</code>, Vagrant finishes the job and does not complain.</li>
  <li><code>vagrant ssh</code> works.</li>
  <li>I have manually installed <code>lighttpd</code> on the guest VM and I can successfully <code>ping/curl</code> the address: <code>localhost</code> from within the guest VM.</li>
  </ul>
  
  <p><em>This is what I get when trying reach the guest VM from host:</em></p>
  
  <pre><code>~/tmp/myfirstvagrantproject$ ping 172.22.22.22
  PING 172.22.22.22 (172.22.22.22) 56(84) bytes of data.
  From ... icmp_seq=4 Destination Net Unreachable
  ...
  171 packets transmitted, 0 received, +21 errors, 100% packet loss, time 173411ms
  </code></pre>
  
  <p><em>Here are the artifacts:</em></p>
  
  <p>1.<code>Vagrantfile</code>:</p>
  
  <pre><code># -*- mode: ruby -*-
  # vi: set ft=ruby :
  
  # General project settings
  #################################
  
    # IP Address for the host only network, change it to anything you like
    # but please keep it within the IPv4 private network range
    ip_address = "172.22.22.22"
  
    # The project name is base for directories, hostname and alike
    project_name = "projectname"
  
  
  # Vagrant configuration
  #################################
  
    Vagrant.configure("2") do |config|
  
  
      # Define VM box to use
      config.vm.box = "precise32"
      config.vm.box_url = "http://files.vagrantup.com/precise32.box"
  
      # Set share folder
  
  
      # Use hostonly network with a static IP Address and enable
      # hostmanager so we can have a custom domain for the server
      # by modifying the host machines hosts file
      config.hostmanager.enabled = true
      config.hostmanager.manage_host = true
      config.vm.define project_name do |node|
        node.vm.hostname = project_name + ".local"
        node.vm.network :private_network, ip: ip_address
        node.hostmanager.aliases = [ "www." + project_name + ".local" ]
      end
      config.vm.provision :hostmanager
  
  
  
   end
  </code></pre>
  
  <p>2.<code>ifconfig</code> on the guest VM:</p>
  
  <p>vagrant@projectname:~$ ifconfig</p>
  
  <pre><code>eth0      Link encap:Ethernet  HWaddr 08:00:27:12:96:98  
            inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
            inet6 addr: fe80::a00:27ff:fe12:9698/64 Scope:Link
            UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
            RX packets:1481 errors:0 dropped:0 overruns:0 frame:0
            TX packets:1178 errors:0 dropped:0 overruns:0 carrier:0
            collisions:0 txqueuelen:1000 
            RX bytes:156103 (156.1 KB)  TX bytes:132629 (132.6 KB)
  
  eth1      Link encap:Ethernet  HWaddr 08:00:27:06:1a:26  
            inet addr:172.22.22.22  Bcast:172.22.22.255  Mask:255.255.255.0
            inet6 addr: fe80::a00:27ff:fe06:1a26/64 Scope:Link
            UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
            RX packets:0 errors:0 dropped:0 overruns:0 frame:0
            TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
            collisions:0 txqueuelen:1000 
            RX bytes:0 (0.0 B)  TX bytes:468 (468.0 B)
  
  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:0 errors:0 dropped:0 overruns:0 frame:0
            TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
            collisions:0 txqueuelen:0 
            RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
  </code></pre>
  
  <ol start="3">
  <li><p>Host's <code>ifconfig</code> (my host is connected to a wireless network):</p>
  
  <p>ifconfig
      br-34f3008c7cda Link encap:Ethernet  HWaddr [removed]<br>
                inet addr:172.18.0.1  Bcast:0.0.0.0  Mask:255.255.0.0
                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:0 
                RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)</p>
  
  <pre><code>docker0   Link encap:Ethernet  HWaddr [removed]  
            inet addr:172.17.0.1  Bcast:0.0.0.0  Mask:255.255.0.0
            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:0 
            RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
  
  enp8s0    Link encap:Ethernet  HWaddr [removed]  
            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)
  
  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:65536  Metric:1
            RX packets:11151 errors:0 dropped:0 overruns:0 frame:0
            TX packets:11151 errors:0 dropped:0 overruns:0 carrier:0
            collisions:0 txqueuelen:1000 
            RX bytes:1759590 (1.7 MB)  TX bytes:1759590 (1.7 MB)
  
  tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
            inet addr:[removed]  P-t-P:[removed]  Mask:255.255.255.255
            inet6 addr: fe80::[removed] Scope:Link
            UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
            RX packets:76270 errors:0 dropped:0 overruns:0 frame:0
            TX packets:62204 errors:0 dropped:0 overruns:0 carrier:0
            collisions:0 txqueuelen:100 
            RX bytes:72710602 (72.7 MB)  TX bytes:9456524 (9.4 MB)
  
  wlp2s0    Link encap:Ethernet  HWaddr [removed]  
            inet addr:192.168.1.106  Bcast:192.168.1.255  Mask:255.255.255.0
            inet6 addr: fe80::88c0:3b8a:a25d:dcd5/64 Scope:Link
            UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
            RX packets:508449 errors:0 dropped:1 overruns:0 frame:0
            TX packets:321820 errors:0 dropped:0 overruns:0 carrier:0
            collisions:0 txqueuelen:1000 
            RX bytes:532525406 (532.5 MB)  TX bytes:55885133 (55.8 MB)
  </code></pre></li>
  </ol>
  
  <p>4.<code>VirtualBox</code> -> Settings -> Network shows:</p>
  
  <ul>
  <li>Adapter 1. Attached to: NAT </li>
  <li>Adapter 2. Attached to: Host-only Adapter <code>vboxnet0</code>, Cable connected - yes.</li>
  </ul>
  
  <p>Question: <strong>How can I configure Vagrant/VirtualBox to expose an IP/port to the host OS?</strong></p>