From 46b826a909a73b262863a50c8ead3d2dd0a8c74c Mon Sep 17 00:00:00 2001 From: tomsweeneyredhat Date: Sat, 18 Mar 2023 20:17:45 -0400 Subject: [PATCH 1/2] [CI:DOCS] Add network subnets info to network man page Adds information to the network command to explain how to change the default options for the bridge or IP. This steals very liberally from @Luap99 's blog post: https://blog.podman.io/2023/02/default-podman-network-subnets/ This addresses: https://issues.redhat.com/browse/OCPBUGS-9296 [NO NEW TESTS NEEDED] Signed-off-by: tomsweeneyredhat --- docs/source/markdown/podman-network.1.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/source/markdown/podman-network.1.md b/docs/source/markdown/podman-network.1.md index 7dada81a5b..53ab756b01 100644 --- a/docs/source/markdown/podman-network.1.md +++ b/docs/source/markdown/podman-network.1.md @@ -35,5 +35,19 @@ so networks have to be created again after a backend change. | rm | [podman-network-rm(1)](podman-network-rm.1.md) | Remove one or more networks | | update | [podman-network-update(1)](podman-network-update.1.md) | Update an existing Podman network | +## SUBNET NOTES +Podman requires specific default IPs and, thus, network subnets. The default values used by Podman can be modified in the **[containers.conf(5)](https://github.com/containers/common/blob/main/docs/containers.conf.5.md)** file. + +### Podman network +The default bridge network (called `podman`) uses 10.88.0.0/16 as a subnet. When Podman runs as root, the `podman` network is used as default. It is the same as adding the option `--network bridge` or `--network podman`. This subnet can be changed in **[containers.conf(5)](https://github.com/containers/common/blob/main/docs/containers.conf.5.md)** under the [network] section. Set the `default subnet` to any subnet that is free in the environment. The name of the default network can also be changed from `podman` to another name using the default network key. Note that this should only be done when no containers are running. + +### Slirp4netns +When Podman is run as rootless, the internet connectivity is provided with slirp4netns by default. Slirp4nents uses 10.0.2.0/24 for its default network. This can also be changed in **[containers.conf(5)](https://github.com/containers/common/blob/main/docs/containers.conf.5.md)** but under the `[engine]` section. Use the `network_cmd_options` key and add `["cidr=X.X.X.X/24"]` as a value. Note that slirp4netns needs a network prefix size between 1 and 25. This option accepts an array, so more options can be added in a comma-separated string as described on the **[podman-network-create(1)](podman-network-create.1.md)** man page. To change the CIDR for just one container, specify it on the cli using the `--network` opiton like this: `--network slirp4netns:cidr=192.168.1.0/24`. + +When using the default network as rootless, i.e. --network podman/bridge, then it also uses the same subnet as described above in addition to the slirp4netns subnet. + +### Podman network create +When a new network is created with a `podman network create` command, and no subnet is given with the --subnet option, Podman will start picking a free subnet from 10.89.0.0/24 to 10.255.255.0/24. Use the `default_subnet_pools` option under the `[network]` section in **[containers.conf(5)](https://github.com/containers/common/blob/main/docs/containers.conf.5.md)** to change the range and/or size that is assigned by default. + ## SEE ALSO -**[podman(1)](podman.1.md)**, **[containers.conf(5)](https://github.com/containers/common/blob/main/docs/containers.conf.5.md)** +**[podman(1)](podman.1.md)**, **[podman-network-create(1)](podman-network-create.1.md)**, **[containers.conf(5)](https://github.com/containers/common/blob/main/docs/containers.conf.5.md)** From be7827c7e62e494bf5d1ea81f3c86284ea06d322 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Tue, 28 Mar 2023 17:47:30 -0400 Subject: [PATCH 2/2] Update docs/source/markdown/podman-network.1.md Co-authored-by: Paul Holzinger <45212748+Luap99@users.noreply.github.com> Signed-off-by: Daniel J Walsh --- docs/source/markdown/podman-network.1.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/markdown/podman-network.1.md b/docs/source/markdown/podman-network.1.md index 53ab756b01..7027e421f0 100644 --- a/docs/source/markdown/podman-network.1.md +++ b/docs/source/markdown/podman-network.1.md @@ -39,7 +39,7 @@ so networks have to be created again after a backend change. Podman requires specific default IPs and, thus, network subnets. The default values used by Podman can be modified in the **[containers.conf(5)](https://github.com/containers/common/blob/main/docs/containers.conf.5.md)** file. ### Podman network -The default bridge network (called `podman`) uses 10.88.0.0/16 as a subnet. When Podman runs as root, the `podman` network is used as default. It is the same as adding the option `--network bridge` or `--network podman`. This subnet can be changed in **[containers.conf(5)](https://github.com/containers/common/blob/main/docs/containers.conf.5.md)** under the [network] section. Set the `default subnet` to any subnet that is free in the environment. The name of the default network can also be changed from `podman` to another name using the default network key. Note that this should only be done when no containers are running. +The default bridge network (called `podman`) uses 10.88.0.0/16 as a subnet. When Podman runs as root, the `podman` network is used as default. It is the same as adding the option `--network bridge` or `--network podman`. This subnet can be changed in **[containers.conf(5)](https://github.com/containers/common/blob/main/docs/containers.conf.5.md)** under the [network] section. Set the `default_subnet` to any subnet that is free in the environment. The name of the default network can also be changed from `podman` to another name using the default network key. Note that this should only be done when no containers are running. ### Slirp4netns When Podman is run as rootless, the internet connectivity is provided with slirp4netns by default. Slirp4nents uses 10.0.2.0/24 for its default network. This can also be changed in **[containers.conf(5)](https://github.com/containers/common/blob/main/docs/containers.conf.5.md)** but under the `[engine]` section. Use the `network_cmd_options` key and add `["cidr=X.X.X.X/24"]` as a value. Note that slirp4netns needs a network prefix size between 1 and 25. This option accepts an array, so more options can be added in a comma-separated string as described on the **[podman-network-create(1)](podman-network-create.1.md)** man page. To change the CIDR for just one container, specify it on the cli using the `--network` opiton like this: `--network slirp4netns:cidr=192.168.1.0/24`.