---
title: "Global network set"
description: "Reference for the GlobalNetworkSet resource in Calico Open Source that defines a cluster-scoped set of CIDRs referenced by network policy."
product: "Calico Open Source"
version: "3.33 (latest)"
section: "Reference"
canonical_url: "https://docs.tigera.io/calico/latest/reference/resources/globalnetworkset"
---

# Global network set

A global network set resource (GlobalNetworkSet) represents an arbitrary set of IP subnetworks/CIDRs, allowing it to be matched by Calico policy. Network sets are useful for applying policy to traffic coming from (or going to) external, non-Calico, networks. GlobalNetworkSet is a cluster-scoped resource.

For `kubectl` commands, you can use the aliases `globalnetworkset.projectcalico.org`, `globalnetworksets.projectcalico.org`, `globalnetworkset.p`, and `globalnetworksets.p`.

## Sample YAML

This sample creates a global network set with two CIDRs and the label `role: external-database`.

```yaml
apiVersion: projectcalico.org/v3
kind: GlobalNetworkSet
metadata:
  name: a-name-for-the-set
  labels:
    role: external-database
spec:
  nets:
    - 198.51.100.0/28
    - 203.0.113.0/24
```

## Definition

### Metadata

| Field    | Description                                    | Accepted Values                                                                                                          | Schema                  | Default |
| -------- | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | ----------------------- | ------- |
| `name`   | The name of this global network set. Required. | Lowercase alphanumeric characters, `-`, or `.`. Must start and end with an alphanumeric character. Up to 253 characters. | string                  |         |
| `labels` | A set of labels to apply to this network set.  |                                                                                                                          | map of string to string |         |

### Spec

| Field  | Description                                  | Accepted Values                                                                                                                | Schema          | Default |
| ------ | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | --------------- | ------- |
| `nets` | The IP networks/CIDRs to include in the set. | Valid IPv4 or IPv6 CIDRs, for example `192.0.2.128/25`. IPv4-mapped IPv6 addresses, such as `::ffff:0:0/96`, are not accepted. | list of strings |         |

## Policy matching

The metadata for each network set includes a set of labels. When Calico is calculating the set of IPs that should match a source/destination selector within a [global network policy](https://docs.tigera.io/calico/latest/reference/resources/globalnetworkpolicy.md) rule that has no `namespaceSelector`, or within a [global network policy](https://docs.tigera.io/calico/latest/reference/resources/globalnetworkpolicy.md) or [network policy](https://docs.tigera.io/calico/latest/reference/resources/networkpolicy.md) rule whose `namespaceSelector` includes `global()`, it includes the CIDRs from any network sets that match the selector.

> **NOTE:** Since Calico matches packets based on their source/destination IP addresses, Calico rules may not behave as expected if there is NAT between the Calico-enabled node and the networks listed in a network set. For example, in Kubernetes, incoming traffic via a service IP is typically SNATed by the kube-proxy before reaching the destination host so Calico's workload policy will see the kube-proxy's host's IP as the source instead of the real source.

## Additional resources

- [Use external IPs or networks rules in policy](https://docs.tigera.io/calico/latest/network-policy/policy-rules/external-ips-policy.md)
- [Network set](https://docs.tigera.io/calico/latest/reference/resources/networkset.md)
- [Global network policy](https://docs.tigera.io/calico/latest/reference/resources/globalnetworkpolicy.md)
- [Network policy](https://docs.tigera.io/calico/latest/reference/resources/networkpolicy.md)
