{"record":{"id":"5a9822f34817d71b","repo":"hashicorp/vagrant","slug":"the-configured-network-address-is-not-valid-within","errorCode":null,"errorMessage":"The configured network address is not valid within the configured\nsubnet of the defined network. Please update the network settings\nand try again.\n\n  Configured address: %{address}\n  Network name:       %{network_name}","messagePattern":"The configured network address is not valid within the configured\nsubnet of the defined network\\. Please update the network settings\nand try again\\.\n\n  Configured address: %(.+?)\n  Network name:       %(.+?)","errorType":"exception","errorClass":"VagrantPlugins::DockerProvider::Errors::NetworkAddressInvalid","httpStatus":null,"severity":"error","filePath":"plugins/providers/docker/action/prepare_networks.rb","lineNumber":70,"sourceCode":"          if !env[:machine].provider.driver.existing_named_network?(network_name)\n            raise Errors::NetworkNameUndefined,\n              network_name: network_name\n          end\n          true\n        end\n\n        # Validates that the provided options are compatible with a\n        # pre-existing network. Raises exceptions on invalid configurations\n        #\n        # @param [String] network_name Name of the network\n        # @param [Hash] root_options Root networking options\n        # @param [Hash] network_options Docker scoped networking options\n        # @param [Driver] driver Docker driver\n        # @return [Boolean]\n        def validate_network_configuration!(network_name, root_options, network_options, driver)\n          if root_options[:ip] &&\n              driver.network_containing_address(root_options[:ip]) != network_name\n            raise Errors::NetworkAddressInvalid,\n              address: root_options[:ip],\n              network_name: network_name\n          end\n          if network_options[:subnet] &&\n              driver.network_containing_address(network_options[:subnet]) != network_name\n            raise Errors::NetworkSubnetInvalid,\n              subnet: network_options[:subnet],\n              network_name: network_name\n          end\n          true\n        end\n\n        # Generate configuration for private network\n        #\n        # @param [Hash] root_options Root networking options\n        # @param [Hash] net_options Docker scoped networking options\n        # @param [Hash] env Local call env\n        # @return [String, Hash] Network name and updated network_options","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/providers/docker/action/prepare_networks.rb#L52-L88","documentation":"When a docker network definition resolves to an existing named network, validate_network_configuration! requires the configured static IP to belong to that network: driver.network_containing_address(ip) must return the same network name. An IP outside the network's subnet raises NetworkAddressInvalid with the address and network name.","triggerScenarios":"config.vm.network \"private_network\", name: \"mynet\", ip: \"192.168.50.10\" while mynet's subnet is e.g. 10.9.8.0/24; or the docker network was recreated with a different subnet after the IP was chosen.","commonSituations":"Reusing IPs from another environment; subnet-mask mismatches (network is /25 but the IP was picked as if /24); stale notes about network ranges.","solutions":["Read the network's real subnet with `docker network inspect mynet` and pick an IP inside it","Or delete and recreate the docker network with a subnet containing your desired IP","Or drop the name: option and set subnet via docker_network__subnet so Vagrant derives or creates a matching network"],"exampleFix":"# before\nconfig.vm.network \"private_network\", name: \"mynet\", ip: \"192.168.50.10\"\n# mynet is 10.9.8.0/24 -> NetworkAddressInvalid\n\n# after\nconfig.vm.network \"private_network\", name: \"mynet\", ip: \"10.9.8.42\"","handlingStrategy":"validation","validationCode":"# verify the static ip falls inside the network's subnet before up\nSUBNET=$(docker network inspect mynet --format '{{(index .IPAM.Config 0).Subnet}}')\nruby -ripaddr -e \"abort 'ip outside subnet' unless IPAddr.new('#{SUBNET}').include?('10.9.8.42')\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Derive static IPs from `docker network inspect` output, never from memory","Document each network's subnet next to its Vagrantfile definition","Re-validate IPs after recreating any docker network"],"tags":["vagrant","docker","network","ip","subnet"],"backgroundTag":"ip-outside-subnet","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}