github.com/hanks177/podman/v4@v4.1.3-0.20220613032544-16d90015bc83/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 CNI-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 can
    12  be designated with the *-o parent=`<device>`* option. In the case of *Macvlan* connections, the
    13  CNI *dhcp* plugin needs to be activated or the container image must have a DHCP client to interact
    14  with the host network's DHCP server.
    15  
    16  If no options are provided, Podman will assign a free subnet and name for your network.
    17  
    18  Upon completion of creating the network, Podman will display the name of the newly added network.
    19  
    20  ## OPTIONS
    21  #### **--disable-dns**
    22  
    23  Disables the DNS plugin for this network which if enabled, can perform container to container name
    24  resolution.
    25  
    26  #### **--driver**, **-d**
    27  
    28  Driver to manage the network. Currently `bridge`, `macvlan` and `ipvlan` are supported. Defaults to `bridge`.
    29  As rootless the `macvlan` and `ipvlan` driver have no access to the host network interfaces because rootless networking requires a separate network namespace.
    30  
    31  Special considerations for the *netavark* backend:
    32  - The `macvlan` driver requires the `--subnet` option, DHCP is currently not supported.
    33  - The `ipvlan` driver is not currently supported.
    34  
    35  #### **--gateway**
    36  
    37  Define a gateway for the subnet. If you want to provide a gateway address, you must also provide a
    38  *subnet* option. Can be specified multiple times.
    39  The argument order of the **--subnet**, **--gateway** and **--ip-range** options must match.
    40  
    41  #### **--internal**
    42  
    43  Restrict external access of this network. Note when using this option, the dnsname plugin will be
    44  automatically disabled.
    45  
    46  #### **--ip-range**
    47  
    48  Allocate container IP from a range.  The range must be a complete subnet and in CIDR notation.  The *ip-range* option
    49  must be used with a *subnet* option. Can be specified multiple times.
    50  The argument order of the **--subnet**, **--gateway** and **--ip-range** options must match.
    51  
    52  #### **--ipam-driver**=*driver*
    53  
    54  Set the ipam driver (IP Address Management Driver) for the network. When unset podman will choose an
    55  ipam driver automatically based on the network driver. Valid values are:
    56   - `host-local`: IP addresses are assigned locally.
    57   - `dhcp`: IP addresses are assigned from a dhcp server on your network. This driver is not yet supported with netavark.
    58   - `none`: No ip addresses are assigned to the interfaces.
    59  
    60  You can see the driver in the **podman network inspect** output under the `ipam_options` field.
    61  
    62  #### **--ipv6**
    63  
    64  Enable IPv6 (Dual Stack) networking. If not subnets are given it will allocate a ipv4 and ipv6 subnet.
    65  
    66  #### **--label**
    67  
    68  Set metadata for a network (e.g., --label mykey=value).
    69  
    70  #### **--opt**=*option*, **-o**
    71  
    72  Set driver specific options.
    73  
    74  All drivers accept the `mtu` option. The `mtu` option sets the Maximum Transmission Unit (MTU) and takes an integer value.
    75  
    76  Additionally the `bridge` driver supports the following option:
    77  - `vlan`: This option assign VLAN tag and enables vlan\_filtering. Defaults to none.
    78  
    79  The `macvlan` and `ipvlan` driver support the following options:
    80  - `parent`: The host device which should be used for the macvlan interface. Defaults to the default route interface.
    81  - `mode`: This option sets the specified ip/macvlan mode on the interface.
    82    - Supported values for `macvlan` are `bridge`, `private`, `vepa`, `passthru`. Defaults to `bridge`.
    83    - Supported values for `ipvlan` are `l2`, `l3`, `l3s`. Defaults to `l2`.
    84  
    85  #### **--subnet**
    86  
    87  The subnet in CIDR notation. Can be specified multiple times to allocate more than one subnet for this network.
    88  The argument order of the **--subnet**, **--gateway** and **--ip-range** options must match.
    89  This is useful to set a static ipv4 and ipv6 subnet.
    90  
    91  ## EXAMPLE
    92  
    93  Create a network with no options.
    94  ```
    95  $ podman network create
    96  cni-podman2
    97  ```
    98  
    99  Create a network named *newnet* that uses *192.5.0.0/16* for its subnet.
   100  ```
   101  $ podman network create --subnet 192.5.0.0/16 newnet
   102  newnet
   103  ```
   104  
   105  Create an IPv6 network named *newnetv6* with a subnet of *2001:db8::/64*.
   106  ```
   107  $ podman network create --subnet 2001:db8::/64 --ipv6 newnetv6
   108  newnetv6
   109  ```
   110  
   111  Create a network named *newnet* that uses *192.168.33.0/24* and defines a gateway as *192.168.133.3*.
   112  ```
   113  $ podman network create --subnet 192.168.33.0/24 --gateway 192.168.33.3 newnet
   114  newnet
   115  ```
   116  
   117  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*.
   118  ```
   119  $ podman network create --subnet 192.168.55.0/24 --ip-range 192.168.55.128/25
   120  cni-podman5
   121  ```
   122  
   123  Create a network with a static ipv4 and ipv6 subnet and set a gateway.
   124  ```
   125  $ 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
   126  podman4
   127  ```
   128  
   129  Create a Macvlan based network using the host interface eth0. Macvlan networks can only be used as root.
   130  ```
   131  # podman network create -d macvlan -o parent=eth0 --subnet 192.5.0.0/16 newnet
   132  newnet
   133  ```
   134  
   135  ## SEE ALSO
   136  **[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)**
   137  
   138  ## HISTORY
   139  August 2021, Updated with the new network format by Paul Holzinger <pholzing@redhat.com>
   140  
   141  August 2019, Originally compiled by Brent Baude <bbaude@redhat.com>