How to access Vagrant Box in public network

前端 未结 5 1256
挽巷
挽巷 2021-01-30 17:02

I had created on e box inside vagrant. In the Vagrantfile, I had given the network as

     Create a private network, which allows host-only access to the machine
         


        
5条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-30 17:38

    By default, vagrant deletes the default (working) route on additional bridged networks inside the VMs. My problem which was specific for DHCP could only be solved by configuring the bridged network as follows:

    config.vm.network :public_network, :bridge => 'em1',:use_dhcp_assigned_default_route => true
    

    Courtesy of https://groups.google.com/forum/#!msg/vagrant-up/yNhWV42pcgk/NbOck1xqtFQJ There maybe an equivalent for static IPs.

提交回复
热议问题