networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -


this question exact duplicate of:

i following basic vagrant tutorial , vagrant provisions box on ubuntu without complaining. moreover, can vagrant ssh vm. however, vm not reachable host: it's not possible ping it's ip address.

what have achieved:

  • installed virtualbox (5.1.24 r117012 (qt5.5.1)) , vagrant (1.9.7) onto ubuntu (16.04.2 lts) machine.
  • provisioned vm vagrant up, vagrant finishes job , not complain.
  • vagrant ssh works.
  • i have manually installed lighttpd on guest vm , can ping/curl address: localhost within guest vm.

this when trying reach guest vm host:

~/tmp/myfirstvagrantproject$ ping 172.22.22.22 ping 172.22.22.22 (172.22.22.22) 56(84) bytes of data. ... icmp_seq=4 destination net unreachable ... 171 packets transmitted, 0 received, +21 errors, 100% packet loss, time 173411ms 

here artifacts:

1.vagrantfile:

# -*- mode: ruby -*- # vi: set ft=ruby :  # general project settings #################################    # ip address host network, change   # please keep within ipv4 private network range   ip_address = "172.22.22.22"    # project name base directories, hostname , alike   project_name = "projectname"   # vagrant configuration #################################    vagrant.configure("2") |config|       # define vm box use     config.vm.box = "precise32"     config.vm.box_url = "http://files.vagrantup.com/precise32.box"      # set share folder       # use hostonly network static ip address , enable     # hostmanager can have custom domain server     # modifying host machines hosts file     config.hostmanager.enabled = true     config.hostmanager.manage_host = true     config.vm.define project_name |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 

2.ifconfig on guest vm:

vagrant@projectname:~$ ifconfig

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           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           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           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) 
  1. host's ifconfig (my host connected wireless network):

    ifconfig br-34f3008c7cda link encap:ethernet hwaddr [removed]
    inet addr:172.18.0.1 bcast:0.0.0.0 mask:255.255.0.0 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)

    docker0   link encap:ethernet  hwaddr [removed]             inet addr:172.17.0.1  bcast:0.0.0.0  mask:255.255.0.0           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]             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           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           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           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) 

4.virtualbox -> settings -> network shows:

  • adapter 1. attached to: nat
  • adapter 2. attached to: host-only adapter vboxnet0, cable connected - yes.

question: how can configure vagrant/virtualbox expose ip/port host os?

this due a bug in virtualbox 5.1.24 , has been fixed in 5.1.26. can take @ answer similar question more detail. comes down virtualbox 5.1.24 failing create rout in kernel's routing table private network defined in vagrantfile.

upgrading virtualbox 5.1.26 should solve issue.


Comments