github.com/containers/podman/v5@v5.1.0-rc1/docs/source/markdown/podman-network-create.1.md (about)

     1  % podman-network-create 1
     2  
     3  ## NAME
     4  podman\-network-create - Create a Podman network
     5  
     6  ## SYNOPSIS
     7  **podman network create**  [*options*] [*name*]
     8  
     9  ## DESCRIPTION
    10  Create a network configuration for use with Podman. By default, Podman creates a bridge connection.
    11  A *Macvlan* connection can be created with the *-d macvlan* option. A parent device for macvlan or
    12  ipvlan can be designated with the *-o parent=`<device>`* or *--network-interface=`<device>`* option.
    13  
    14  If no options are provided, Podman assigns a free subnet and name for the network.
    15  
    16  Upon completion of creating the network, Podman displays the name of the newly added network.
    17  
    18  ## OPTIONS
    19  #### **--disable-dns**
    20  
    21  Disables the DNS plugin for this network which if enabled, can perform container to container name
    22  resolution. It is only supported with the `bridge` driver, for other drivers it is always disabled.
    23  
    24  #### **--dns**=*ip*
    25  
    26  Set network-scoped DNS resolver/nameserver for containers in this network. If not set, the host servers from `/etc/resolv.conf` is used.  It can be overwritten on the container level with the `podman run/create --dns` option. This option can be specified multiple times to set more than one IP.
    27  
    28  #### **--driver**, **-d**=*driver*
    29  
    30  Driver to manage the network. Currently `bridge`, `macvlan` and `ipvlan` are supported. Defaults to `bridge`.
    31  As rootless the `macvlan` and `ipvlan` driver have no access to the host network interfaces because rootless networking requires a separate network namespace.
    32  
    33  The netavark backend allows the use of so called *netavark plugins*, see the
    34  [plugin-API.md](https://github.com/containers/netavark/blob/main/plugin-API.md)
    35  documentation in netavark. The binary must be placed in a specified directory
    36  so podman can discover it, this list is set in `netavark_plugin_dirs` in
    37  **[containers.conf(5)](https://github.com/containers/common/blob/main/docs/containers.conf.5.md)**
    38  under the `[network]` section.
    39  
    40  The name of the plugin can then be used as driver to create a network for your plugin.
    41  The list of all supported drivers and plugins can be seen with `podman info --format {{.Plugins.Network}}`.
    42  
    43  Note that the `macvlan` and `ipvlan` drivers do not support port forwarding. Support for port forwarding
    44  with a plugin depends on the implementation of the plugin.
    45  
    46  #### **--gateway**=*ip*
    47  
    48  Define a gateway for the subnet. To provide a gateway address, a
    49  *subnet* option is required. Can be specified multiple times.
    50  The argument order of the **--subnet**, **--gateway** and **--ip-range** options must match.
    51  
    52  #### **--ignore**
    53  
    54  Ignore the create request if a network with the same name already exists instead of failing.
    55  Note, trying to create a network with an existing name and different parameters does not change the configuration of the existing one.
    56  
    57  #### **--interface-name**=*name*
    58  
    59  This option maps the *network_interface* option in the network config, see **podman network inspect**.
    60  Depending on the driver, this can have different effects; for `bridge`, it uses the bridge interface name.
    61  For `macvlan` and `ipvlan`, it is the parent device on the host. It is the same as `--opt parent=...`.
    62  
    63  #### **--internal**
    64  
    65  Restrict external access of this network when using a `bridge` network. Note when using the CNI backend
    66  DNS will be automatically disabled, see **--disable-dns**.
    67  
    68  When using the `macvlan` or `ipvlan` driver with this option no default route will be added to the container.
    69  Because it bypasses the host network stack no additional restrictions can be set by podman and if a
    70  privileged container is run it can set a default route themselves. If this is a concern then the
    71  container connections should be blocked on your actual network gateway.
    72  
    73  #### **--ip-range**=*range*
    74  
    75  Allocate container IP from a range. The range must be a either a complete subnet in CIDR notation or be in
    76  the `<startIP>-<endIP>` syntax which allows for a more flexible range compared to the CIDR subnet.
    77  The *ip-range* option must be used with a *subnet* option. Can be specified multiple times.
    78  The argument order of the **--subnet**, **--gateway** and **--ip-range** options must match.
    79  
    80  #### **--ipam-driver**=*driver*
    81  
    82  Set the ipam driver (IP Address Management Driver) for the network. When unset podman chooses an
    83  ipam driver automatically based on the network driver.
    84  
    85  Valid values are:
    86  
    87   - `dhcp`: IP addresses are assigned from a dhcp server on the network. When using the netavark backend
    88    the `netavark-dhcp-proxy.socket` must be enabled in order to start the dhcp-proxy when a container is
    89    started, for CNI use the `cni-dhcp.socket` unit instead.
    90   - `host-local`: IP addresses are assigned locally.
    91   - `none`: No ip addresses are assigned to the interfaces.
    92  
    93  View the driver in the **podman network inspect** output under the `ipam_options` field.
    94  
    95  #### **--ipv6**
    96  
    97  Enable IPv6 (Dual Stack) networking. If no subnets are given, it allocates an ipv4 and an ipv6 subnet.
    98  
    99  #### **--label**=*label*
   100  
   101  Set metadata for a network (e.g., --label mykey=value).
   102  
   103  #### **--opt**, **-o**=*option*
   104  
   105  Set driver specific options.
   106  
   107  All drivers accept the `mtu`, `metric`, `no_default_route` and options.
   108  
   109  - `mtu`: Sets the Maximum Transmission Unit (MTU) and takes an integer value.
   110  - `metric` Sets the Route Metric for the default route created in every container joined to this network. Accepts a positive integer value. Can only be used with the Netavark network backend.
   111  - `no_default_route`: If set to 1, Podman will not automatically add a default route to subnets. Routes can still be added
   112  manually by creating a custom route using `--route`.
   113  
   114  Additionally the `bridge` driver supports the following options:
   115  
   116  - `vlan`: This option assign VLAN tag and enables vlan\_filtering. Defaults to none.
   117  - `isolate`: This option isolates networks by blocking traffic between those that have this option enabled.
   118  - `com.docker.network.bridge.name`: This option assigns the given name to the created Linux Bridge
   119  - `com.docker.network.driver.mtu`: Sets the Maximum Transmission Unit (MTU) and takes an integer value.
   120  - `vrf`: This option assigns a VRF to the bridge interface. It accepts the name of the VRF and defaults to none. Can only be used with the Netavark network backend.
   121  
   122  The `macvlan` and `ipvlan` driver support the following options:
   123  
   124  - `parent`: The host device which is used for the macvlan interface. Defaults to the default route interface.
   125  - `mode`: This option sets the specified ip/macvlan mode on the interface.
   126    - Supported values for `macvlan` are `bridge`, `private`, `vepa`, `passthru`. Defaults to `bridge`.
   127    - Supported values for `ipvlan` are `l2`, `l3`, `l3s`. Defaults to `l2`.
   128  
   129  Additionally the `macvlan` driver supports the `bclim` option:
   130  
   131  - `bclim`: Set the threshold for broadcast queueing. Must be a 32 bit integer. Setting this value to `-1` disables broadcast queueing altogether.
   132  
   133  #### **--route**=*route*
   134  
   135  A static route in the format `<destination in CIDR notation>,<gateway>,<route metric (optional)>`. This route will be added to every container in this network. Only available with the netavark backend. It can be specified multiple times if more than one static route is desired.
   136  
   137  #### **--subnet**=*subnet*
   138  
   139  The subnet in CIDR notation. Can be specified multiple times to allocate more than one subnet for this network.
   140  The argument order of the **--subnet**, **--gateway** and **--ip-range** options must match.
   141  This is useful to set a static ipv4 and ipv6 subnet.
   142  
   143  ## EXAMPLE
   144  
   145  Create a network with no options.
   146  ```
   147  $ podman network create
   148  podman2
   149  ```
   150  
   151  Create a network named *newnet* that uses *192.5.0.0/16* for its subnet.
   152  ```
   153  $ podman network create --subnet 192.5.0.0/16 newnet
   154  newnet
   155  ```
   156  
   157  Create an IPv6 network named *newnetv6* with a subnet of *2001:db8::/64*.
   158  ```
   159  $ podman network create --subnet 2001:db8::/64 --ipv6 newnetv6
   160  newnetv6
   161  ```
   162  
   163  Create a network named *newnet* that uses *192.168.33.0/24* and defines a gateway as *192.168.133.3*.
   164  ```
   165  $ podman network create --subnet 192.168.33.0/24 --gateway 192.168.33.3 newnet
   166  newnet
   167  ```
   168  
   169  Create a network that uses a *192.168.55.0/24* subnet and has an IP address range of *192.168.55.129 - 192.168.55.254*.
   170  ```
   171  $ podman network create --subnet 192.168.55.0/24 --ip-range 192.168.55.128/25
   172  podman5
   173  ```
   174  
   175  Create a network with a static ipv4 and ipv6 subnet and set a gateway.
   176  ```
   177  $ podman network create --subnet 192.168.55.0/24 --gateway 192.168.55.3 --subnet fd52:2a5a:747e:3acd::/64 --gateway fd52:2a5a:747e:3acd::10
   178  podman4
   179  ```
   180  
   181  Create a network with a static subnet and a static route.
   182  ```
   183  $ podman network create --subnet 192.168.33.0/24 --route 10.1.0.0/24,192.168.33.10 newnet
   184  ```
   185  
   186  Create a network with a static subnet and a static route without a default
   187  route.
   188  ```
   189  $ podman network create --subnet 192.168.33.0/24 --route 10.1.0.0/24,192.168.33.10 --opt no_default_route=1 newnet
   190  ```
   191  
   192  Create a Macvlan based network using the host interface eth0. Macvlan networks can only be used as root.
   193  ```
   194  $ sudo podman network create -d macvlan -o parent=eth0 --subnet 192.5.0.0/16 newnet
   195  newnet
   196  ```
   197  
   198  ## SEE ALSO
   199  **[podman(1)](podman.1.md)**, **[podman-network(1)](podman-network.1.md)**, **[podman-network-inspect(1)](podman-network-inspect.1.md)**, **[podman-network-ls(1)](podman-network-ls.1.md)**, **[containers.conf(5)](https://github.com/containers/common/blob/main/docs/containers.conf.5.md)**
   200  
   201  ## HISTORY
   202  August 2021, Updated with the new network format by Paul Holzinger <pholzing@redhat.com>
   203  
   204  August 2019, Originally compiled by Brent Baude <bbaude@redhat.com>