github.com/containers/podman/v5@v5.1.0-rc1/docs/source/markdown/options/network.md (about) 1 ####> This option file is used in: 2 ####> podman create, kube play, pod create, run 3 ####> If file is edited, make sure the changes 4 ####> are applicable to all of those. 5 #### **--network**=*mode*, **--net** 6 7 Set the network mode for the <<container|pod>>. 8 9 Valid _mode_ values are: 10 11 - **bridge[:OPTIONS,...]**: Create a network stack on the default bridge. This is the default for rootful containers. It is possible to specify these additional options: 12 - **alias=**_name_: Add network-scoped alias for the container. 13 - **ip=**_IPv4_: Specify a static IPv4 address for this container. 14 - **ip6=**_IPv6_: Specify a static IPv6 address for this container. 15 - **mac=**_MAC_: Specify a static MAC address for this container. 16 - **interface_name=**_name_: Specify a name for the created network interface inside the container. 17 18 For example, to set a static ipv4 address and a static mac address, use `--network bridge:ip=10.88.0.10,mac=44:33:22:11:00:99`. 19 20 - _\<network name or ID\>_**[:OPTIONS,...]**: Connect to a user-defined network; this is the network name or ID from a network created by **[podman network create](podman-network-create.1.md)**. Using the network name implies the bridge network mode. It is possible to specify the same options described under the bridge mode above. Use the **--network** option multiple times to specify additional networks. \ 21 For backwards compatibility it is also possible to specify comma-separated networks on the first **--network** argument, however this prevents you from using the options described under the bridge section above. 22 23 - **none**: Create a network namespace for the container but do not configure network interfaces for it, thus the container has no network connectivity. 24 25 - **container:**_id_: Reuse another container's network stack. 26 27 - **host**: Do not create a network namespace, the container uses the host's network. Note: The host mode gives the container full access to local system services such as D-bus and is therefore considered insecure. 28 29 - **ns:**_path_: Path to a network namespace to join. 30 31 - **private**: Create a new namespace for the container. This uses the **bridge** mode for rootful containers and **slirp4netns** for rootless ones. 32 33 - **slirp4netns[:OPTIONS,...]**: use **slirp4netns**(1) to create a user network stack. This is the default for rootless containers. It is possible to specify these additional options, they can also be set with `network_cmd_options` in containers.conf: 34 35 - **allow_host_loopback=true|false**: Allow slirp4netns to reach the host loopback IP (default is 10.0.2.2 or the second IP from slirp4netns cidr subnet when changed, see the cidr option below). The default is false. 36 - **mtu=**_MTU_: Specify the MTU to use for this network. (Default is `65520`). 37 - **cidr=**_CIDR_: Specify ip range to use for this network. (Default is `10.0.2.0/24`). 38 - **enable_ipv6=true|false**: Enable IPv6. Default is true. (Required for `outbound_addr6`). 39 - **outbound_addr=**_INTERFACE_: Specify the outbound interface slirp binds to (ipv4 traffic only). 40 - **outbound_addr=**_IPv4_: Specify the outbound ipv4 address slirp binds to. 41 - **outbound_addr6=**_INTERFACE_: Specify the outbound interface slirp binds to (ipv6 traffic only). 42 - **outbound_addr6=**_IPv6_: Specify the outbound ipv6 address slirp binds to. 43 - **port_handler=rootlesskit**: Use rootlesskit for port forwarding. Default. \ 44 Note: Rootlesskit changes the source IP address of incoming packets to an IP address in the container network namespace, usually `10.0.2.100`. If the application requires the real source IP address, e.g. web server logs, use the slirp4netns port handler. The rootlesskit port handler is also used for rootless containers when connected to user-defined networks. 45 - **port_handler=slirp4netns**: Use the slirp4netns port forwarding, it is slower than rootlesskit but preserves the correct source IP address. This port handler cannot be used for user-defined networks. 46 47 - **pasta[:OPTIONS,...]**: use **pasta**(1) to create a user-mode networking 48 stack. \ 49 This is only supported in rootless mode. \ 50 By default, IPv4 and IPv6 addresses and routes, as well as the pod interface 51 name, are copied from the host. If port forwarding isn't configured, ports 52 are forwarded dynamically as services are bound on either side (init 53 namespace or container namespace). Port forwarding preserves the original 54 source IP address. Options described in pasta(1) can be specified as 55 comma-separated arguments. \ 56 In terms of pasta(1) options, **--config-net** is given by default, in 57 order to configure networking when the container is started, and 58 **--no-map-gw** is also assumed by default, to avoid direct access from 59 container to host using the gateway address. The latter can be overridden 60 by passing **--map-gw** in the pasta-specific options (despite not being an 61 actual pasta(1) option). \ 62 Also, **-t none** and **-u none** are passed if, respectively, no TCP or 63 UDP port forwarding from host to container is configured, to disable 64 automatic port forwarding based on bound ports. Similarly, **-T none** and 65 **-U none** are given to disable the same functionality from container to 66 host. \ 67 Some examples: 68 - **pasta:--map-gw**: Allow the container to directly reach the host using the 69 gateway address. 70 - **pasta:--mtu,1500**: Specify a 1500 bytes MTU for the _tap_ interface in 71 the container. 72 - **pasta:--ipv4-only,-a,10.0.2.0,-n,24,-g,10.0.2.2,--dns-forward,10.0.2.3,-m,1500,--no-ndp,--no-dhcpv6,--no-dhcp**, 73 equivalent to default slirp4netns(1) options: disable IPv6, assign 74 `10.0.2.0/24` to the `tap0` interface in the container, with gateway 75 `10.0.2.3`, enable DNS forwarder reachable at `10.0.2.3`, set MTU to 1500 76 bytes, disable NDP, DHCPv6 and DHCP support. 77 - **pasta:-I,tap0,--ipv4-only,-a,10.0.2.0,-n,24,-g,10.0.2.2,--dns-forward,10.0.2.3,--no-ndp,--no-dhcpv6,--no-dhcp**, 78 equivalent to default slirp4netns(1) options with Podman overrides: same as 79 above, but leave the MTU to 65520 bytes 80 - **pasta:-t,auto,-u,auto,-T,auto,-U,auto**: enable automatic port forwarding 81 based on observed bound ports from both host and container sides 82 - **pasta:-T,5201**: enable forwarding of TCP port 5201 from container to 83 host, using the loopback interface instead of the tap interface for improved 84 performance