{"record":{"id":"5c84b1545833e219","repo":"hashicorp/vagrant","slug":"the-ip-address-configured-for-the-host-only-networ","errorCode":null,"errorMessage":"The IP address configured for the host-only network is not within the\nallowed ranges. Please update the address used to be within the allowed\nranges and run the command again.\n\n  Address: %{address}\n  Ranges: %{ranges}\n\nValid ranges can be modified in the /etc/vbox/networks.conf file. For\nmore information including valid format see:\n\n  https://www.virtualbox.org/manual/ch06.html#network_hostonly","messagePattern":"The IP address configured for the host-only network is not within the\nallowed ranges\\. Please update the address used to be within the allowed\nranges and run the command again\\.\n\n  Address: %(.+?)\n  Ranges: %(.+?)\n\nValid ranges can be modified in the /etc/vbox/networks\\.conf file\\. For\nmore information including valid format see:\n\n  https://www\\.virtualbox\\.org/manual/ch06\\.html#network_hostonly","errorType":"exception","errorClass":"Vagrant::Errors::VirtualBoxInvalidHostSubnet","httpStatus":null,"severity":"error","filePath":"plugins/providers/virtualbox/action/network.rb","lineNumber":560,"sourceCode":"          nil\n        end\n\n        # Validates the IP used to configure the network is within the allowed\n        # ranges. It only validates if the network configuration file exists.\n        # This was introduced in 6.1.28 so previous version won't have restrictions\n        # placed on the valid ranges\n        def validate_hostonly_ip!(ip, driver)\n          return if Gem::Version.new(driver.version) < HOSTONLY_VALIDATE_VERSION ||\n                    (\n                      Vagrant::Util::Platform.darwin? &&\n                      Gem::Version.new(driver.version) >= DARWIN_IGNORE_HOSTONLY_VALIDATE_VERSION\n                    ) ||\n                    Vagrant::Util::Platform.windows?\n\n          ip = IPAddr.new(ip.to_s) if !ip.is_a?(IPAddr)\n          valid_ranges = load_net_conf\n          return if valid_ranges.any?{ |range| range.include?(ip) }\n          raise Vagrant::Errors::VirtualBoxInvalidHostSubnet,\n            address: ip,\n            ranges: valid_ranges.map{ |r| \"#{r}/#{r.prefix}\" }.join(\", \")\n        end\n\n        def load_net_conf\n          return HOSTONLY_DEFAULT_RANGE if !File.exist?(VBOX_NET_CONF)\n          File.readlines(VBOX_NET_CONF).map do |line|\n            line = line.strip\n            next if !line.start_with?(\"*\")\n            line[1,line.length].strip.split(\" \").map do |entry|\n              IPAddr.new(entry)\n            end\n          end.flatten.compact\n        end\n\n        #-----------------------------------------------------------------\n        # DHCP Server Helper Functions\n        #-----------------------------------------------------------------","sourceCodeStart":542,"sourceCodeEnd":578,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/providers/virtualbox/action/network.rb#L542-L578","documentation":"Since VirtualBox 6.1.28, Linux hosts enforce that host-only adapter IPs fall within ranges allowed by /etc/vbox/networks.conf. validate_hostonly_ip! runs on Linux with driver version >= 6.1.28 (skipped on Windows and on macOS >= 7.0.0), loads the allowed ranges (defaulting to 192.168.56.0/21 when the conf file is absent) and raises VirtualBoxInvalidHostSubnet when the configured IP is outside all of them.","triggerScenarios":"`vagrant up` on Linux with VirtualBox >= 6.1.28 and a private_network ip like 10.0.5.10 or 192.168.100.10, while /etc/vbox/networks.conf does not exist — only the default 192.168.56.0/21 is permitted, so validate_hostonly_ip! raises before the adapter is configured.","commonSituations":"Upgrading VirtualBox past 6.1.28 on Linux breaks Vagrantfiles that always used 10.x or other RFC1918 ranges; CI images without /etc/vbox/networks.conf; teams porting Vagrantfiles from macOS/Windows hosts where the check is skipped.","solutions":["Change the private_network ip to one inside the default range (192.168.56.0–192.168.63.255, i.e. 192.168.56.0/21)","Or widen the allowed ranges: create /etc/vbox/networks.conf containing `* 10.0.0.0/8 192.168.0.0/16 172.16.0.0/12` (lines start with '*') and re-run","Keep /etc/vbox/networks.conf under config management so CI hosts match developer hosts","Check the printed Ranges value in the error to see exactly what is currently allowed"],"exampleFix":"# Vagrantfile - before (Linux + VBox >= 6.1.28, no networks.conf):\nconfig.vm.network 'private_network', ip: '10.0.5.10'\n\n# after (option A - move into default range):\nconfig.vm.network 'private_network', ip: '192.168.56.10'\n\n# after (option B - allow the range on the host):\n# sudo tee /etc/vbox/networks.conf <<< '* 10.0.0.0/8 192.168.0.0/16'","handlingStrategy":"validation","validationCode":"require 'ipaddr'\ndef ip_in_vbox_ranges?(ip)\n  ranges = if File.exist?('/etc/vbox/networks.conf')\n    File.readlines('/etc/vbox/networks.conf').grep(/^\\*/).flat_map { |l| l[1..].strip.split.map { |e| IPAddr.new(e) } }\n  else\n    [IPAddr.new('192.168.56.0/21')]\n  end\n  ranges.any? { |r| r.include?(IPAddr.new(ip.to_s)) }\nend\nabort 'ip outside allowed ranges' unless ip_in_vbox_ranges?('192.168.56.10')","typeGuard":null,"tryCatchPattern":"begin\n  env.cli('up')\nrescue Vagrant::Errors::VirtualBoxInvalidHostSubnet => e\n  warn \"#{e.extra_data[:address]} outside #{e.extra_data[:ranges]} - update /etc/vbox/networks.conf or the ip\"\nend","preventionTips":["On Linux + VirtualBox >= 6.1.28, ship /etc/vbox/networks.conf via config management with your needed ranges","Default to 192.168.56.x private IPs to stay inside the default /21","Remember macOS >= 7.0.0 and Windows skip the check - do not assume CI parity"],"tags":["virtualbox","linux","hostonly","ip-range","networks-conf"],"backgroundTag":"ip-not-in-allowed-range","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}