# Error when adding multiple networks

**URL:** <https://discuss.hashicorp.com/t/error-when-adding-multiple-networks/52989>\
**Category:** Vagrant\
**Created:** [April 21, 2023, 1:03pm UTC](https://discuss.hashicorp.com/t/error-when-adding-multiple-networks/52989 "2023-04-21T13:03:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eazylaykzy](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/eazylaykzy/32/35320_2.png) [@eazylaykzy](https://discuss.hashicorp.com/u/eazylaykzy)\
**Post date:** [April 21, 2023, 1:03pm UTC](https://discuss.hashicorp.com/t/error-when-adding-multiple-networks/52989/1 "2023-04-21T13:03:57Z")

</div>

### My Vagrantfile:

```auto
# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what you're doing.
Vagrant.configure("2") do |config|
  # Every Vagrant development environment requires a box. You can search for
  # boxes at https://vagrantcloud.com/search.
  config.vm.box = "spox/ubuntu-arm"
  config.vm.box_version = "1.0.0"
  #config.ssh.insert_key = false

  # Provider-specific configuration so you can fine-tune various
  # backing providers for Vagrant. These expose provider-specific options.
  # Example for VMWare:
  config.vm.provider :vmware_desktop do |v|
    v.memory = 1024
    v.cpus = 1
    v.linked_clone = true
    v.gui = true
    v.vmx["ethernet0.virtualdev"] = "vmxnet3"
    #v.vmx["ethernet0.pcislotnumber"] = "160"
  end

  # Create a private network, which allows host-only access to the machine
  # using a specific IP.
  #########
  # Nodes: host our apps
  #########
  config.vm.define "node1" do |node|
    node.vm.network "private_network", ip: "172.17.177.21"
  end
  config.vm.define "node2" do |node|
    node.vm.network "private_network", ip: "172.17.177.22"
  end

  # Share an additional folder to the guest VM. The first argument is
  # the path on the host to the actual folder. The second argument is
  # the path on the guest to mount the folder. And the optional third
  # argument is a set of non-required options.
  #########
  # Controller: host our tools
  #########
  config.vm.define 'controller' do |machine|
    # The Ansible Local provisioner requires that all the Ansible Playbook files are available on the guest machine
    machine.vm.synced_folder ".", "/vagrant",
      owner: "vagrant", group: "vagrant", mount_options: ["dmode=755,fmode=600"]

    machine.vm.network "private_network", ip: "172.17.177.11"
    machine.vm.provision "ansible_local" do |ansible|
      # ansible setup
      ansible.install = true
      ansible.install_mode = "pip_args_only"
      ansible.playbook = "playbook.yml"
      # ansible.version = "2.10.7"
      ansible.pip_install_cmd = "sudo apt-get install -y python3-pip python-is-python3 haveged && sudo ln -s -f /usr/bin/pip3 /usr/bin/pip"
      ansible.pip_args = "ansible==2.10.7"
      # provsionning
      ansible.playbook = "playbook.yml"
      ansible.verbose = true
      ansible.limit = "all" # or only "nodes" group, etc.
      ansible.inventory_path = "inventory"
    end
  end
end

```

### vagrant up:

```auto
Bringing machine 'node1' up with 'vmware_desktop' provider...
Bringing machine 'node2' up with 'vmware_desktop' provider...
Bringing machine 'controller' up with 'vmware_desktop' provider...
==> node1: Cloning VMware VM: 'spox/ubuntu-arm'. This can take some time...
==> node1: Checking if box 'spox/ubuntu-arm' version '1.0.0' is up to date...
==> node1: Verifying vmnet devices are healthy...
==> node1: Preparing network adapters...
WARNING: The VMX file for this box contains a setting that is automatically overwritten by Vagrant
WARNING: when started. Vagrant will stop overwriting this setting in an upcoming release which may
WARNING: prevent proper networking setup. Below is the detected VMX setting:
WARNING: 
WARNING: ethernet0.pcislotnumber = "160"
WARNING: 
WARNING: If networking fails to properly configure, it may require this VMX setting. It can be manually
WARNING: applied via the Vagrantfile:
WARNING: 
WARNING: Vagrant.configure(2) do |config|
WARNING: config.vm.provider :vmware_desktop do |vmware|
WARNING: vmware.vmx["ethernet0.pcislotnumber"] = "160"
WARNING: end
WARNING: end
WARNING: 
WARNING: For more information: https://www.vagrantup.com/docs/vmware/boxes.html#vmx-allowlisting
==> node1: Starting the VMware VM...
==> node1: Waiting for the VM to receive an address...
==> node1: Forwarding ports...
    node1: -- 22 => 2222
==> node1: Waiting for machine to boot. This may take a few minutes...
    node1: SSH address: 127.0.0.1:2222
    node1: SSH username: vagrant
    node1: SSH auth method: private key
    node1: 
    node1: Vagrant insecure key detected. Vagrant will automatically replace
    node1: this with a newly generated keypair for better security.
    node1: 
    node1: Inserting generated public key within guest...
    node1: Removing insecure key from the guest if it's present...
    node1: Key inserted! Disconnecting and reconnecting using new SSH key...
==> node1: Machine booted and ready!
==> node1: Configuring network adapters within the VM...

```

### Error:

```auto
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mv -f '/tmp/vagrant-network-entry-1682073924' '/etc/netplan/50-vagrant.yaml'
chown root:root '/etc/netplan/50-vagrant.yaml'
chmod 0644 '/etc/netplan/50-vagrant.yaml'
netplan apply

Stdout from the command:

Stderr from the command:

/etc/netplan/50-vagrant.yaml:6:5: Error in network definition: Invalid name ''
    ! '':
    ^

```

### My configurations:

> vagrant plugin list

- Vagrant 2.3.4
- vagrant-vbguest (0.31.0, global)
- vagrant-vmware-desktop (3.0.1, global)

> machine and installations

- MacBook Pro M1 Max
- VMWare Fusion Professional Version 13.0.1 (21139760)

---

<div class="post-metadata">

**Author:** ![eazylaykzy](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/eazylaykzy/32/35320_2.png) [@eazylaykzy](https://discuss.hashicorp.com/u/eazylaykzy)\
**Post date:** [April 22, 2023, 7:57am UTC](https://discuss.hashicorp.com/t/error-when-adding-multiple-networks/52989/2 "2023-04-22T07:57:59Z")

</div>

For anyone hitting a roadblock like I did trying to make this work, below are the changes I made to my Vagrantfile that got me up and running:

```auto
# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what you're doing.
Vagrant.configure("2") do |config|
  # Every Vagrant development environment requires a box. You can search for
  # boxes at https://vagrantcloud.com/search.
  config.vm.box = "spox/ubuntu-arm"
  config.vm.box_version = "1.0.0"
  #config.ssh.insert_key = false

  # alternative box
  #config.vm.box = "rkrause/ubuntu-21.10-arm64"

  # Provider-specific configuration so you can fine-tune various
  # backing providers for Vagrant. These expose provider-specific options.
  # Example for VMWare:
  config.vm.provider :vmware_desktop do |v|
    v.memory = 1024
    v.cpus = 1
    v.linked_clone = true
    v.gui = true
    v.vmx["ethernet0.virtualdev"] = "vmxnet3"
    v.vmx["ethernet1.virtualdev"] = "vmxnet3"
    v.vmx["ethernet0.pcislotnumber"] = "160"
    v.vmx["ethernet1.pcislotnumber"] = "36"
  end

  # Create a private network, which allows host-only access to the machine
  # using a specific IP.
  #########
  # Nodes: host our apps
  #########
  config.vm.define "node1" do |node|
    node.vm.network "private_network", ip: "172.17.177.21"
  end
  config.vm.define "node2" do |node|
    node.vm.network "private_network", ip: "172.17.177.22"
  end

  # Share an additional folder to the guest VM. The first argument is
  # the path on the host to the actual folder. The second argument is
  # the path on the guest to mount the folder. And the optional third
  # argument is a set of non-required options.
  #########
  # Controller: host our tools
  #########
  config.vm.define 'controller' do |machine|
    # The Ansible Local provisioner requires that all the Ansible Playbook files are available on the guest machine
    machine.vm.synced_folder ".", "/vagrant",
      owner: "vagrant", group: "vagrant"

    machine.vm.network "private_network", ip: "172.17.177.11"
    machine.vm.provision "ansible_local" do |ansible|

      # ansible setup
      ansible.install = true
      ansible.install_mode = "pip_args_only"
      ansible.playbook = "./ansible/playbook.yml"

      # ansible.version = "2.10.7"
      ansible.pip_install_cmd = "sudo apt-get install -y python3-pip python-is-python3 haveged && sudo ln -s -f /usr/bin/pip3 /usr/bin/pip"
      ansible.pip_args = "ansible==2.10.7"

      # provsionning
      ansible.playbook = "./ansible/playbook.yml"
      ansible.verbose = true
      ansible.limit = "all" # or only "nodes" group, etc.
      ansible.inventory_path = "./ansible/inventory"
    end
  end
end

```

All configurations from my [previous comments](https://github.com/Parallels/vagrant-parallels/issues/410#issuecomment-1517660457) remain the same.
