Home / Platform management / Networking / Subnets / Create a subnet (Calico networks)

Create a subnet (Calico networks)

Create a subnet in Calico network to achieve finer network isolation of resources in the cluster.

IP assignment rules

Create the subnets and assign namespaces

  1. In the left navigation pane, click Networking > Subnets.

  2. Click Create Subnet.

  3. Configure the relevant parameters according to the following instructions.

    Parameter Description
    Subnet After assigning the subnet to the namespace, the container groups in the namespace will use IP addresses within this network segment for communication randomly.
    Note: Refer to Reference Content for the correspondence between CIDR and BlockSize.
    Encapsulate Protocol Select the encapsulation protocol. IPIP is not supported in dual-stack mode.
    • IPIP: Use the IPIP protocol to achieve communication across network segments.
    • VXLAN (Alpha): Use the VXLAN protocol to achieve communication across network segments.
    • No Encapsulate: Only directly connect through routing forwarding.
    Encapsulate Mode When the encapsulation protocol is IPIP or VXLAN, the encapsulation mode needs to be set, and the default is Always.
    • Always: Always enable IPIP/VXLAN tunneling.
    • Cross Subnet: Enable IPIP/VXLAN tunneling only when the host is in different subnets; directly connect through routing forwarding when the host is in the same subnet.
    Outbound NAT Select whether to enable outbound NAT (Network Address Translation) for traffic. It is enabled by default.
    It is mainly used to expose the access address to the external network when the subnet container group accesses the external network.
    When outbound NAT is enabled, the host IP will be used as the access address for the current subnet container group; when it is disabled, the IP of the container group within the subnet will be directly exposed to the external network.
  4. Click Confirm.

  5. On the subnet details page, select Actions > Update Namespace.

  6. Complete the configuration and click Update.

References

The dynamic matching relationship between CIDR and blockSize is shown in the following table.

CIDR blockSize Size Number of Hosts Size of Single IP Pool
Prefix<=16 26 1024+ 64
16<Prefix<=19 27 256~1024 32
Prefix=20 28 256 16
Prefix=21 29 256 8
Prefix=22 30 256 4
Prefix=23 30 128 4
Prefix=24 30 64 4
Prefix=25 30 32 4
Prefix=26 31 32 2
Prefix=27 31 16 2
Prefix=28 31 8 2
Prefix=29 31 4 2
Prefix=30 31 2 2
Prefix=31 31 1 2

Note:Subnet configuration with prefix greater than 31 is not supported.