{"record":{"id":"3348b7dc9119b246","repo":"hashicorp/vagrant","slug":"the-specified-host-network-collides-with-a-non-hos","errorCode":null,"errorMessage":"The specified host network collides with a non-hostonly network!\nThis will cause your specified IP to be inaccessible. Please change\nthe IP or name of your host only network so that it no longer matches that of\na bridged or non-hostonly network.\n\nBridged Network Address: '%{netaddr}'\nHost-only Network '%{interface_name}': '%{that_netaddr}'","messagePattern":"The specified host network collides with a non-hostonly network!\nThis will cause your specified IP to be inaccessible\\. Please change\nthe IP or name of your host only network so that it no longer matches that of\na bridged or non-hostonly network\\.\n\nBridged Network Address: '%(.+?)'\nHost-only Network '%(.+?)': '%(.+?)'","errorType":"exception","errorClass":"Vagrant::Errors::NetworkCollision","httpStatus":null,"severity":"error","filePath":"plugins/providers/virtualbox/action/network.rb","lineNumber":336,"sourceCode":"            raise Vagrant::Errors::NetworkAddressInvalid,\n              address: options[:ip], mask: options[:netmask],\n              error: e.message\n          end\n\n          validate_hostonly_ip!(options[:ip], @env[:machine].provider.driver)\n\n          if ip.ipv4?\n            # Verify that a host-only network subnet would not collide\n            # with a bridged networking interface.\n            #\n            # If the subnets overlap in any way then the host only network\n            # will not work because the routing tables will force the\n            # traffic onto the real interface rather than the VirtualBox\n            # interface.\n            @env[:machine].provider.driver.read_bridged_interfaces.each do |interface|\n              that_netaddr = network_address(interface[:ip], interface[:netmask])\n              if netaddr == that_netaddr && interface[:status] != \"Down\"\n                raise Vagrant::Errors::NetworkCollision,\n                  netaddr: netaddr,\n                  that_netaddr: that_netaddr,\n                  interface_name: interface[:name]\n              end\n            end\n          end\n\n          # Calculate the adapter IP which is the network address with\n          # the final bit + 1. Usually it is \"x.x.x.1\" for IPv4 and\n          # \"<prefix>::1\" for IPv6\n          options[:adapter_ip] ||= (netaddr | 1).to_s\n\n          dhcp_options = {}\n          if options[:type] == :dhcp\n            # Calculate the DHCP server IP and lower & upper bound\n            # Example: for \"192.168.22.64/26\" network range those are:\n            # dhcp_ip: \"192.168.22.66\",\n            # dhcp_lower: \"192.168.22.67\"","sourceCodeStart":318,"sourceCodeEnd":354,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/providers/virtualbox/action/network.rb#L318-L354","documentation":"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.","triggerScenarios":"`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'.","commonSituations":"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.","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"],"exampleFix":"# Vagrantfile - before (host LAN is 192.168.1.0/24):\nconfig.vm.network 'private_network', ip: '192.168.1.50'\n\n# after:\nconfig.vm.network 'private_network', ip: '192.168.56.50', netmask: '255.255.255.0'","handlingStrategy":"validation","validationCode":"require 'ipaddr'\ndef collides_with_bridged?(desired_ip, netmask)\n  desired = IPAddr.new(\"#{desired_ip}/#{netmask}\")\n  `VBoxManage list bridgedifs`.scan(/IPAddress:\\s+(\\S+).*?NetworkMask:\\s+(\\S+)/m).any? do |ip, mask|\n    IPAddr.new(\"#{ip}/#{mask}\") == desired\n  end\nend\nabort 'subnet collides with a bridged interface' if collides_with_bridged?('192.168.1.50', 24)","typeGuard":null,"tryCatchPattern":"begin\n  env.cli('up')\nrescue Vagrant::Errors::NetworkCollision => e\n  warn \"Host-only #{e.extra_data[:netaddr]} collides with #{e.extra_data[:interface_name]} - pick another subnet\"\nend","preventionTips":["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"],"tags":["virtualbox","network","hostonly","subnet-collision","bridged"],"backgroundTag":"ip-subnet-collision","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}