Is there an issue with assigning static IP address to custom boxes?

9 views
Skip to first unread message

William Saxton

unread,
Sep 22, 2016, 11:53:22 AM9/22/16
to Vagrant
Not sure if this is a common issue, but I've easily set up a VM with static IP using the following:

Vagrantfile:

  config.vm.define "swrmsca" do |swrmsca|
    swrmsca.vm.box = "bento/centos-7.2"
    swrmsca.vm.network "private_network", ip: "192.168.1.101"
    swrmsca.vm.hostname = "swrmsca.local"
  end

ifconfig output:

[vagrant@swrmsca ~]$ ifconfig
...
enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.101  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::a00:27ff:fe2a:37c6  prefixlen 64  scopeid 0x20<link>

I went ahead and create this box, added some packages (puppet client), then repackaged it up as puppet_client.box.

# vagrant package --output puppet_client.box
# vagrant box add puppet_client puppet_client.box

When I try to bring up this VM, though, the static IP is never assigned:

Vagrantfile:

  config.vm.define "swrmsca" do |swrmsca|
    swrmsca.vm.box = "puppet_client"
    swrmsca.ssh.insert_key = false
    swrmsca.vm.network "private_network", ip: "192.168.1.101"
    swrmsca.vm.hostname = "swrmsca.local"
  end

ifconfig output:

[vagrant@swrmsca ~]$ ifconfig
...
enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::a00:27ff:fe1a:209d  prefixlen 64  scopeid 0x20<link>


Did I do something wrong with the packaging?
Reply all
Reply to author
Forward
0 new messages