Skip to content

Commit d664416

Browse files
docs: cni: add ipv6 bridge example (#26456) (#26470)
Co-authored-by: Daniel Bennett <[email protected]>
1 parent 1460b54 commit d664416

File tree

1 file changed

+67
-11
lines changed
  • website/content/docs/networking

1 file changed

+67
-11
lines changed

website/content/docs/networking/cni.mdx

Lines changed: 67 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,12 @@ the external [configuration
7070
format](https://www.cni.dev/docs/spec/#example-configuration) for a complete
7171
explanation of the fields.
7272

73-
You can use this template as a basis for your own CNI-based bridge network
74-
configuration in cases where you need access to an unsupported option in the
75-
default configuration, like hairpin mode.
73+
You can use the following template as a basis for your own CNI-based bridge
74+
network configuration in cases where you need access to an unsupported option
75+
in the default configuration.
76+
77+
<Tabs>
78+
<Tab heading="Default">
7679

7780
This example uses two default values from Nomad client configuration.
7881

@@ -87,7 +90,7 @@ The `NOMAD-ADMIN` internal constant provides the value for
8790
`iptablesAdminChainName`. In your own configuration, ensure that you change the
8891
`iptablesAdminChainName` to a unique value.
8992

90-
<CodeBlockConfig highlight="10,20,32">
93+
<CodeBlockConfig highlight="10,18,29">
9194

9295
```json
9396
{
@@ -107,15 +110,12 @@ The `NOMAD-ADMIN` internal constant provides the value for
107110
"ipam": {
108111
"type": "host-local",
109112
"ranges": [
110-
[
111-
{
112-
"subnet": "172.26.64.0/20"
113-
}
114-
]
113+
[{"subnet": "172.26.64.0/20"}]
115114
],
116115
"routes": [
117-
{ "dst": "0.0.0.0/0" }
118-
]
116+
{"dst": "0.0.0.0/0"}
117+
],
118+
"dataDir": "/var/run/cni"
119119
}
120120
},
121121
{
@@ -134,6 +134,61 @@ The `NOMAD-ADMIN` internal constant provides the value for
134134

135135
</CodeBlockConfig>
136136

137+
</Tab>
138+
<Tab heading="IPv6">
139+
140+
If you [configure IPv6][] to use the example range of `2001:db8::/112`,
141+
Nomad adds two more lines to the configuration.
142+
143+
<CodeBlockConfig highlight="19,23">
144+
145+
```json
146+
{
147+
"cniVersion": "1.0.0",
148+
"name": "nomad",
149+
"plugins": [
150+
{
151+
"type": "loopback"
152+
},
153+
{
154+
"type": "bridge",
155+
"bridge": "nomad",
156+
"ipMasq": true,
157+
"isGateway": true,
158+
"forceAddress": true,
159+
"hairpinMode": false,
160+
"ipam": {
161+
"type": "host-local",
162+
"ranges": [
163+
[{"subnet": "172.26.64.0/20"}],
164+
[{"subnet": "2001:db8::/112"}]
165+
],
166+
"routes": [
167+
{"dst": "0.0.0.0/0"},
168+
{"dst": "::/0"}
169+
],
170+
"dataDir": "/var/run/cni"
171+
}
172+
},
173+
{
174+
"type": "firewall",
175+
"backend": "iptables",
176+
"iptablesAdminChainName": "NOMAD-ADMIN"
177+
},
178+
{
179+
"type": "portmap",
180+
"capabilities": {"portMappings": true},
181+
"snat": true
182+
}
183+
]
184+
}
185+
```
186+
187+
</CodeBlockConfig>
188+
189+
</Tab>
190+
</Tabs>
191+
137192
This configuration uses the following CNI reference plugins:
138193

139194
- loopback: The loopback plugin sets the default local interface, lo0, created
@@ -263,3 +318,4 @@ apply a defensive policy or simply error out.
263318
[bridge]: https://www.cni.dev/plugins/current/main/bridge/
264319
[firewall]: https://www.cni.dev/plugins/current/meta/firewall/
265320
[portmap]: https://www.cni.dev/plugins/current/meta/portmap/
321+
[configure IPv6]: /nomad/docs/configuration/client#bridge_network_subnet_ipv6

0 commit comments

Comments
 (0)