hashicorp/vagrant · error · Vagrant::Errors::NetworkCollision
The specified host network collides with a non-hostonly netw
Error message
The specified host network collides with a non-hostonly network!
This will cause your specified IP to be inaccessible. Please change
the IP or name of your host only network so that it no longer matches that of
a bridged or non-hostonly network.
Bridged Network Address: '%{netaddr}'
Host-only Network '%{interface_name}': '%{that_netaddr}' What it means
For IPv4 private networks, the action computes the host-only subnet (netaddr) and compares it against the network address of every bridged (physical) interface from read_bridged_interfaces. If they are equal and the interface status is not 'Down', it raises NetworkCollision: routing would send host-only traffic out the real interface, making the configured IP unreachable.
Source
Thrown at plugins/providers/virtualbox/action/network.rb:336
raise Vagrant::Errors::NetworkAddressInvalid,
address: options[:ip], mask: options[:netmask],
error: e.message
end
validate_hostonly_ip!(options[:ip], @env[:machine].provider.driver)
if ip.ipv4?
# Verify that a host-only network subnet would not collide
# with a bridged networking interface.
#
# If the subnets overlap in any way then the host only network
# will not work because the routing tables will force the
# traffic onto the real interface rather than the VirtualBox
# interface.
@env[:machine].provider.driver.read_bridged_interfaces.each do |interface|
that_netaddr = network_address(interface[:ip], interface[:netmask])
if netaddr == that_netaddr && interface[:status] != "Down"
raise Vagrant::Errors::NetworkCollision,
netaddr: netaddr,
that_netaddr: that_netaddr,
interface_name: interface[:name]
end
end
end
# Calculate the adapter IP which is the network address with
# the final bit + 1. Usually it is "x.x.x.1" for IPv4 and
# "<prefix>::1" for IPv6
options[:adapter_ip] ||= (netaddr | 1).to_s
dhcp_options = {}
if options[:type] == :dhcp
# Calculate the DHCP server IP and lower & upper bound
# Example: for "192.168.22.64/26" network range those are:
# dhcp_ip: "192.168.22.66",
# dhcp_lower: "192.168.22.67"View on GitHub (pinned to 35f3160f4a)
Solutions
- Change the private_network ip (and/or netmask) to a subnet no physical interface uses, e.g. 192.168.56.x or 172.28.x.x
- List candidates first: `VBoxManage list bridgedifs` (or ipconfig/ifconfig) and pick a free subnet
- Disconnect/disable the colliding interface (unplug dock, disable VPN) if it must not participate
- In shared environments, document the reserved Vagrant subnets so teams do not collide
Example fix
# Vagrantfile - before (host LAN is 192.168.1.0/24): config.vm.network 'private_network', ip: '192.168.1.50' # after: config.vm.network 'private_network', ip: '192.168.56.50', netmask: '255.255.255.0'
Defensive patterns
Strategy: validation
Validate before calling
require 'ipaddr'
def collides_with_bridged?(desired_ip, netmask)
desired = IPAddr.new("#{desired_ip}/#{netmask}")
`VBoxManage list bridgedifs`.scan(/IPAddress:\s+(\S+).*?NetworkMask:\s+(\S+)/m).any? do |ip, mask|
IPAddr.new("#{ip}/#{mask}") == desired
end
end
abort 'subnet collides with a bridged interface' if collides_with_bridged?('192.168.1.50', 24) Try / catch
begin
env.cli('up')
rescue Vagrant::Errors::NetworkCollision => e
warn "Host-only #{e.extra_data[:netaddr]} collides with #{e.extra_data[:interface_name]} - pick another subnet"
end Prevention
- Reserve an uncommon subnet (192.168.56.0/21 or 172.28.x) for Vagrant in your team
- Check `VBoxManage list bridgedifs` when moving between networks (office/home/VPN)
- Parametrize the private_network ip per developer to avoid LAN collisions
When it happens
Trigger: `vagrant up` with `config.vm.network 'private_network', ip: 'x.x.x.y'` where x.x.x.0/24 (given the netmask) equals the subnet of a connected physical NIC — e.g. laptop on a 192.168.1.0/24 LAN plus private_network ip '192.168.1.50'.
Common situations: Corporate/home LANs on 192.168.1.x or 10.0.0.x colliding with common Vagrant example IPs; docking/VPN adapters appearing after the Vagrantfile was written; CI hosts with many bridged NICs.
Related errors
- The specified host network could not be found: '%{name}.' If
- NFS requires a host-only network to be created. Please add a
- Network settings specified in your Vagrantfile define an inv
- The IP address configured for the host-only network is not w
- Could not find a required VirtualBox guest property: %{gue
AI-assisted analysis of hashicorp/vagrant@35f3160f4a (2026-08-21).
Data as JSON: /api/errors/3348b7dc9119b246.
Report an issue: GitHub.