0

I'm attempting to provision two VM's that can send traffic to each other, but I am having trouble implementing this with Vagrant. In my Vagrantfile I have:

Vagrant.configure("2") do |config|
  config.vm.box = "base"

  config.vm.define "machine_a" do |machine_a|
    machine_a.vm.box = "fedora/36-cloud-base"
    machine_a.vm.network "private_network", ip: "192.168.33.10"
    machine_a.vm.hostname = "machine-a"
    machine_a.vm.provider "virtualbox" do |vb|
      vb.memory = "2048"
    end
  end

  config.vm.define "machine_b" do |machine_b|
    machine_b.vm.box = "fedora/36-cloud-base"
    machine_b.vm.network "private_network", ip: "192.168.33.11"
    machine_b.vm.hostname = "machine-b"
    machine_b.vm.provider "virtualbox" do |vb|
      vb.memory = "2048"
    end
  end

end

However, when I run ifconfig in the machine_a VM, I get:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.2.15  netmask 255.255.255.0  broadcast 10.0.2.255
        inet6 fe80::c108:7157:9132:af74  prefixlen 64  scopeid 0x20<link>
        ether 52:54:00:56:a8:b4  txqueuelen 1000  (Ethernet)
        RX packets 1063  bytes 120984 (118.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 976  bytes 141524 (138.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.56.110  netmask 255.255.255.0  broadcast 192.168.56.255
        inet6 fe80::a92f:2b09:ddc3:1fa2  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:72:bd:cf  txqueuelen 1000  (Ethernet)
        RX packets 48  bytes 15724 (15.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 38  bytes 3474 (3.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 8  bytes 648 (648.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 8  bytes 648 (648.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Unless I'm missing something, there is neither a reference to the machine_b on this private network, nor is there any reference to the two IP's I had specified in the Vagrantfile (192.168.33.10 or 192.168.33.11).

Any guidance on what I'm doing wrong would be greatly appreciated. Thanks!

1 Answer 1

1

I'm facing a similar problem. My problem variant is that the guest gets a 172.16.-address automatically from Vagrant, and my private IP-address definitions does not show up in nmcli on the built up box.

One workaround I found: if I change the box to be based on generic/centos9s both eth-interfaces gets an IP address.

Do you have a /etc/sysconfig/network-scripts/ifcfg-eth? file for the problematic interfaces? I have, but somehow it doesn't get "picked" up by the system/nmcli/whatnot.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.