Add tests for multiple static IPs per container across single and multi-subnet networks. Document --network option for comma-separated IPs and subnet-based IP ordering. Fixes: https://issues.redhat.com/browse/RHEL-98277 Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2.2 KiB
####> This option file is used in: ####> podman create, pod create, run ####> If file is edited, make sure the changes ####> are applicable to all of those.
--ip=ipv4
Specify a static IPv4 address for the <<container|pod>>, for example 10.88.64.128. This option can only be used if the <<container|pod>> is joined to only a single network - i.e., --network=network-name is used at most once - and if the <<container|pod>> is not joining another container's network namespace via --network=container:id. The address must be within the network's IP address pool (default 10.88.0.0/16).
To specify multiple static IP addresses per <<container|pod>>, use the --network option with multiple comma-separated ip values:
--network mynet:ip=10.88.0.10,ip=10.88.0.11,ip=10.88.0.12
This assigns multiple static IPv4 addresses (10.88.0.10, 10.88.0.11, 10.88.0.12) to the same network interface.
Multi-Subnet Networks: When a network has multiple subnets, you can assign IPs from different subnets to the same <<container|pod>>. The IPs will be applied to a single network interface, with the first IP as primary and additional IPs as secondary addresses.
IP Assignment Order: For multi-subnet networks, IPs are grouped and ordered by their corresponding subnet, following the order in which subnets were defined during network creation (via --subnet flags). The order you specify IPs in the command does not affect the final assignment order. For example:
podman network create --subnet 10.89.0.0/24 --subnet 10.90.0.0/24 mynet
podman run --network mynet:ip=10.90.0.20,ip=10.89.0.10,ip=10.89.0.11 alpine
Results in IPs ordered by subnet: 10.89.0.10 (primary), 10.89.0.11 (secondary), 10.90.0.20 (secondary), since 10.89.0.0/24 was defined first.
Dynamic Allocation: If fewer IPs are specified than available subnets, the remaining subnets will receive dynamically allocated IPs. Dynamic IPs are assigned in subnet order after all static IPs are applied.
Example with multi-subnet network:
podman network create --subnet 10.89.0.0/24 --subnet 10.90.0.0/24 mynet
podman run --network mynet:ip=10.89.0.10,ip=10.90.0.20 alpine
This configures eth0 with 10.89.0.10 (primary) and 10.90.0.20 (secondary).