"Failed to add Virtual Network" when bringing up VM - vagrant 2.3.0 and parallels 18
robrecord opened this issue · comments
When spinning up my virtual machines with the latest vagrant 2.3.0 and Parallels 18, I get the following error:
There was an error while command execution. The command and stderr is shown below.
Command: ["/usr/local/bin/prlsrvctl", "net", "add", "vagrant-vnet0", "--type", "host-only"]
Stderr: Failed to add Virtual Network vagrant-vnet0: The specified values for the "vagrant-vnet0" network conflict with your Mac’s network settings and won’t be applied. Please correct virtual network settings and try again.
exit status 1
Info:
OS: macOS 12.4(21F79)
Parallels Version: Desktop 18.0.2-53077
vagrant-parallels: 2.2.5
@robrecord It seems that you are using the private_network
configuration with network CIDR which overlaps with some other private networks which your Mac is connected to.
Please double check the private_network
section in your Vagrantfile and change the network IP / mask there.
https://parallels.github.io/vagrant-parallels/docs/networking/private_network.html
https://www.vagrantup.com/docs/networking/private_network
If you still need help - please post the content of your Vagrantfile and the output of the command ifconfig -a
I also have this problem.
- macOS 12.6 (21G115) - Intel
- Vagrant 2.3.1
- vagrant-parallels 2.2.5
- Parallels Desktop 18.0.2 (53077)
I use the following ip ranges, which are not in use anywhere else on my Mac:
- Shared: 198.51.100.0/24
- Host-only: 192.0.2.0/24
I'v turned off IPv6 DHCP in Parallels preferences.
Doing a vagrant up
creates the two nodes, and then fails with the following error:
==> centos7: An error occurred. The error will be shown after all tasks complete.
==> rhel8: An error occurred. The error will be shown after all tasks complete.
An error occurred while executing multiple actions in parallel.
Any errors that occurred are shown below.
An error occurred while executing the action on the 'centos7'
machine. Please handle this error then try again:
There was an error while command execution. The command and stderr is shown below.
Command: ["/usr/local/bin/prlsrvctl", "net", "add", "vagrant-vnet0", "--type", "host-only"]
Stderr: Failed to add Virtual Network vagrant-vnet0: The specified values for the "vagrant-vnet0" network conflict with your Mac’s network settings and won’t be applied. Please correct virtual network settings and try again.
An error occurred while executing the action on the 'rhel8'
machine. Please handle this error then try again:
There was an error while command execution. The command and stderr is shown below.
Command: ["/usr/local/bin/prlsrvctl", "net", "add", "vagrant-vnet0", "--type", "host-only"]
Stderr: Failed to add Virtual Network vagrant-vnet0: The specified values for the "vagrant-vnet0" network conflict with your Mac’s network settings and won’t be applied. Please correct virtual network settings and try again.
I can then start the two nodes from the Parallels control center, and both nodes are fully functional and have ip's on the 198.15.100.0/24
network.
Both nodes also respond to commands from the host:
$ vagrant status
Current machine states:
centos7 running (parallels)
rhel8 running (parallels)
Here are my Vagrant
file and the output of ifconfig -a
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# RHSM config using the vagrant-registration plugin
config.registration.username = ENV['RHSM_USERNAME']
config.registration.password = ENV['RHSM_PASSWORD']
config.registration.unregister_on_halt = true
config.vm.define :centos7 do | node |
node.vm.box = "bento/centos-7"
node.vm.hostname = "centos7-01.local"
node.vm.network :private_network, type: "dhcp"
end
config.vm.define :rhel8 do | node |
node.vm.box = "generic/rhel8"
node.vm.hostname = "rhel8-01.local"
node.vm.network :private_network, type: "dhcp"
end
end
$ ifconfig -a
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>
inet 127.0.0.1 netmask 0xff000000
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
inet 10.254.254.254 netmask 0xff000000
nd6 options=201<PERFORMNUD,DAD>
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en5: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether ac:de:48:00:11:22
inet6 fe80::aede:48ff:fe00:1122%en5 prefixlen 64 scopeid 0x4
nd6 options=201<PERFORMNUD,DAD>
media: autoselect (100baseTX <full-duplex>)
status: active
ap1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=400<CHANNEL_IO>
ether 3e:22:fb:bb:9b:70
nd6 options=201<PERFORMNUD,DAD>
media: autoselect
status: inactive
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=6463<RXCSUM,TXCSUM,TSO4,TSO6,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM>
ether 3c:22:fb:bb:9b:70
inet6 fe80::c81:46dd:5023:1d69%en0 prefixlen 64 secured scopeid 0x6
inet 172.16.42.20 netmask 0xffffff00 broadcast 172.16.42.255
nd6 options=201<PERFORMNUD,DAD>
media: autoselect
status: active
awdl0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
options=400<CHANNEL_IO>
ether ae:d3:8f:66:99:a4
inet6 fe80::acd3:8fff:fe66:99a4%awdl0 prefixlen 64 scopeid 0x7
nd6 options=201<PERFORMNUD,DAD>
media: autoselect
status: active
llw0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=400<CHANNEL_IO>
ether ae:d3:8f:66:99:a4
inet6 fe80::acd3:8fff:fe66:99a4%llw0 prefixlen 64 scopeid 0x8
nd6 options=201<PERFORMNUD,DAD>
media: autoselect
status: active
en2: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
options=460<TSO4,TSO6,CHANNEL_IO>
ether 82:2d:19:40:d4:00
media: autoselect <full-duplex>
status: inactive
en1: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
options=460<TSO4,TSO6,CHANNEL_IO>
ether 82:2d:19:40:d4:01
media: autoselect <full-duplex>
status: inactive
en3: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
options=460<TSO4,TSO6,CHANNEL_IO>
ether 82:2d:19:40:d4:05
media: autoselect <full-duplex>
status: inactive
en4: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
options=460<TSO4,TSO6,CHANNEL_IO>
ether 82:2d:19:40:d4:04
media: autoselect <full-duplex>
status: inactive
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=63<RXCSUM,TXCSUM,TSO4,TSO6>
ether 82:2d:19:40:d4:01
Configuration:
id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
ipfilter disabled flags 0x0
member: en1 flags=3<LEARNING,DISCOVER>
ifmaxaddr 0 port 10 priority 0 path cost 0
member: en2 flags=3<LEARNING,DISCOVER>
ifmaxaddr 0 port 9 priority 0 path cost 0
member: en3 flags=3<LEARNING,DISCOVER>
ifmaxaddr 0 port 11 priority 0 path cost 0
member: en4 flags=3<LEARNING,DISCOVER>
ifmaxaddr 0 port 12 priority 0 path cost 0
nd6 options=201<PERFORMNUD,DAD>
media: <unknown type>
status: inactive
vmenet0: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
ether 36:6a:99:c8:00:53
media: autoselect
status: active
bridge100: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=3<RXCSUM,TXCSUM>
ether 3e:22:fb:bb:c9:64
inet 198.51.100.2 netmask 0xffffff00 broadcast 198.51.100.255
inet6 fe80::3c22:fbff:febb:c964%bridge100 prefixlen 64 scopeid 0xf
inet6 fdb2:2c26:f4e4:: prefixlen 64
Configuration:
id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
ipfilter disabled flags 0x0
member: vmenet0 flags=3<LEARNING,DISCOVER>
ifmaxaddr 0 port 14 priority 0 path cost 0
nd6 options=201<PERFORMNUD,DAD>
media: autoselect
status: active
vmenet1: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
ether 9e:e3:30:6e:88:7f
media: autoselect
status: active
bridge101: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=3<RXCSUM,TXCSUM>
ether 3e:22:fb:bb:c9:65
inet 192.0.2.2 netmask 0xffffff00 broadcast 192.0.2.255
inet6 fe80::3c22:fbff:febb:c965%bridge101 prefixlen 64 scopeid 0x11
inet6 fdb2:2c26:f4e4:1:: prefixlen 64
Configuration:
id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
ipfilter disabled flags 0x0
member: vmenet1 flags=3<LEARNING,DISCOVER>
ifmaxaddr 0 port 16 priority 0 path cost 0
nd6 options=201<PERFORMNUD,DAD>
media: autoselect
status: active
utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
inet6 fe80::c200:b8f7:c343:4d73%utun0 prefixlen 64 scopeid 0x12
nd6 options=201<PERFORMNUD,DAD>
utun1: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 2000
inet6 fe80::91c6:a54b:ce29:8bc7%utun1 prefixlen 64 scopeid 0x13
nd6 options=201<PERFORMNUD,DAD>
utun2: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1000
inet6 fe80::ce81:b1c:bd2c:69e%utun2 prefixlen 64 scopeid 0x14
nd6 options=201<PERFORMNUD,DAD>
Pinging @romankulikov - Do you see any reason why does that command fail in this case?
/usr/local/bin/prlsrvctl net add vagrant-vnet0 --type host-only
I can't reproduce this issue locally, it works just fine on the similar setup - same PD and macOS versions, on the Intel-based Mac.
I know that by default that command produces the interface with CIDR 10.37.132.0/24
, even if we pass any other cidr via --ip
arg (and that's why we don't use it here). But I don't see any other interfaces in the output provided by @davidolrik above with overlapping CIDR.
@davidolrik Meanwhile, let's try to use the same CIDR which you have configured in the Parallels Preferences for the "Host-only" network. Please try add an explicit IPs to the private_network setting, e.q.:
config.vm.define :centos7 do | node |
node.vm.box = "bento/centos-7"
node.vm.hostname = "centos7-01.local"
node.vm.network :private_network, ip: "192.0.2.0", netmask: "255.255.255.0", type: "dhcp"
end
config.vm.define :rhel8 do | node |
node.vm.box = "generic/rhel8"
node.vm.hostname = "rhel8-01.local"
node.vm.network :private_network, ip: "192.0.2.0", netmask: "255.255.255.0", type: "dhcp"
end
In that case it will try to use the existing default "Host-Only" network, since it uses the same CIDR we specify (ip: "192.0.2.0", netmask: "255.255.255.0"
) and it won't try to create new interfaces.
@legal90 Thanks for the work around, I can now spin up my two nodes 👍🏽
According to the docs the ip
argument only assigns a static ip, I would never have guessed that you also can use it to set the network address.
Given the configuration above, I would only expect one private network (host only) to be configured, but a public network (shared) was also added to the nodes - is this intentional?
Network config from inside one of the nodes:
[vagrant@rhel8-01 ~]$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 198.51.100.6 netmask 255.255.255.0 broadcast 198.51.100.255
ether 00:1c:42:a3:d4:77 txqueuelen 1000 (Ethernet)
RX packets 85357 bytes 122966582 (117.2 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 20494 bytes 1594684 (1.5 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.0.2.6 netmask 255.255.255.0 broadcast 192.0.2.255
inet6 fe80::21c:42ff:fed4:d18a prefixlen 64 scopeid 0x20<link>
ether 00:1c:42:d4:d1:8a txqueuelen 1000 (Ethernet)
RX packets 35 bytes 6955 (6.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 40 bytes 4799 (4.6 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
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
@davidolrik Yes, the interface for Shared
network (in your case, eth0 with 198.51.100.6
) is always configured by our Vagrant provider for all Parallels VMs when they are created. This interface is used by Vagrant for the communication with the VM by ssh. But it also enables access between VMs, that's why it's called "Shared"
When you add private_network
to the config, it will just add another interface with desired network settings.
In a common use case - when you just want to access your VM from the Mac, or access multiple VMs from each other - you don't really need any special private_network
config, the default Shared one is enough.
Ok, I find that to be a bit confusing and not at all what I expect to happen - and it could also be the cause of my original problem: If you always add private and public(shared) network, then that could conflict with any user provided configuration.
VMs can also access each other via the private_network
, no need for a "Shared" network for this to work.
"Shared" is what currently is known as public_network
in vagrant, but Hashicorp will rename them to bridged
in a future release because that is what it actually is.
In my opinion you should never add any interfaces automatically, as that could have unintended consequences.
I fixed my issue by changing my VPN protocol from Wireguard to OpenVPN temporarily. This allowed the network to be created.
The root cause seems to be found and the issue is solved, so I'm going to close this issue now.
Ok, I find that to be a bit confusing and not at all what I expect to happen - and it could also be the cause of my original problem: If you always add private and public(shared) network, then that could conflict with any user provided configuration.
VMs can also access each other via the private_network, no need for a "Shared" network for this to work.
"Shared" is what currently is known as public_network in vagrant, but Hashicorp will rename them to bridged in a future release because that is what it actually is.
Just to be precise - "Shared" is actually a private network, not the public one. So, in general case you don't need to add any custom private_network
config in your Vagrantfile unless you really want to.
By default all VMs are connected to "Shared" private network, use the same subnet (configured in Parallels Desktop -> Preferences -> Network). And, as long as this subnet does not overlap with any other networks available on the host, any VM and host can communicate with each other through "Shared" without any issues.
The communication from host to every VM is essential - it's used to configure and provision each VM on vagrant up
step. That's why Shared network is enabled by default.
I just re-read the Network modes in Parallels Desktop for Mac page, and I think there is some language/wording that could use some clarification.
E.g. In Parallels I setup a "Shared" network which is actually private private network, which in vagrant is called a public_network.
The "Host-Only" network in Parallels, is called private_network
in Vagrant which makes sense, but both "Shared" and "Host-Only" are implemented as bridge interfaces in macOS, and the option "Bridged" in Parallels is the one that actually shares the hosts network with the VMs, and the "Bridge" mode can not be used with Vagrant because it is a manual option you select on the running VM.
How would I define a VM that I want to expose to both to my host and other hosts on my local network?
Is that even possible, or would I have to use port forwarding for that case?
E.g. In Parallels I setup a "Shared" network which is actually private private network, which in vagrant is called a public_network.
"Shared" is basically the same as "Host-Only" with the only difference that it is already preconfigured and supposed to be used by the most of Parallels VMs on the same host for easier setup by default. Both are private networks, meaning that they are behind the built-in Parallels NAT and these VMs can not be accessed from outside of your Mac host.
How would I define a VM that I want to expose to both to my host and other hosts on my local network?
Is that even possible, or would I have to use port forwarding for that case?
Yes! Let's say, if you want to expose your VMs to other computers located in the same home WiFi or Ethernet LAN, then just add public_network
config to your Vagrantfile, as described in https://parallels.github.io/vagrant-parallels/docs/networking/public_network.html
Example:
Vagrant.configure("2") do |config|
config.vm.box = "bento/ubuntu-22.04"
config.vm.network "public_network"
end
In that case your VM will receive a second network interface (in addition to the "Shared", which is always there for internal vagrant needs). This second interface will be configured with type "Bridged", and it will work as the documentation says:
A virtual machine appears as a separate computer that belongs to the same subnet as the Mac it is running on.
A DHCP server (e.g., your router) provides a virtual machine with an IP address within the same IP range as other computers in the same subnet.
A virtual machine can ping and see all computers in the subnet.
Other computers can ping and see the virtual machine.