Skip to content

Commit

Permalink
man page and bump libslirp veresion: rootless-containers#259
Browse files Browse the repository at this point in the history
  • Loading branch information
pfandl committed Sep 11, 2021
1 parent fee7992 commit eb18134
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 16 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# slirp4netns: User-mode networking for unprivileged network namespaces
# slirp4netns: User-mode networking for unprivileged network namespaces

slirp4netns provides user-mode networking ("slirp") for unprivileged network namespaces.

Expand Down Expand Up @@ -73,7 +73,7 @@ Also available as a package on almost all Linux distributions:
* [Arch Linux](https://www.archlinux.org/packages/community/x86_64/slirp4netns/)
* [openSUSE (since Leap 15.0)](https://build.opensuse.org/package/show/openSUSE%3AFactory/slirp4netns)
* [SUSE Linux Enterprise (since 15)](https://build.opensuse.org/package/show/devel%3Akubic/slirp4netns)
* [Debian GNU/Linux (since 10.0)](https://packages.debian.org/buster/slirp4netns)
* [Debian GNU/Linux (since 10.0)](https://packages.debian.org/buster/slirp4netns)
* [Ubuntu (since 19.04)](https://packages.ubuntu.com/search?keywords=slirp4netns)
* [NixOS](https://github.com/NixOS/nixpkgs/tree/master/pkgs/tools/networking/slirp4netns)
* [Gentoo Linux](https://packages.gentoo.org/packages/app-emulation/slirp4netns)
Expand Down Expand Up @@ -126,7 +126,7 @@ starting slirp, MTU=65520
link/ether c2:28:0c:0e:29:06 brd ff:ff:ff:ff:ff:ff
inet 10.0.2.100/24 brd 10.0.2.255 scope global tap0
valid_lft forever preferred_lft forever
inet6 fe80::c028:cff:fe0e:2906/64 scope link
inet6 fe80::c028:cff:fe0e:2906/64 scope link
valid_lft forever preferred_lft forever
(namespace)$ echo "nameserver 10.0.2.3" > /tmp/resolv.conf
(namespace)$ mount --bind /tmp/resolv.conf /etc/resolv.conf
Expand Down Expand Up @@ -187,7 +187,7 @@ $ make
$ sudo make install
```

* [libslirp](https://gitlab.freedesktop.org/slirp/libslirp) needs to be v4.1.0 or later.
* [libslirp](https://gitlab.freedesktop.org/slirp/libslirp) needs to be v4.4.0.57 or later.
* To build `slirp4netns` as a static binary, run `./configure` with `LDFLAGS=-static`.
* If you set `--prefix` to `$HOME`, you don't need to run `make install` with `sudo`.

Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AC_PREREQ([2.69])
AC_INIT([slirp4netns], [1.1.12+dev], [https://github.com/rootless-containers/slirp4netns/issues])
AC_INIT([slirp4netns], [1.1.13+dev], [https://github.com/rootless-containers/slirp4netns/issues])
AC_CONFIG_SRCDIR([main.c])
AC_CONFIG_HEADERS([config.h])

Expand Down
27 changes: 23 additions & 4 deletions slirp4netns.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.nh
.TH SLIRP4NETNS 1 "June 2021" "Rootless Containers" "User Commands"

.SH NAME
Expand Down Expand Up @@ -78,6 +77,14 @@ API socket path
\fB\fC\-\-cidr\fR (since v0.3.0)
specify CIDR, e.g. 10.0.2.0/24

.PP
\fB\fC\-\-cidr6\fR (since v1.1.13, EXPERIMENTAL)
specify IPv6 CIDR, e.g. fd00::/64

.PP
\fB\fC\-\-ipv6\-random\fR (since v1.1.13, EXPERIMENTAL)
generate a random local IPv6 range

.PP
\fB\fC\-\-disable\-host\-loopback\fR (since v0.3.0)
prohibit connecting to 127.0.0.1:* on the host namespace
Expand Down Expand Up @@ -199,7 +206,7 @@ starting slirp, MTU=65520
link/ether c2:28:0c:0e:29:06 brd ff:ff:ff:ff:ff:ff
inet 10.0.2.100/24 brd 10.0.2.255 scope global tap0
valid\_lft forever preferred\_lft forever
inet6 fe80::c028:cff:fe0e:2906/64 scope link
inet6 fe80::c028:cff:fe0e:2906/64 scope link
valid\_lft forever preferred\_lft forever
(namespace)$ echo "nameserver 10.0.2.3" > /tmp/resolv.conf
(namespace)$ mount \-\-bind /tmp/resolv.conf /etc/resolv.conf
Expand Down Expand Up @@ -305,7 +312,7 @@ slirp4netns can provide QMP\-like API server over an UNIX socket file:
.RE

.PP
\fB\fCadd\_hostfwd\fR: Expose a port (IPv4 only)
\fB\fCadd\_hostfwd\fR: Expose a port (IPv4 and IPv6 if enabled and host\_addr is "0.0.0.0" or "::")

.PP
.RS
Expand All @@ -318,6 +325,18 @@ slirp4netns can provide QMP\-like API server over an UNIX socket file:
.fi
.RE

.PP
\fB\fCadd\_hostfwd\fR: Expose a port (IPv4 only)

.PP
specify \fB\fCtcp4\fR as \fB\fCproto\fR

.PP
\fB\fCadd\_hostfwd\fR: Expose a port (IPv6 only)

.PP
specify \fB\fCtcp6\fR as \fB\fCproto\fR

.PP
If \fB\fChost\_addr\fR is not specified, then it defaults to "0.0.0.0".

Expand All @@ -333,7 +352,7 @@ If \fB\fCguest\_addr\fR is not specified, then it will be set to the default add
.nf
(namespace)$ json='{"execute": "list\_hostfwd"}'
(namespace)$ echo \-n $json | nc \-U /tmp/slirp4netns.sock
{"return": {"entries": [{"id": 42, "proto": "tcp", "host\_addr": "0.0.0.0", "host\_port": 8080, "guest\_addr": "10.0.2.100", "guest\_port": 80}]}}
{"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}]}}

.fi
.RE
Expand Down
28 changes: 21 additions & 7 deletions slirp4netns.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ API socket path
`--cidr` (since v0.3.0)
specify CIDR, e.g. 10.0.2.0/24

`--cidr6` (since v1.1.13, EXPERIMENTAL)
specify IPv6 CIDR, e.g. fd00::/64

`--ipv6-random` (since v1.1.13, EXPERIMENTAL)
generate a random local IPv6 range

`--disable-host-loopback` (since v0.3.0)
prohibit connecting to 127.0.0.1:\* on the host namespace

Expand Down Expand Up @@ -139,7 +145,7 @@ starting slirp, MTU=65520
link/ether c2:28:0c:0e:29:06 brd ff:ff:ff:ff:ff:ff
inet 10.0.2.100/24 brd 10.0.2.255 scope global tap0
valid_lft forever preferred_lft forever
inet6 fe80::c028:cff:fe0e:2906/64 scope link
inet6 fe80::c028:cff:fe0e:2906/64 scope link
valid_lft forever preferred_lft forever
(namespace)$ echo "nameserver 10.0.2.3" > /tmp/resolv.conf
(namespace)$ mount --bind /tmp/resolv.conf /etc/resolv.conf
Expand Down Expand Up @@ -207,14 +213,22 @@ slirp4netns can provide QMP-like API server over an UNIX socket file:
(host)$ slirp4netns --api-socket /tmp/slirp4netns.sock ...
```

`add_hostfwd`: Expose a port (IPv4 only)
`add_hostfwd`: Expose a port (IPv4 and IPv6 if enabled and host_addr is "0.0.0.0" or "::")

```console
(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}}'
(namespace)$ echo -n $json | nc -U /tmp/slirp4netns.sock
{"return": {"id": 42}}
```

`add_hostfwd`: Expose a port (IPv4 only)

specify `tcp4` as `proto`

`add_hostfwd`: Expose a port (IPv6 only)

specify `tcp6` as `proto`

If `host_addr` is not specified, then it defaults to "0.0.0.0".

If `guest_addr` is not specified, then it will be set to the default address that corresponds to `--configure`.
Expand All @@ -224,7 +238,7 @@ If `guest_addr` is not specified, then it will be set to the default address tha
```console
(namespace)$ json='{"execute": "list_hostfwd"}'
(namespace)$ echo -n $json | nc -U /tmp/slirp4netns.sock
{"return": {"entries": [{"id": 42, "proto": "tcp", "host_addr": "0.0.0.0", "host_port": 8080, "guest_addr": "10.0.2.100", "guest_port": 80}]}}
{"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}]}}
```

`remove_hostfwd`: Remove an exposed port
Expand All @@ -243,7 +257,7 @@ Remarks:
* A request must be less than 4096 bytes.
* JSON responses may contain `error` instead of `return`.

# DEFINED NAMESPACE PATHS
# DEFINED NAMESPACE PATHS
A user can define a network namespace path as opposed to the default process ID:

```console
Expand All @@ -256,14 +270,14 @@ Additionally, a `--userns-path=PATH` argument can be included to override any us
(host)$ slirp4netns --netns-type=path --userns-path=/path/to/userns /path/to/netns tap0
```

# OUTBOUND ADDRESSES
A user can defined preferred outbound ipv4 and ipv6 address in multi IP scenarios.
# OUTBOUND ADDRESSES
A user can defined preferred outbound ipv4 and ipv6 address in multi IP scenarios.

```console
(host)$ slirp4netns --outbound-addr=10.2.2.10 --outbound-addr6=fe80::10 ...
```

Optionally you can use interface names instead of ip addresses.
Optionally you can use interface names instead of ip addresses.

```console
(host)$ slirp4netns --outbound-addr=eth0 --outbound-addr6=eth0 ...
Expand Down

0 comments on commit eb18134

Please sign in to comment.