Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting a VM's mac address in Vagrant

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?

like image 543
gmoney Avatar asked Sep 21 '12 21:09

gmoney


People also ask

How do I change my IP address on vagrant?

To configure private or host-only networking in Vagrant with static IP address, open the Vagrantfile, find the following line and uncomment it. Here, 192.168. 121.60 is the IP address of the VM. Replace this with your own IP.

Which interface should the network bridge to in vagrant?

Default Network Interface If more than one network interface is available on the host machine, Vagrant will ask you to choose which interface the virtual machine should bridge to. A default interface can be specified by adding a :bridge clause to the network definition.


1 Answers

I used this:

config.vm.network :bridged , :mac => "080027XXXXXX" 

and got what I wanted.

The docs are unclear on what the syntax for the options hash were, and there seemed to be no example on what this should look like. So, here it is! Bridged with a mac address (edited of course). This brings up eth1 with the mac specified, which makes my DHCP server happy, and gives it a proper fqdn on my network.

like image 87
gmoney Avatar answered Oct 06 '22 15:10

gmoney