# metalcloud-cli subnet create Create a new subnet ## Synopsis Create a new subnet in the MetalCloud infrastructure. This command creates a subnet with the configuration provided through JSON input. The configuration must include required fields like network address, prefix length, and whether the subnet should be configured as an IP pool. Required Flags: --config-source Source of the new subnet configuration. Can be 'pipe' to read from stdin, or a path to a JSON file containing the configuration. Configuration Format: The JSON configuration should contain the following fields: - networkAddress (required): IP network address (e.g., "192.168.1.0") - prefixLength (required): Network prefix length (e.g., 24) - isPool (required): Whether this subnet is an IP pool (true/false) - label (optional): Human-readable label for the subnet - name (optional): Subnet name - defaultGatewayAddress (optional): Gateway IP address - parentSubnetId (optional): ID of parent subnet - allocationDenylist (optional): List of IP ranges to exclude from allocation - childOverlapAllowRules (optional): Rules for allowing child subnet overlaps - tags (optional): Key-value pairs for tagging - annotations (optional): Additional metadata Examples: ## Create subnet from stdin echo '{"networkAddress":"10.0.1.0","prefixLength":24,"isPool":false}' | metalcloud-cli subnet create --config-source pipe ## Create subnet from file metalcloud-cli subnet create --config-source subnet-config.json ## Show example configuration first metalcloud-cli subnet config-example > example.json ## Edit example.json and then create metalcloud-cli subnet create --config-source example.json ``` metalcloud-cli subnet create [flags] ``` ### Options ``` --config-source string Source of the new subnet configuration. Can be 'pipe' or path to a JSON file. -h, --help help for create ``` ### Options inherited from parent commands ``` -k, --api_key string MetalCloud API key -c, --config string Config file path -d, --debug Set to enable debug logging -e, --endpoint string MetalCloud API endpoint -f, --format string Output format. Supported values are 'text','csv','md','json','yaml'. (default "text") -i, --insecure_skip_verify Set to allow insecure transport -l, --log_file string Log file path -v, --verbosity string Log level verbosity (default "INFO") ``` ### SEE ALSO * [metalcloud-cli subnet](/content/configuration/cli/metalcloud-cli_subnet.md) - Manage network subnets and IP address pools #### Auto generated by spf13/cobra on 11-Aug-2025