How to automatically select bridged network interfaces in Vagrant?

前端 未结 4 653
说谎
说谎 2021-02-01 15:39

What should I add in Vagrant file to prevent asking (after vagrant up command)

Which interface should the network bridge to?

4条回答
  •  情话喂你
    2021-02-01 16:22

    You can actually provide a list of bridges and Virtualbox will cycle through them until it finds one that it can use. Put these in order of how you want them to be tried:

    For example on my OSX Macbook:

      config.vm.network "public_network", bridge: [
          "en0: Wi-Fi (AirPort)",    
          "en1: Wi-Fi (AirPort)",
      ]
    

    So in your case:

    config.vm.network "public_network", bridge: [
        "Intel(R) 82579LM Gigabit Network Connection",
        "VMware Virtual Ethernet Adapter for VMnet1",
        "VMware Virtual Ethernet Adapter for VMnet8",
    ]
    

提交回复
热议问题