Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI:DOCS] Add network subnets info to network man page #17847

Merged

Conversation

TomSweeneyRedHat
Copy link
Member

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]

Does this PR introduce a user-facing change?

None

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 19, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: TomSweeneyRedHat

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 19, 2023
Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just some small nits

## 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
###Podman network
### Podman network

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

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 default `podman` name can also change to something else with the default network key. Note that this should only be done when no containers are running.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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 default `podman` name can also change to something else with 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 default `podman` name can also change to something else with the default network key. Note that this should only be done when no containers are running.

This is an actual key in the config. Otherwise it may not clear which key to use.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch, ty and done

###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 default `podman` name can also change to something else with the default network key. Note that this should only be done when no containers are running.

###Slirp4netns
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
###Slirp4netns
### Slirp4netns

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

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 default `podman` name can also change to something else with 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`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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 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`.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
###Podman network create
### Podman network create

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done and thx!

@TomSweeneyRedHat
Copy link
Member Author

Thx for the review @Luap99 . Updated and repushed.

Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@TomSweeneyRedHat
Copy link
Member Author

Green buttons and ready to go, just needs a final push.

@TomSweeneyRedHat
Copy link
Member Author

@baude @mheon @vrothberg @rhatdan mergme plz!

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 default `podman` name can also change to something else with the default network key. Note that this should only be done when no containers are running.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second to last sentence is a little wierd. "The name of the default network can also be changed from podman to another name using the default network key" maybe?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed, with just a slight tweak to backtick the word podman. That does flow better, thanks!

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 <[email protected]>
@TomSweeneyRedHat
Copy link
Member Author

Repushed with requested changed.

@rhatdan
Copy link
Member

rhatdan commented Mar 27, 2023

/lgtm
/hold

@openshift-ci openshift-ci bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm Indicates that a PR is ready to be merged. labels Mar 27, 2023
Co-authored-by: Paul Holzinger <[email protected]>
Signed-off-by: Daniel J Walsh <[email protected]>
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Mar 28, 2023
@rhatdan
Copy link
Member

rhatdan commented Mar 29, 2023

/lgtm
/hold cancel

@openshift-ci openshift-ci bot added lgtm Indicates that a PR is ready to be merged. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Mar 29, 2023
@openshift-merge-robot openshift-merge-robot merged commit 395d852 into containers:main Mar 29, 2023
@TomSweeneyRedHat TomSweeneyRedHat deleted the dev/tsweeney/networkup branch June 30, 2023 21:43
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 28, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. release-note-none
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants