// Module included in the following assemblies:
//
// * networking/configuring-cluster-network-range.adoc

:_mod-docs-content-type: PROCEDURE
[id="nw-cluster-network-range-edit_{context}"]
= Expanding the cluster network IP address range

[role="_abstract"]
To expand the cluster network IP address range in {product-title} to support more nodes, you can modify the cluster network CIDR mask using the `oc patch` command.

[NOTE]
====
This change requires rolling out a new Operator configuration across the cluster, and can take up to 30 minutes to take effect.

For clusters configured with cluster proxy, expanding the cluster network range also triggers a MachineConfigPool update that reboots all nodes. Plan this operation during a maintenance window to avoid service disruption.
====

.Prerequisites

* You have installed the OpenShift CLI (`oc`).
* You have logged in to the cluster with a user with `cluster-admin` privileges.
* You have ensured that the cluster uses the OVN-Kubernetes network plugin.

.Procedure

. To obtain the cluster network range and host prefix for your cluster, enter the following command:
+
[source,terminal]
----
$ oc get network.operator.openshift.io \
  -o jsonpath="{.items[0].spec.clusterNetwork}"
----
+
.Example output
[source,text]
----
[{"cidr":"10.217.0.0/22","hostPrefix":23}]
----

. To expand the cluster network IP address range, enter the following command. Use the CIDR IP address range and host prefix returned from the output of the previous command.
+
[source,terminal]
----
$ oc patch Network.config.openshift.io cluster --type='merge' --patch \
  '{
    "spec":{
      "clusterNetwork": [ {"cidr":"<network>/<cidr>","hostPrefix":<prefix>} ],
      "networkType": "OVNKubernetes"
    }
  }'
----
+
--
where:

`<network>`:: Specifies the network part of the `cidr` field that you obtained from the previous step. You cannot change this value.
`<cidr>`:: Specifies the network prefix length. For example, `14`. Change this value to a smaller number than the value from the output in the previous step to expand the cluster network range.
`<prefix>`:: Specifies the current host prefix for your cluster. This value must be the same value for the `hostPrefix` field that you obtained from the previous step.
--
+
.Example command
[source,terminal]
----
$ oc patch Network.config.openshift.io cluster --type='merge' --patch \
  '{
    "spec":{
      "clusterNetwork": [ {"cidr":"10.217.0.0/14","hostPrefix": 23} ],
      "networkType": "OVNKubernetes"
    }
  }'
----
+
.Example output
[source,text]
----
network.config.openshift.io/cluster patched
----

. To confirm that the configuration is active, enter the following command. It can take up to 30 minutes for this change to take effect.
+
[source,terminal]
----
$ oc get network.operator.openshift.io \
  -o jsonpath="{.items[0].spec.clusterNetwork}"
----
+
.Example output
[source,text]
----
[{"cidr":"10.217.0.0/14","hostPrefix":23}]
----
