简体   繁体   中英

can't reach vagrant box over private network

My vagrant box stop working for unknown reason and even if a reinstall all the box trough my ansible script, it don't want to be reached by http://192.168.33.10/ .

here my vagrant file :

Vagrant.configure(2) do |config|
  config.vm.box = "centos67vm"

  config.vm.synced_folder "../../pjt" , "/var/www/pjt", owner: "pjt", group: "pjt", mount_options: ["dmode=777,fmode=777"]
  config.vm.synced_folder "../../library" , "/var/library"

  config.vm.network :private_network, ip: "192.168.33.10"
  config.vm.provision :shell, path: "ansible.sh"

  config.vm.provider :virtualbox do |vb|
    vb.name = "dev-pjt"
  end

end

when i ping the ip i got :

ping 192.168.33.10
PING 192.168.33.10 (192.168.33.10): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
Request timeout for icmp_seq 4
^C
--- 192.168.33.10 ping statistics ---
6 packets transmitted, 0 packets received, 100.0% packet loss

the ifconfig in the box give me that :

ifconfig
eth0      Link encap:Ethernet  HWaddr 08:00:27:1B:2F:CC
          inet adr:10.0.2.15  Bcast:10.0.2.255  Masque:255.255.255.0
          adr inet6: fe80::a00:27ff:fe1b:2fcc/64 Scope:Lien
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:967 errors:0 dropped:0 overruns:0 frame:0
          TX packets:635 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 lg file transmission:1000
          RX bytes:100532 (98.1 KiB)  TX bytes:85600 (83.5 KiB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:2A:FE:79
          inet adr:192.168.33.10  Bcast:192.168.33.255  Masque:255.255.255.0
          adr inet6: fe80::a00:27ff:fe2a:fe79/64 Scope:Lien
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:27 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 lg file transmission:1000
          RX bytes:0 (0.0 b)  TX bytes:1974 (1.9 KiB)

lo        Link encap:Boucle locale
          inet adr:127.0.0.1  Masque:255.0.0.0
          adr inet6: ::1/128 Scope:Hôte
          UP LOOPBACK RUNNING  MTU:65536  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 lg file transmission:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

i'm don't know where do i need to dig in to find a solution (my mac or virtualbox ?) , hope somebody can help me.

Finally resolve the problem... but don't know how... so here the steps that i did :

  • sudo route -n flush
  • rebooted the macbook
  • deactivated little snitch and nod32 antivirus
  • vagrant up
  • successfully ping and go to http://192.168.33.10/
  • vagrant halt
  • reactivated little snitch and nod32 antivirus
  • vagrant up
  • successfully ping and go to http://192.168.33.10/

i don't know if it's the "sudo route -n flush" or the reboot that made the connection work again.

hope it will help somebody ;)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM