3

I want to create a cluster of 4 CentOS VMs using Vagrant. I installed Vagrant and VirtualBox on my Widnows machine, downloaded the CentOS 64 box and created the cluster. Steps:

  1. Execute 'vagrant box add --name centos65-base'
  2. Execute 'vagrant init centos65-base'
  3. Edit the VagrantFile as follows:

    # -*- mode: ruby -*-
    # vi: set ft=ruby :
    
    Vagrant.configure(2) do |config|
    
      config.vm.define :node1 do |node1_config|
        node1_config.vm.box = "centos65_base"
        node1_config.vm.network "private_network", ip: "10.0.2.5"
      end
    
      config.vm.define :node2 do |node2_config|
        node2_config.vm.box = "centos65_base"
        node2_config.vm.network "private_network", ip: "10.0.2.6"
      end
    
      config.vm.define :node3 do |node3_config|
        node3_config.vm.box = "centos65_base"
        node3_config.vm.network "private_network", ip: "10.0.2.7"
      end
    
      config.vm.define :node4 do |node4_config|
        node4_config.vm.box = "centos65_base"
        node4_config.vm.network "private_network", ip: "10.0.2.8"
      end
    end
    
  4. Execute 'vagrant up'

At the end of the fourth step, the four nodes of the cluster got configured and brought up, which is great. I sshed into them. I was able to ping to www.google.com and my host machine successfully from the VMs. However, pinging from one node in the cluster to another gives the "destination host unreachable" error. I ran 'ifconfig' to see the network adapters in use. eth0 is being used for DHCP and eth1 is being used for static ip.

[root@vagrant-centos65 vagrant]# ifconfig
eth0      Link encap:Ethernet  HWaddr 08:00:27:4F:B8:06
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe4f:b806/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1142 errors:0 dropped:0 overruns:0 frame:0
          TX packets:672 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:106471 (103.9 KiB)  TX bytes:84099 (82.1 KiB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:EC:A0:37
          inet addr:10.0.2.5  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:feec:a037/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:268 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:27329 (26.6 KiB)  TX bytes:482 (482.0 b)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:784 (784.0 b)  TX bytes:784 (784.0 b)

Any idea how to fix this? I need the VMs in the cluster to be able to talk to each other.

1 Answer 1

2

I solved this by using the 192.168.33.10 - 192.168.33.13 IP address range instead of the 10.0.2.5 - 10.0.2.8 for the static ip configuration.

I suspect that using the 10.0.2.x range was causing a conflict as DHCP also uses the same range in Vagrant by default.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .