0
respostas

Dúvida ao subir / escolher a rede do box

Boa tarde, estou com um problema toda vez que vou subir uma box (onde no arquivo Vagrantfile, tenho mais de uma maquinas), toda vez que subo ele pergunta qual é a minha " bridged network interfaces" o problema é que eu tenho que selecionar várias vezes a interface para ele continuar (a mesma quantidade de maquinas que tenho no arquivo do Vagrantfile) com isso a maquina fica com 6 conexões de rede sendo 1 nat e as outras 5 como bridged.

Segue como fica quando subo a maquinas:

Bringing machine 'ubuntu' up with 'virtualbox' provider...
==> ubuntu: Checking if box 'generic/debian10' version '4.1.10' is up to date...
==> ubuntu: Clearing any previously set forwarded ports...
==> ubuntu: Clearing any previously set network interfaces...
==> ubuntu: Available bridged network interfaces:
1) wlp2s0
2) enp1s0
3) vmnet8
==> ubuntu: When choosing an interface, it is usually the one that is
==> ubuntu: being used to connect to the internet.
    ubuntu: Which interface should the network bridge to? 1
==> ubuntu: Available bridged network interfaces:
1) wlp2s0
2) enp1s0
3) vmnet8
==> ubuntu: When choosing an interface, it is usually the one that is
==> ubuntu: being used to connect to the internet.
    ubuntu: Which interface should the network bridge to? 1
==> ubuntu: Available bridged network interfaces:
1) wlp2s0
2) enp1s0
3) vmnet8
==> ubuntu: When choosing an interface, it is usually the one that is
==> ubuntu: being used to connect to the internet.
    ubuntu: Which interface should the network bridge to? 1
==> ubuntu: Available bridged network interfaces:
1) wlp2s0
2) enp1s0
3) vmnet8
==> ubuntu: When choosing an interface, it is usually the one that is
==> ubuntu: being used to connect to the internet.
    ubuntu: Which interface should the network bridge to? 1
==> ubuntu: Available bridged network interfaces:
1) wlp2s0
2) enp1s0
3) vmnet8
==> ubuntu: When choosing an interface, it is usually the one that is
==> ubuntu: being used to connect to the internet.
    ubuntu: Which interface should the network bridge to? 1
==> ubuntu: Preparing network interfaces based on configuration...
    ubuntu: Adapter 1: nat
    ubuntu: Adapter 2: bridged
    ubuntu: Adapter 3: bridged
    ubuntu: Adapter 4: bridged
    ubuntu: Adapter 5: bridged
    ubuntu: Adapter 6: bridged
==> ubuntu: Forwarding ports...
    ubuntu: 22 (guest) => 2222 (host) (adapter 1)
==> ubuntu: Running 'pre-boot' VM customizations...
==> ubuntu: Booting VM...
==> ubuntu: Waiting for machine to boot. This may take a few minutes...
    ubuntu: SSH address: 127.0.0.1:2222
    ubuntu: SSH username: vagrant
    ubuntu: SSH auth method: private key

=================

Acho que deve ter algum erro no meu código, alguém pode ajudar?

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

  config.vm.provider "virtualbox" do |v|

   v.memory = "512"
    v.cpus =1

config.vm.synced_folder ".", "/vagrant", disabled: false


end
Vagrant.configure("2") do |config|
end
    config.vm.box = "samteale/OracleLinux7.1"

    config.vm.define "oracle_linux" do |oracle_linux|
    config.vm.network "public_network", ip: "192.168.0.50"
    config.vm.provision "shell",
      inline: "cat /vagrant/configs/id_ansible.pub >> .ssh/authorized_keys"

    #config.vm.network "private_network", type: "dhcp"
  end
  Vagrant.configure("2") do |config|
  end
config.vm.box = "centos/7"
config.vm.define "centos7" do |centos7|
config.vm.network "public_network", ip: "192.168.0.51"
config.vm.provision "shell",
  inline: "cat /vagrant/configs/id_ansible.pub >> .ssh/authorized_keys"

end

  config.vm.box = "centos/8"
  config.vm.define "centos8" do |centos8|
  config.vm.network "public_network", ip: "192.168.0.52"


  end
  config.vm.box = "bento/ubuntu-16.04"

    config.vm.define "ubuntu" do |ubuntu|

   config.vm.network "public_network", ip: "192.168.0.53"
   config.vm.provision "shell",
       inline: "cat /vagrant/configs/id_ansible.pub >> .ssh/authorized_keys"
   end

   config.vm.box = "roboxes/opensuse15"
    config.vm.define "opensuse" do |opensuse|
    config.vm.network "public_network", ip: "192.168.0.54"
  end

config.vm.box = "generic/debian10"

    config.vm.define "debian10" do |debian10|
      config.vm.network "public_network", ip: "192.168.0.55"

  end


end

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software