@@ -55,6 +55,12 @@ API socket path
55
55
` --cidr ` (since v0.3.0)
56
56
specify CIDR, e.g. 10.0.2.0/24
57
57
58
+ ` --cidr6 ` (since v1.1.13, EXPERIMENTAL)
59
+ specify IPv6 CIDR, e.g. fd00::/64
60
+
61
+ ` --ipv6-random ` (since v1.1.13, EXPERIMENTAL)
62
+ generate a random local IPv6 range
63
+
58
64
` --disable-host-loopback ` (since v0.3.0)
59
65
prohibit connecting to 127.0.0.1:\* on the host namespace
60
66
@@ -139,7 +145,7 @@ starting slirp, MTU=65520
139
145
link/ether c2:28:0c:0e:29:06 brd ff:ff:ff:ff:ff:ff
140
146
inet 10.0.2.100/24 brd 10.0.2.255 scope global tap0
141
147
valid_lft forever preferred_lft forever
142
- inet6 fe80::c028:cff:fe0e:2906/64 scope link
148
+ inet6 fe80::c028:cff:fe0e:2906/64 scope link
143
149
valid_lft forever preferred_lft forever
144
150
(namespace)$ echo "nameserver 10.0.2.3" > /tmp/resolv.conf
145
151
(namespace)$ mount --bind /tmp/resolv.conf /etc/resolv.conf
@@ -207,14 +213,22 @@ slirp4netns can provide QMP-like API server over an UNIX socket file:
207
213
(host)$ slirp4netns --api-socket /tmp/slirp4netns.sock ...
208
214
```
209
215
210
- ` add_hostfwd ` : Expose a port (IPv4 only )
216
+ ` add_hostfwd ` : Expose a port (IPv4 and IPv6 if enabled and host_addr is "0.0.0.0" or "::" )
211
217
212
218
``` console
213
219
(namespace)$ json='{"execute": "add_hostfwd", "arguments": {"proto": "tcp", "host_addr": "0.0.0.0", "host_port": 8080, "guest_addr": "10.0.2.100", "guest_port": 80}}'
214
220
(namespace)$ echo -n $json | nc -U /tmp/slirp4netns.sock
215
221
{"return": {"id": 42}}
216
222
```
217
223
224
+ ` add_hostfwd ` : Expose a port (IPv4 only)
225
+
226
+ specify ` tcp4 ` as ` proto `
227
+
228
+ ` add_hostfwd ` : Expose a port (IPv6 only)
229
+
230
+ specify ` tcp6 ` as ` proto `
231
+
218
232
If ` host_addr ` is not specified, then it defaults to "0.0.0.0".
219
233
220
234
If ` guest_addr ` is not specified, then it will be set to the default address that corresponds to ` --configure ` .
@@ -224,7 +238,7 @@ If `guest_addr` is not specified, then it will be set to the default address tha
224
238
``` console
225
239
(namespace)$ json='{"execute": "list_hostfwd"}'
226
240
(namespace)$ echo -n $json | nc -U /tmp/slirp4netns.sock
227
- {"return": {"entries": [{"id": 42, "proto": "tcp", "host_addr": "0.0.0.0", "host_port": 8080, "guest_addr": "10.0.2.100", "guest_port": 80}]}}
241
+ {"return": {"entries": [{"id": 42, "proto": "tcp", "host_addr": "0.0.0.0", "host_addr6": "::", " host_port": 8080, "guest_addr": "10.0.2.100", "guest_addr6": "fd00:: 100", "guest_port": 80}]}}
228
242
```
229
243
230
244
` remove_hostfwd ` : Remove an exposed port
@@ -243,7 +257,7 @@ Remarks:
243
257
* A request must be less than 4096 bytes.
244
258
* JSON responses may contain ` error ` instead of ` return ` .
245
259
246
- # DEFINED NAMESPACE PATHS
260
+ # DEFINED NAMESPACE PATHS
247
261
A user can define a network namespace path as opposed to the default process ID:
248
262
249
263
``` console
@@ -256,14 +270,14 @@ Additionally, a `--userns-path=PATH` argument can be included to override any us
256
270
(host)$ slirp4netns --netns-type=path --userns-path=/path/to/userns /path/to/netns tap0
257
271
```
258
272
259
- # OUTBOUND ADDRESSES
260
- A user can defined preferred outbound ipv4 and ipv6 address in multi IP scenarios.
273
+ # OUTBOUND ADDRESSES
274
+ A user can defined preferred outbound ipv4 and ipv6 address in multi IP scenarios.
261
275
262
276
``` console
263
277
(host)$ slirp4netns --outbound-addr=10.2.2.10 --outbound-addr6=fe80::10 ...
264
278
```
265
279
266
- Optionally you can use interface names instead of ip addresses.
280
+ Optionally you can use interface names instead of ip addresses.
267
281
268
282
``` console
269
283
(host)$ slirp4netns --outbound-addr=eth0 --outbound-addr6=eth0 ...
0 commit comments