{"slug":"ip-sets","title":"IP sets","tags":["tailscale","access-control","file-sharing"],"agent_summary":"Last validated: Oct 29, 2025","trigger_phrases":[],"runnable":false,"markdown":"\r\n# IP sets\r\n\r\nLast validated: Oct 29, 2025\r\n\r\nAn IP set is a way to manage groups of IP addresses. It can encapsulate a collection of [targets](https://tailscale.com/docs/reference/targets-and-selectors), such as IP addresses, CIDRs, hosts, [autogroups](https://tailscale.com/docs/reference/targets-and-selectors#autogroups), and other IP sets. Tailscale translates everything in the IP set to a list of IP address ranges. You can use the [`ipset` syntax](https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#syntax) to create IP sets within your [tailnet policy file](https://tailscale.com/docs/features/tailnet-policy-file) and [reference](https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#references) them from [access control](https://tailscale.com/docs/features/access-control) policies such as [ACLs](https://tailscale.com/docs/features/access-control/acls) and [grants](https://tailscale.com/docs/features/access-control/grants).\r\n\r\nThe primary benefit of IP sets is that they let you group multiple network parts into a single collection, enabling you to apply access control policies to the collection rather than the individual IP addresses, hosts, or subnets.\r\n\r\nYou can leverage IP sets in a variety of ways. For example, you can:\r\n\r\n- Target and manage logical cross-sections of your tailnet independently of other groupings like [subnets](https://tailscale.com/docs/features/subnet-routers), [tags](https://tailscale.com/docs/features/tags), and [groups](https://tailscale.com/docs/reference/syntax/policy-file#groups).\r\n- Target a subnet in access control policies while excluding a few specific hosts.\r\n- [Customize an autogroup](https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#customize-autogroupinternet) to exclude some private or public subnets from global [exit node](https://tailscale.com/docs/features/exit-nodes) access.\r\n- Facilitate a more modular organization of your [tailnet policy file](https://tailscale.com/docs/features/tailnet-policy-file).\r\n\r\n## [Limitations](https://tailscale.com/docs/features/tailnet-policy-file/ip-sets\\#limitations)\r\n\r\nIP sets have the following limitations:\r\n\r\n- You can't include [tags](https://tailscale.com/docs/features/tags), [users](https://tailscale.com/docs/reference/user-roles), or [groups](https://tailscale.com/docs/reference/syntax/policy-file#groups) in IP sets.\r\n- You can't use circular references to IP sets.\r\n- The only supported [autogroup](https://tailscale.com/docs/reference/syntax/policy-file#autogroups) is `autogroup:internet`. This is because `autogroup:internet` is the only autogroup that refers to IP address ranges. The other autogroups refer to unsupported targets, such as tags, users, and dynamic sets of devices.\r\n\r\n## [Syntax](https://tailscale.com/docs/features/tailnet-policy-file/ip-sets\\#syntax)\r\n\r\nAn `ipset` is an object within the tailnet policy file that defines one or more named `ipsets`. Each named `ipset` contains one or more [operations](https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#operations), each adding or removing a [target](https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#targets).\r\n\r\nThe following example demonstrates the basic syntax for creating an `ipset` in the tailnet policy file where `<name>` is the name of the IP set and `<target>` is a CIDR, IP address, host, autogroup, or IP set.\r\n\r\n```json\r\n\"ipsets\": {\r\n  \"ipset:<name>\": [\\\r\n    \"add <target>\",\\\r\n    \"remove <target>\"\\\r\n  ]\r\n}\r\n```\r\n\r\nYou can use the [visual policy editor](https://tailscale.com/docs/features/visual-editor) to manage your tailnet policy file. Refer to the [visual editor reference](https://tailscale.com/docs/reference/visual-editor) for guidance on using the visual editor.\r\n\r\n### [Operations](https://tailscale.com/docs/features/tailnet-policy-file/ip-sets\\#operations)\r\n\r\nThe `ipset` syntax supports two operations: `add` and `remove`. Each named IP set can have one or more operations, which are processed in order.\r\n\r\nYou must include the operation type before the [target](https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#targets) unless the named [IP set only uses `add` operations](https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#create-ip-sets-with-only-add-operations).\r\n\r\n| **Operation** | **Description** |\r\n| --- | --- |\r\n| `add` | Adds a target to a named IP set. |\r\n| `remove` | Removes a target from a named IP set. |\r\n\r\n### [Targets](https://tailscale.com/docs/features/tailnet-policy-file/ip-sets\\#targets)\r\n\r\nA target is a [CIDR](https://www.rfc-editor.org/rfc/rfc4632.html), IP address, [host](https://tailscale.com/docs/reference/syntax/policy-file#hosts), autogroup, or IP set that you add to or remove from a named IP set. Each target must be preceded by an [operation](https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#operations) (`add` or `remove`) unless the named IP set only adds targets (and doesn't remove any IP addresses).\r\n\r\n| **Target** | **Syntax** | **Example** |\r\n| --- | --- | --- |\r\n| CIDR | `<cidr>` | `192.0.2.0/24`, `2001:db8::/32` |\r\n| IP address | `<ip-address>` | `192.0.2.33`, `2001:db8::` |\r\n| IP address range | `<ip-range-start>-<ip-range-end>` | `192.0.2.50-192.0.2.100` , `2001:db8::5-2001:db8::9` |\r\n| Host | `host:<name>` | `host:sql-server-1` |\r\n| Autogroup | `autogroup:internet` | `autogroup:internet` |\r\n| IP set | `ipset:<name>` | `ipset:prod` |\r\n\r\nHosts refers to the [hosts](https://tailscale.com/docs/reference/syntax/policy-file#hosts) section of the tailnet policy file, not MagicDNS names.\r\n\r\n### [References](https://tailscale.com/docs/features/tailnet-policy-file/ip-sets\\#references)\r\n\r\nYou can reference named IP sets from specific parts of the tailnet policy file using the format `ipset:<name>` where `<name>` is the name of the IP set.\r\n\r\nThe following sections of the tailnet policy file support referencing IP sets:\r\n\r\n- [ACLs](https://tailscale.com/docs/features/access-control/acls) (sources and destinations)\r\n- [Grants](https://tailscale.com/docs/features/access-control/grants) (sources and destinations)\r\n- IP sets\r\n\r\n## [Examples](https://tailscale.com/docs/features/tailnet-policy-file/ip-sets\\#examples)\r\n\r\nThe following examples illustrate how to leverage IP sets.\r\n\r\n- [Create an IP set with only add operations](https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#create-ip-sets-with-only-add-operations).\r\n- [Create an IP set that contains several subnets and excludes a single IP address](https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#create-an-ip-set-that-adds-several-subnets-and-excludes-a-single-ip-address).\r\n- [Create an IP set that excludes another IP set](https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#create-an-ip-set-that-excludes-another-ip-set).\r\n- [Reference IP sets in grants](https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#reference-ip-sets-in-grants).\r\n- [Reference IP sets in ACLs](https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#reference-ip-sets-in-acls).\r\n- [Customize `autogroup:internet`](https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#customize-autogroupinternet).\r\n\r\n### [Create IP sets with only add operations](https://tailscale.com/docs/features/tailnet-policy-file/ip-sets\\#create-ip-sets-with-only-add-operations)\r\n\r\nThe following IP sets don't remove any [targets](https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#targets). As a result, they can use a simplified syntax that omits the [operation type](https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#operations) (because `add` is assumed).\r\n\r\n```json\r\n\"ipsets\": {\r\n  \"ipset:prod\": [\"192.0.2.0/24\"],\r\n  \"ipset:dev\": [\\\r\n    \"198.51.100.0/24\",\\\r\n    \"203.0.113.0/24\",\\\r\n    \"host:sql-server-1\",\\\r\n  ]\r\n}\r\n```\r\n\r\nYou can use the [visual policy editor](https://tailscale.com/docs/features/visual-editor) to manage your tailnet policy file. Refer to the [visual editor reference](https://tailscale.com/docs/reference/visual-editor) for guidance on using the visual editor.\r\n\r\n### [Create an IP set that adds several subnets and excludes a single IP address](https://tailscale.com/docs/features/tailnet-policy-file/ip-sets\\#create-an-ip-set-that-adds-several-subnets-and-excludes-a-single-ip-address)\r\n\r\nThe following example shows how to create an IP set that includes several subnets and excludes a single IP address.\r\n\r\n```json\r\n\"ipsets\": {\r\n  \"ipset:prod\": [\\\r\n    \"add 192.0.2.0/24\",\\\r\n    \"add 2001:db8::/32\",\\\r\n    \"add 198.51.100.0/24\",\\\r\n    \"add 203.0.113.0/24\",\\\r\n    \"remove 192.0.2.33\",\\\r\n  ],\r\n}\r\n```\r\n\r\nYou can use the [visual policy editor](https://tailscale.com/docs/features/visual-editor) to manage your tailnet policy file. Refer to the [visual editor reference](https://tailscale.com/docs/reference/visual-editor) for guidance on using the visual editor.\r\n\r\n### [Create an IP set that excludes another IP set](https://tailscale.com/docs/features/tailnet-policy-file/ip-sets\\#create-an-ip-set-that-excludes-another-ip-set)\r\n\r\nThe following example creates a `dev` IP set and a `prod` IP set. The `prod` IP set excludes anything in the `dev` IP set.\r\n\r\n```json\r\n\"ipsets\": {\r\n  \"ipset:dev\": [\"host:sql-server-1\"],\r\n  \"ipset:prod\": [\\\r\n    \"add 192.0.2.0/24\",\\\r\n    \"add 198.51.100.0/24\",\\\r\n    \"remove ipset:dev\",\\\r\n  ]\r\n}\r\n```\r\n\r\nYou can use the [visual policy editor](https://tailscale.com/docs/features/visual-editor) to manage your tailnet policy file. Refer to the [visual editor reference](https://tailscale.com/docs/reference/visual-editor) for guidance on using the visual editor.\r\n\r\n### [Reference IP sets in grants](https://tailscale.com/docs/features/tailnet-policy-file/ip-sets\\#reference-ip-sets-in-grants)\r\n\r\nThe following example shows how to create [grants](https://tailscale.com/docs/features/access-control/grants) that [reference](https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#references) the `dev` IP set.\r\n\r\n```json\r\n\"grants\": [\\\r\n  {\\\r\n    \"src\": [\"group:devops\"],\\\r\n    \"dst\": [\"ipset:dev\"],\\\r\n    \"ip\": [\"80\",\"443\",\"22\"]\\\r\n  },\\\r\n  {\\\r\n    \"src\": [\"group:dev\"],\\\r\n    \"dst\": [\"ipset:dev\"],\\\r\n    \"ip\": [\"80\",\"443\"],\\\r\n    \"via\": [\"tag:office-routers\"],\\\r\n  },\\\r\n]\r\n```\r\n\r\nYou can use the [visual policy editor](https://tailscale.com/docs/features/visual-editor) to manage your tailnet policy file. Refer to the [visual editor reference](https://tailscale.com/docs/reference/visual-editor) for guidance on using the visual editor.\r\n\r\n### [Reference IP sets in ACLs](https://tailscale.com/docs/features/tailnet-policy-file/ip-sets\\#reference-ip-sets-in-acls)\r\n\r\nThe following example shows how to create [ACLs](https://tailscale.com/docs/features/access-control/acls) that [reference](https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#references) the `prod` IP set.\r\n\r\n```json\r\n\"acls\": [\\\r\n  {\\\r\n    \"src\":    [\"group:devops\"],\\\r\n    \"dst\":    [\"ipset:prod:*\"],\\\r\n    \"action\": \"accept\",\\\r\n  },\\\r\n],\r\n```\r\n\r\nYou can use the [visual policy editor](https://tailscale.com/docs/features/visual-editor) to manage your tailnet policy file. Refer to the [visual editor reference](https://tailscale.com/docs/reference/visual-editor) for guidance on using the visual editor.\r\n\r\n### [Customize `autogroup:internet`](https://tailscale.com/docs/features/tailnet-policy-file/ip-sets\\#customize-autogroupinternet)\r\n\r\nYou can use IP sets to customize the traffic that flows through an exit node (when enabled) in the tailnet using [`autogroup:internet`](https://tailscale.com/docs/reference/syntax/policy-file#autogroups).\r\n\r\nThe following example creates an IP set named `internet` that customizes `autogroup:internet` by doing the following:\r\n\r\n- Adds `autogroup:internet`.\r\n- Removes the production application gateways (`ipset:cdn-edge`).\r\n- Removes the publicly accessible partner network (`ipset:partner-net`).\r\n- [Grants](https://tailscale.com/docs/features/access-control/grants) the `internet` IP set (a subset of internet-bound traffic) access to the Seattle and London office [exit nodes](https://tailscale.com/docs/features/exit-nodes).\r\n\r\n```json\r\n\"ipsets\": {\r\n  \"ipset:internet\": [\\\r\n    \"add autogroup:internet\",\\\r\n    \"remove ipset:cdn-edge\",\\\r\n    \"remove ipset:partner-net\"\\\r\n  ],\r\n  \"ipset:cdn-edge\": [\"8.21.9.6\", \"8.21.9.7\", \"8.21.9.13\", \"8.21.9.14\"],\r\n  \"ipset:partner-net\": [\"52.23.40.0/24\"]\r\n},\r\n\"grants\": [\\\r\n  {\\\r\n    \"src\": [\"group:sea\"],\\\r\n    \"dst\": [\"ipset:internet\"],\\\r\n    \"ip\":  [\"*\"],\\\r\n    \"via\": [\"tag:officerouter-sea\"],\\\r\n  },\\\r\n  {\\\r\n    \"src\": [\"group:lhr\"],\\\r\n    \"dst\": [\"ipset:internet\"],\\\r\n    \"ip\":  [\"*\"],\\\r\n    \"via\": [\"tag:officerouter-lhr\"],\\\r\n  }\\\r\n]\r\n```\r\n\r\nYou can use the [visual policy editor](https://tailscale.com/docs/features/visual-editor) to manage your tailnet policy file. Refer to the [visual editor reference](https://tailscale.com/docs/reference/visual-editor) for guidance on using the visual editor.\r\n\r\n![Project Logo](https://cdn.brandfetch.io/tailscale.com/fallback/lettermark/theme/dark/h/256/w/256/icon?c=1bfwsmEH20zzEfSNTed)\r\n\r\nAsk AI\r\n\r\nreCAPTCHA\r\n\r\nRecaptcha requires verification.\r\n\r\nprotected by **reCAPTCHA**\r\n","html":"<h1>IP sets</h1>\n<p>Last validated: Oct 29, 2025</p>\n<p>An IP set is a way to manage groups of IP addresses. It can encapsulate a collection of <a href=\"https://tailscale.com/docs/reference/targets-and-selectors\">targets</a>, such as IP addresses, CIDRs, hosts, <a href=\"https://tailscale.com/docs/reference/targets-and-selectors#autogroups\">autogroups</a>, and other IP sets. Tailscale translates everything in the IP set to a list of IP address ranges. You can use the <a href=\"https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#syntax\"><code>ipset</code> syntax</a> to create IP sets within your <a href=\"https://tailscale.com/docs/features/tailnet-policy-file\">tailnet policy file</a> and <a href=\"https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#references\">reference</a> them from <a href=\"https://tailscale.com/docs/features/access-control\">access control</a> policies such as <a href=\"https://tailscale.com/docs/features/access-control/acls\">ACLs</a> and <a href=\"https://tailscale.com/docs/features/access-control/grants\">grants</a>.</p>\n<p>The primary benefit of IP sets is that they let you group multiple network parts into a single collection, enabling you to apply access control policies to the collection rather than the individual IP addresses, hosts, or subnets.</p>\n<p>You can leverage IP sets in a variety of ways. For example, you can:</p>\n<ul>\n<li>Target and manage logical cross-sections of your tailnet independently of other groupings like <a href=\"https://tailscale.com/docs/features/subnet-routers\">subnets</a>, <a href=\"https://tailscale.com/docs/features/tags\">tags</a>, and <a href=\"https://tailscale.com/docs/reference/syntax/policy-file#groups\">groups</a>.</li>\n<li>Target a subnet in access control policies while excluding a few specific hosts.</li>\n<li><a href=\"https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#customize-autogroupinternet\">Customize an autogroup</a> to exclude some private or public subnets from global <a href=\"https://tailscale.com/docs/features/exit-nodes\">exit node</a> access.</li>\n<li>Facilitate a more modular organization of your <a href=\"https://tailscale.com/docs/features/tailnet-policy-file\">tailnet policy file</a>.</li>\n</ul>\n<h2><a href=\"https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#limitations\">Limitations</a></h2>\n<p>IP sets have the following limitations:</p>\n<ul>\n<li>You can't include <a href=\"https://tailscale.com/docs/features/tags\">tags</a>, <a href=\"https://tailscale.com/docs/reference/user-roles\">users</a>, or <a href=\"https://tailscale.com/docs/reference/syntax/policy-file#groups\">groups</a> in IP sets.</li>\n<li>You can't use circular references to IP sets.</li>\n<li>The only supported <a href=\"https://tailscale.com/docs/reference/syntax/policy-file#autogroups\">autogroup</a> is <code>autogroup:internet</code>. This is because <code>autogroup:internet</code> is the only autogroup that refers to IP address ranges. The other autogroups refer to unsupported targets, such as tags, users, and dynamic sets of devices.</li>\n</ul>\n<h2><a href=\"https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#syntax\">Syntax</a></h2>\n<p>An <code>ipset</code> is an object within the tailnet policy file that defines one or more named <code>ipsets</code>. Each named <code>ipset</code> contains one or more <a href=\"https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#operations\">operations</a>, each adding or removing a <a href=\"https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#targets\">target</a>.</p>\n<p>The following example demonstrates the basic syntax for creating an <code>ipset</code> in the tailnet policy file where <code>&#x3C;name></code> is the name of the IP set and <code>&#x3C;target></code> is a CIDR, IP address, host, autogroup, or IP set.</p>\n<pre><code class=\"language-json\">\"ipsets\": {\r\n  \"ipset:&#x3C;name>\": [\\\r\n    \"add &#x3C;target>\",\\\r\n    \"remove &#x3C;target>\"\\\r\n  ]\r\n}\n</code></pre>\n<p>You can use the <a href=\"https://tailscale.com/docs/features/visual-editor\">visual policy editor</a> to manage your tailnet policy file. Refer to the <a href=\"https://tailscale.com/docs/reference/visual-editor\">visual editor reference</a> for guidance on using the visual editor.</p>\n<h3><a href=\"https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#operations\">Operations</a></h3>\n<p>The <code>ipset</code> syntax supports two operations: <code>add</code> and <code>remove</code>. Each named IP set can have one or more operations, which are processed in order.</p>\n<p>You must include the operation type before the <a href=\"https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#targets\">target</a> unless the named <a href=\"https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#create-ip-sets-with-only-add-operations\">IP set only uses <code>add</code> operations</a>.</p>\n<p>| <strong>Operation</strong> | <strong>Description</strong> |\r\n| --- | --- |\r\n| <code>add</code> | Adds a target to a named IP set. |\r\n| <code>remove</code> | Removes a target from a named IP set. |</p>\n<h3><a href=\"https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#targets\">Targets</a></h3>\n<p>A target is a <a href=\"https://www.rfc-editor.org/rfc/rfc4632.html\">CIDR</a>, IP address, <a href=\"https://tailscale.com/docs/reference/syntax/policy-file#hosts\">host</a>, autogroup, or IP set that you add to or remove from a named IP set. Each target must be preceded by an <a href=\"https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#operations\">operation</a> (<code>add</code> or <code>remove</code>) unless the named IP set only adds targets (and doesn't remove any IP addresses).</p>\n<p>| <strong>Target</strong> | <strong>Syntax</strong> | <strong>Example</strong> |\r\n| --- | --- | --- |\r\n| CIDR | <code>&#x3C;cidr></code> | <code>192.0.2.0/24</code>, <code>2001:db8::/32</code> |\r\n| IP address | <code>&#x3C;ip-address></code> | <code>192.0.2.33</code>, <code>2001:db8::</code> |\r\n| IP address range | <code>&#x3C;ip-range-start>-&#x3C;ip-range-end></code> | <code>192.0.2.50-192.0.2.100</code> , <code>2001:db8::5-2001:db8::9</code> |\r\n| Host | <code>host:&#x3C;name></code> | <code>host:sql-server-1</code> |\r\n| Autogroup | <code>autogroup:internet</code> | <code>autogroup:internet</code> |\r\n| IP set | <code>ipset:&#x3C;name></code> | <code>ipset:prod</code> |</p>\n<p>Hosts refers to the <a href=\"https://tailscale.com/docs/reference/syntax/policy-file#hosts\">hosts</a> section of the tailnet policy file, not MagicDNS names.</p>\n<h3><a href=\"https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#references\">References</a></h3>\n<p>You can reference named IP sets from specific parts of the tailnet policy file using the format <code>ipset:&#x3C;name></code> where <code>&#x3C;name></code> is the name of the IP set.</p>\n<p>The following sections of the tailnet policy file support referencing IP sets:</p>\n<ul>\n<li><a href=\"https://tailscale.com/docs/features/access-control/acls\">ACLs</a> (sources and destinations)</li>\n<li><a href=\"https://tailscale.com/docs/features/access-control/grants\">Grants</a> (sources and destinations)</li>\n<li>IP sets</li>\n</ul>\n<h2><a href=\"https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#examples\">Examples</a></h2>\n<p>The following examples illustrate how to leverage IP sets.</p>\n<ul>\n<li><a href=\"https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#create-ip-sets-with-only-add-operations\">Create an IP set with only add operations</a>.</li>\n<li><a href=\"https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#create-an-ip-set-that-adds-several-subnets-and-excludes-a-single-ip-address\">Create an IP set that contains several subnets and excludes a single IP address</a>.</li>\n<li><a href=\"https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#create-an-ip-set-that-excludes-another-ip-set\">Create an IP set that excludes another IP set</a>.</li>\n<li><a href=\"https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#reference-ip-sets-in-grants\">Reference IP sets in grants</a>.</li>\n<li><a href=\"https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#reference-ip-sets-in-acls\">Reference IP sets in ACLs</a>.</li>\n<li><a href=\"https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#customize-autogroupinternet\">Customize <code>autogroup:internet</code></a>.</li>\n</ul>\n<h3><a href=\"https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#create-ip-sets-with-only-add-operations\">Create IP sets with only add operations</a></h3>\n<p>The following IP sets don't remove any <a href=\"https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#targets\">targets</a>. As a result, they can use a simplified syntax that omits the <a href=\"https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#operations\">operation type</a> (because <code>add</code> is assumed).</p>\n<pre><code class=\"language-json\">\"ipsets\": {\r\n  \"ipset:prod\": [\"192.0.2.0/24\"],\r\n  \"ipset:dev\": [\\\r\n    \"198.51.100.0/24\",\\\r\n    \"203.0.113.0/24\",\\\r\n    \"host:sql-server-1\",\\\r\n  ]\r\n}\n</code></pre>\n<p>You can use the <a href=\"https://tailscale.com/docs/features/visual-editor\">visual policy editor</a> to manage your tailnet policy file. Refer to the <a href=\"https://tailscale.com/docs/reference/visual-editor\">visual editor reference</a> for guidance on using the visual editor.</p>\n<h3><a href=\"https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#create-an-ip-set-that-adds-several-subnets-and-excludes-a-single-ip-address\">Create an IP set that adds several subnets and excludes a single IP address</a></h3>\n<p>The following example shows how to create an IP set that includes several subnets and excludes a single IP address.</p>\n<pre><code class=\"language-json\">\"ipsets\": {\r\n  \"ipset:prod\": [\\\r\n    \"add 192.0.2.0/24\",\\\r\n    \"add 2001:db8::/32\",\\\r\n    \"add 198.51.100.0/24\",\\\r\n    \"add 203.0.113.0/24\",\\\r\n    \"remove 192.0.2.33\",\\\r\n  ],\r\n}\n</code></pre>\n<p>You can use the <a href=\"https://tailscale.com/docs/features/visual-editor\">visual policy editor</a> to manage your tailnet policy file. Refer to the <a href=\"https://tailscale.com/docs/reference/visual-editor\">visual editor reference</a> for guidance on using the visual editor.</p>\n<h3><a href=\"https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#create-an-ip-set-that-excludes-another-ip-set\">Create an IP set that excludes another IP set</a></h3>\n<p>The following example creates a <code>dev</code> IP set and a <code>prod</code> IP set. The <code>prod</code> IP set excludes anything in the <code>dev</code> IP set.</p>\n<pre><code class=\"language-json\">\"ipsets\": {\r\n  \"ipset:dev\": [\"host:sql-server-1\"],\r\n  \"ipset:prod\": [\\\r\n    \"add 192.0.2.0/24\",\\\r\n    \"add 198.51.100.0/24\",\\\r\n    \"remove ipset:dev\",\\\r\n  ]\r\n}\n</code></pre>\n<p>You can use the <a href=\"https://tailscale.com/docs/features/visual-editor\">visual policy editor</a> to manage your tailnet policy file. Refer to the <a href=\"https://tailscale.com/docs/reference/visual-editor\">visual editor reference</a> for guidance on using the visual editor.</p>\n<h3><a href=\"https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#reference-ip-sets-in-grants\">Reference IP sets in grants</a></h3>\n<p>The following example shows how to create <a href=\"https://tailscale.com/docs/features/access-control/grants\">grants</a> that <a href=\"https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#references\">reference</a> the <code>dev</code> IP set.</p>\n<pre><code class=\"language-json\">\"grants\": [\\\r\n  {\\\r\n    \"src\": [\"group:devops\"],\\\r\n    \"dst\": [\"ipset:dev\"],\\\r\n    \"ip\": [\"80\",\"443\",\"22\"]\\\r\n  },\\\r\n  {\\\r\n    \"src\": [\"group:dev\"],\\\r\n    \"dst\": [\"ipset:dev\"],\\\r\n    \"ip\": [\"80\",\"443\"],\\\r\n    \"via\": [\"tag:office-routers\"],\\\r\n  },\\\r\n]\n</code></pre>\n<p>You can use the <a href=\"https://tailscale.com/docs/features/visual-editor\">visual policy editor</a> to manage your tailnet policy file. Refer to the <a href=\"https://tailscale.com/docs/reference/visual-editor\">visual editor reference</a> for guidance on using the visual editor.</p>\n<h3><a href=\"https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#reference-ip-sets-in-acls\">Reference IP sets in ACLs</a></h3>\n<p>The following example shows how to create <a href=\"https://tailscale.com/docs/features/access-control/acls\">ACLs</a> that <a href=\"https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#references\">reference</a> the <code>prod</code> IP set.</p>\n<pre><code class=\"language-json\">\"acls\": [\\\r\n  {\\\r\n    \"src\":    [\"group:devops\"],\\\r\n    \"dst\":    [\"ipset:prod:*\"],\\\r\n    \"action\": \"accept\",\\\r\n  },\\\r\n],\n</code></pre>\n<p>You can use the <a href=\"https://tailscale.com/docs/features/visual-editor\">visual policy editor</a> to manage your tailnet policy file. Refer to the <a href=\"https://tailscale.com/docs/reference/visual-editor\">visual editor reference</a> for guidance on using the visual editor.</p>\n<h3><a href=\"https://tailscale.com/docs/features/tailnet-policy-file/ip-sets#customize-autogroupinternet\">Customize <code>autogroup:internet</code></a></h3>\n<p>You can use IP sets to customize the traffic that flows through an exit node (when enabled) in the tailnet using <a href=\"https://tailscale.com/docs/reference/syntax/policy-file#autogroups\"><code>autogroup:internet</code></a>.</p>\n<p>The following example creates an IP set named <code>internet</code> that customizes <code>autogroup:internet</code> by doing the following:</p>\n<ul>\n<li>Adds <code>autogroup:internet</code>.</li>\n<li>Removes the production application gateways (<code>ipset:cdn-edge</code>).</li>\n<li>Removes the publicly accessible partner network (<code>ipset:partner-net</code>).</li>\n<li><a href=\"https://tailscale.com/docs/features/access-control/grants\">Grants</a> the <code>internet</code> IP set (a subset of internet-bound traffic) access to the Seattle and London office <a href=\"https://tailscale.com/docs/features/exit-nodes\">exit nodes</a>.</li>\n</ul>\n<pre><code class=\"language-json\">\"ipsets\": {\r\n  \"ipset:internet\": [\\\r\n    \"add autogroup:internet\",\\\r\n    \"remove ipset:cdn-edge\",\\\r\n    \"remove ipset:partner-net\"\\\r\n  ],\r\n  \"ipset:cdn-edge\": [\"8.21.9.6\", \"8.21.9.7\", \"8.21.9.13\", \"8.21.9.14\"],\r\n  \"ipset:partner-net\": [\"52.23.40.0/24\"]\r\n},\r\n\"grants\": [\\\r\n  {\\\r\n    \"src\": [\"group:sea\"],\\\r\n    \"dst\": [\"ipset:internet\"],\\\r\n    \"ip\":  [\"*\"],\\\r\n    \"via\": [\"tag:officerouter-sea\"],\\\r\n  },\\\r\n  {\\\r\n    \"src\": [\"group:lhr\"],\\\r\n    \"dst\": [\"ipset:internet\"],\\\r\n    \"ip\":  [\"*\"],\\\r\n    \"via\": [\"tag:officerouter-lhr\"],\\\r\n  }\\\r\n]\n</code></pre>\n<p>You can use the <a href=\"https://tailscale.com/docs/features/visual-editor\">visual policy editor</a> to manage your tailnet policy file. Refer to the <a href=\"https://tailscale.com/docs/reference/visual-editor\">visual editor reference</a> for guidance on using the visual editor.</p>\n<p><img src=\"https://cdn.brandfetch.io/tailscale.com/fallback/lettermark/theme/dark/h/256/w/256/icon?c=1bfwsmEH20zzEfSNTed\" alt=\"Project Logo\"></p>\n<p>Ask AI</p>\n<p>reCAPTCHA</p>\n<p>Recaptcha requires verification.</p>\n<p>protected by <strong>reCAPTCHA</strong></p>\n"}