Quantcast
Channel: Active questions tagged vagrant - DevOps Stack Exchange
Viewing all articles
Browse latest Browse all 64

Vagrant multiple VMs with hostname resolution

$
0
0

I want to bring up multiple VMs in one Vagrantfile so that each VM can ping the hostnames of the other VMs. The VMS are base CentOS 7 images. Here is the minimum example of how their networking is configured:

flex1.vm.hostname = 'flex1'flex1.vm.network "private_network", bridge: "wlp111s0", type: "dhcp"flex2.vm.hostname = 'flex2'flex2.vm.network "private_network", bridge: "wlp111s0", type: "dhcp"

I tried avahi.

config.vm.provision "shell", inline: <<-SHELL  sudo yum update -y --quiet  sudo yum install -y --quiet epel-release  sudo yum install -y --quiet avahi avahi-tools nss-mdns  sudo systemctl start avahi-daemon  sudo systemctl enable avahi-daemon  sudo service avahi-daemon startSHELL

Ping by hostname still fails:

[vagrant@flex1 ~]$ ping flex2ping: flex2: Name or service not known

How do get I simple name resolution working? It does not have to be fancy -- just updating the /etc/hosts file would be fine.


Viewing all articles
Browse latest Browse all 64

Trending Articles