<p>auto_config: false, this is the difference between two vm public network configuration <a href="https://www.vagrantup.com/docs/networking/public_network" rel="nofollow noreferrer">Public Networks</a> you can configure static IP on public network with two methods; auto_config needs inline provisioning, easy way to do this is just define static IP along with public network</p>

CC BY-SA 4.0
2021-12-27T06:32:56.697Z
2021-12-27T06:32:56.697Z
hakkican
<p>I have written a multi-vm vagrant file, first I am not able to ssh using vagrant ssh dnsmasq to the first vm and for second vm the public network is not getting created i.e. after I ssh to pihole vm, it only had private network.</p>
<pre><code># -*- mode: ruby -*-
# vi: set ft=ruby :

VAGRANTFILE_API_VERSION = &quot;2&quot;
PUBLIC_NET_BRIDGE = 'Realtek PCIe GbE Family Controller #5'
PIHOLE_PUBLIC_IP =  &quot;192.168.0.111&quot;
DNSMASQ_PUBLIC_IP = &quot;192.168.0.121&quot;


Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.synced_folder &quot;.&quot;, &quot;/vagrant&quot;, mount_options: [&quot;dmode=700,fmode=600&quot;]
  config.vm.box = &quot;ubuntu/xenial64&quot;
  config.vm.provider &quot;virtualbox&quot; do |v|
    v.memory = 1024
    v.cpus = 1
    v.customize [&quot;modifyvm&quot;, :id, &quot;--usb&quot;, &quot;off&quot;]
    v.customize [&quot;modifyvm&quot;, :id, &quot;--usbehci&quot;, &quot;off&quot;]
  end

  config.vm.define &quot;dnsmasq&quot; do |d|
    # d.provider.name = &quot;&quot;
    d.vm.provider :virtualbox do |dvb|
      dvb.customize [&quot;modifyvm&quot;, :id, &quot;--name&quot;, &quot;dnsmasq&quot;]
    end
    d.vm.hostname = &quot;dnsmasq&quot;
    d.vm.network &quot;public_network&quot;, ip: DNSMASQ_PUBLIC_IP, bridge: PUBLIC_NET_BRIDGE

    d.vm.provision &quot;shell&quot;, inline: &lt;&lt;-SHELL
      apt-mark hold ubuntu-advantage-tools
      apt-get update
      apt-get upgrade -y
      apt-get install dnsmasq -y
    SHELL

    d.vm.provision &quot;shell&quot;, path: &quot;provision.sh&quot;

    d.vm.provision &quot;shell&quot;, inline: &lt;&lt;-SHELL
      systemctl enable consul
      systemctl restart dnsmasq
      systemctl start consul
    SHELL
  end

  config.vm.define &quot;pihole&quot; do |p|
    # p.provider.name = &quot;pihole&quot;
    # p.vm.hostname = &quot;pihole&quot;
    p.vm.provider :pihole do |pvb|
      pvb.customize [&quot;modifyvm&quot;, :id, &quot;--name&quot;, &quot;pihole&quot;]
    end
    p.vm.network &quot;public_network&quot;, ip: PIHOLE_PUBLIC_IP, auto_config: false, bridge: PUBLIC_NET_BRIDGE
    
    p.vm.provision &quot;shell&quot;, inline: &lt;&lt;-SHELL
      apt-mark hold ubuntu-advantage-tools
      apt-get update
      apt-get upgrade -y
      apt-get install net-tools dnsutils -y
    SHELL
    end
end
</code></pre>
<p><a href="https://i.sstatic.net/Fm6Vl.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Fm6Vl.png" alt="enter image description here" /></a></p>

<vagrant><virtualbox>
cannot ssh first vm created by multi vm vagrantfile and vm name net getting set & public network not getting created for second vm
Ciasto piekarz
# cannot ssh first vm created by multi vm vagrantfile and vm name net getting set & public network not getting created for second vm

(Asked by: username_0 on 2021-12-25)

I have written a multi-vm vagrant file, first I am not able to ssh using vagrant ssh dnsmasq to the first vm and for second vm the public network is not getting created i.e. after I ssh to pihole vm, it only had private network.
# -*- mode: ruby -*-
# vi: set ft=ruby :

VAGRANTFILE_API_VERSION = "2"
PUBLIC_NET_BRIDGE = 'Realtek PCIe GbE Family Controller #5'
PIHOLE_PUBLIC_IP =  "192.168.0.111"
DNSMASQ_PUBLIC_IP = "192.168.0.121"


Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.synced_folder ".", "/vagrant", mount_options: ["dmode=700,fmode=600"]
  config.vm.box = "ubuntu/xenial64"
  config.vm.provider "virtualbox" do |v|
    v.memory = 1024
    v.cpus = 1
    v.customize ["modifyvm", :id, "--usb", "off"]
    v.customize ["modifyvm", :id, "--usbehci", "off"]
  end

  config.vm.define "dnsmasq" do |d|
    # d.provider.name = ""
    d.vm.provider :virtualbox do |dvb|
      dvb.customize ["modifyvm", :id, "--name", "dnsmasq"]
    end
    d.vm.hostname = "dnsmasq"
    d.vm.network "public_network", ip: DNSMASQ_PUBLIC_IP, bridge: PUBLIC_NET_BRIDGE

    d.vm.provision "shell", inline: <<-SHELL
      apt-mark hold ubuntu-advantage-tools
      apt-get update
      apt-get upgrade -y
      apt-get install dnsmasq -y
    SHELL

    d.vm.provision "shell", path: "provision.sh"

    d.vm.provision "shell", inline: <<-SHELL
      systemctl enable consul
      systemctl restart dnsmasq
      systemctl start consul
    SHELL
  end

  config.vm.define "pihole" do |p|
    # p.provider.name = "pihole"
    # p.vm.hostname = "pihole"
    p.vm.provider :pihole do |pvb|
      pvb.customize ["modifyvm", :id, "--name", "pihole"]
    end
    p.vm.network "public_network", ip: PIHOLE_PUBLIC_IP, auto_config: false, bridge: PUBLIC_NET_BRIDGE
    
    p.vm.provision "shell", inline: <<-SHELL
      apt-mark hold ubuntu-advantage-tools
      apt-get update
      apt-get upgrade -y
      apt-get install net-tools dnsutils -y
    SHELL
    end
end

**Tags:** vagrant, virtualbox


---

## 1 answers

### Answer by username_1 on 2021-12-27. Score: 0

auto\_config: false, this is the difference between two vm public network configuration [Public Networks](https://www.vagrantup.com/docs/networking/public_network) you can configure static IP on public network with two methods; auto\_config needs inline provisioning, easy way to do this is just define static IP along with public network


---

