2

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: <LOOPBACK,UP,LOWER_UP> 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: <BROADCAST,MULTICAST,UP,LOWER_UP> 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: <BROADCAST,MULTICAST,UP,LOWER_UP> 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@ansible ~]$ ip route show
default via 10.0.2.2 dev eth0 proto dhcp metric 100
10.0.2.0/24 dev eth0 proto kernel scope link src 10.0.2.15 metric 100
10.0.2.0/24 dev eth1 proto kernel scope link src 10.0.2.10 metric 101

is it getting eth0 by dhcp? and then assigning the ip i want to eth1? is there something i can do with virtualbox configuration on windows?

i need both machines to see each other

2

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.

| improve this answer | |
  • why vagrant sets eth0 on all the machines deployed to the same IP 10.0.2.15? I found a workaround and not configuring the private network in the vagrantfile to the same range as the nat network allows the machines to be reacheable. so doing this; ldap.vm.network "private_network", ip: "192.168.2.100" works – danidar Jun 7 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.