hashicorp/vagrant · error

The provided gateway IP (%{gateway}) is not within the defin

Error message

The provided gateway IP (%{gateway}) is not within the defined
subnet (%{subnet}). Please provide an IP address within the
defined subnet.

What it means

Error "The provided gateway IP (%{gateway}) is not within the defined subnet (%{subnet}). Please provide an IP address within the defined subnet." thrown in hashicorp/vagrant.

Source

Thrown at plugins/providers/docker/action/prepare_networks.rb:253

        # @param [Hash] env Local call env
        # @return [String] Gateway address
        def request_public_gateway(network_options, interface, env)
          subnet = IPAddr.new(network_options[:subnet])
          gateway = nil
          while !gateway
            gateway = env[:ui].ask(I18n.t(
              "docker_provider.network_bridge_gateway_request",
              interface: interface,
              default_gateway: network_options[:gateway]) + " ",
              prefix: false
            ).strip
            if gateway.empty?
              gateway = network_options[:gateway]
            end
            begin
              gateway = IPAddr.new(gateway)
              if !subnet.include?(gateway)
                env[:ui].warn(I18n.t("docker_provider.network_bridge_gateway_outofbounds",
                  gateway: gateway,
                  subnet: network_options[:subnet]) + "\n", prefix: false)
              end
            rescue IPAddr::InvalidAddressError
              env[:ui].warn(I18n.t("docker_provider.network_bridge_gateway_invalid",
                gateway: gateway) + "\n", prefix: false)
              gateway = nil
            end
          end
          gateway.to_s
        end

        # Request the IP range allowed for use by docker when creating a new
        # public network
        #
        # TODO: When the Vagrant installer upgrades to Ruby 2.5.x,
        # remove all instances of the roundabout way of determining a prefix
        # and instead just use the built-in `.prefix` method

View on GitHub (pinned to 35f3160f4a)

When it happens

Trigger: Thrown at plugins/providers/docker/action/prepare_networks.rb:253 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of hashicorp/vagrant@35f3160f4a (2026-08-21). Data as JSON: /api/errors/50a06d2dcae0fba9. Report an issue: GitHub.