0

I'm trying to work through Chef tutorials on my MacBook Pro (running OS X 10.10.5), and I've come across a problem.

Here's a Vagrantfile that I distilled from one in the tutorial:

# encoding: utf-8
# -*- mode: ruby -*-
# vi: set ft=ruby :

NODE_SCRIPT = <<EOF.freeze
echo "Preparing node..."

EOF

def set_hostname(server)
  server.vm.provision 'shell', inline: "hostname #{server.vm.hostname}"
end

Vagrant.configure(2) do |config|
  config.vm.define 'node1-centos' do |n|
    n.vm.box = 'bento/centos-7.2'
    n.vm.hostname = 'node1-centos'
    n.vm.network 'private_network', ip: '10.1.1.34'
    n.vm.provision :shell, inline: NODE_SCRIPT.dup
    set_hostname(n)
  end
end

After I run vagrant up, I try ping 10.1.1.34, but get no responses. I do see the private network when I run netstat -rn.

However, if I change the line

n.vm.box = 'bento/centos-7.2'

to

n.vm.box = 'bento/centos-6.7'

then ping is successful.

I also tried it on my Ubuntu 16.04 box, with the same problem.

Is there a way to resolve this? I need Centos 7 for testing. (I tried Centos 7.1 and had the same problem.)

user1071847
  • 633
  • 9
  • 20

1 Answers1

0

Turns out it's a bug in Vagrant 1.9.1. See this answer to the post "Centos7 with private network lost fixed IP".

Community
  • 1
  • 1
user1071847
  • 633
  • 9
  • 20