Setting a VM's mac address in Vagrant

后端 未结 5 1005
不思量自难忘°
不思量自难忘° 2021-01-31 15:39

The documentation lists that the mac address of a VM can be set in the Vagrantfile, however everything I add seems to end up being a syntax error. Anyone successfully done this?

5条回答
  •  攒了一身酷
    2021-01-31 16:35

    This is an old question, but I had the same issue just now. Vagrant documentation v2 still seems incomplete. In the end I used this line in the Vagrantfile with vagrant 1.2.7:

    config.vm.network "public_network", :bridge => 'enp4s0', :mac => "5CA1AB1E0001"
    

    This:

    • sets the host interface named 'enp4s0' as the bridge interface,
    • which as 'eth0' on the guest is then assigned an ip address by the same DHCP the host uses
    • Also sets 5C:A1:AB:1E:00:01 as the guest's mac address

提交回复
热议问题