Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vagrant IPs are not getting assigned correctly #12707

Open
namalk opened this issue Mar 11, 2022 · 0 comments
Open

Vagrant IPs are not getting assigned correctly #12707

namalk opened this issue Mar 11, 2022 · 0 comments

Comments

@namalk
Copy link

namalk commented Mar 11, 2022

I'm trying to create 4 VMs using vagrant file and basically expecting to assign static IPs to bridge interfaces. But it seems IPs are getting assigned randomly.

###Vagrant version:

Installed Version: 2.2.19
Latest Version: 2.2.19

Host operating system

NAME=Fedora
VERSION="34 (MATE-Compiz)"
ID=fedora
VERSION_ID=34
VERSION_CODENAME=""
PLATFORM_ID="platform:f34"
PRETTY_NAME="Fedora 34 (MATE-Compiz)"

Guest operating system

Rocky 8.4

Vagrantfile

BOX_IMAGE = "rocky/8.4"
BRIDGE_INTERFACE = "enp4s0"
IP_MASTER = "192.168.5.14"
IP_WORKER = "192.168.5.15"

Vagrant.configure("2") do |config|

  config.vm.box = BOX_IMAGE

  (1..2).each do |i|
    config.vm.define "master#{i}" do |subconfig|
      subconfig.vm.hostname = "master#{i}"
      subconfig.vm.network "public_network", bridge: BRIDGE_INTERFACE, ip: "IP_MASTER + #{i}"
    end
  end

  (1..2).each do |i|
    config.vm.define "worker#{i}" do |subconfig|
      subconfig.vm.hostname = "worker#{i}"
      subconfig.vm.network "public_network", bridge: BRIDGE_INTERFACE, ip: "IP_WORKER + #{i}"
    end
  end
end

Expected behavior

Expecting to see IP config as below, (192.168.5.141/24)

[vagrant@master1 ~]$ ip a

2: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 08:00:27:0c:24:e8 brd ff:ff:ff:ff:ff:ff
inet 192.168.5.141/24 brd 192.168.5.255 scope global dynamic noprefixroute enp0s8
valid_lft 85540sec preferred_lft 85540sec
inet6 fe80::3f12:b71:2c67:b3d4/64 scope link noprefixroute
valid_lft forever preferred_lft forever

Actual behavior

Actual one I get is 192.168.5.116

2: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 08:00:27:0c:24:e8 brd ff:ff:ff:ff:ff:ff
inet 192.168.50.116/24 brd 192.168.5.255 scope global dynamic noprefixroute enp0s8
valid_lft 85540sec preferred_lft 85540sec
inet6 fe80::3f12:b71:2c67:b3d4/64 scope link noprefixroute
valid_lft forever preferred_lft forever

Steps to reproduce

  1. Get a simple Rocky 8.4 box
  2. Run 'vagrant up'
  3. Get into a VM and check the IP.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant