HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

vagrant on windows 10 incorrect network configuration on multi-machine setup

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
incorrectvagrantmultisetupwindowsmachineconfigurationnetwork

Problem

I have a problem with vagrant that is running on windows 10 when I deploy centos 8 machines all the machines have eth0 with the same Ip and they cannot communicate with each other

the ip 10.0.2.15 is always present. this is the vagrant file:

Vagrant.configure("2") do |config|
  # The most common configuration options are documented and commented below.
  # For a complete reference, please see the online documentation at
  # https://docs.vagrantup.com.

  # Every Vagrant development environment requires a box. You can search for
  # boxes at https://vagrantcloud.com/search.
  config.vm.define "ansible" do |ansible|
    ansible.vm.box = "bento/centos-8.1"
    ansible.vm.hostname = "ansible"
    ansible.vm.network "private_network", ip: "10.0.2.10"
  end

  config.vm.define "ldap" do |ldap|
    ldap.vm.box = "bento/centos-8.1"
    ldap.vm.hostname = "ldap"
    ldap.vm.network "private_network", ip: "10.0.2.100"
  end


and this is the ip configuration on the first machine;

```
[vagrant@ansible ~]$ ip a
1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 52:54:00:72:fe:6e brd ff:ff:ff:ff:ff:ff
inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic noprefixroute eth0
valid_lft 86077sec preferred_lft 86077sec
inet6 fe80::5054:ff:fe72:fe6e/64 scope link
valid_lft forever preferred_lft forever
3: eth1: mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 08:00:27:91:b2:04 brd ff:ff:ff:ff:ff:ff
inet 10.0.2.10/24 brd 10.0.2.255 scope global noprefixroute eth1
valid_lft forever preferred_lft forever
inet6 fe80::a00:27ff:fe91:b204/64 scope link
valid_lft forever preferred_lft forever

[vagrant

Solution

eth0 is used by vagrant for nat configuration in order to establish portforwarding. eth1 private networks that you have configured should allow you to ping/nslookup from one node to another. You can use the following to customize the ip of the nat but I don't see why would you do that:

config.vm.provider "virtualbox" do |vbx|
  vbx.customize ['modifyvm', :id, '--natnet1', '192.168.169.0/24']
end


Update: tested your setup it doesn't work, this is some CentOS 8 specifics.

Code Snippets

config.vm.provider "virtualbox" do |vbx|
  vbx.customize ['modifyvm', :id, '--natnet1', '192.168.169.0/24']
end

Context

StackExchange DevOps Q#11756, answer score: 2

Revisions (0)

No revisions yet.