3.2.11.3. Network Options

Network-related options allow you to set the hostname, the domain to search when a not fully qualified domain name is used, the DNS server address and the IP addresses (both IPv4 and IPv6) that container can use, and other parameters.

NameDescription

--hostname <name>

Sets the hostname to the specified name.

--ipadd <addr>

Adds an IP address to a list of IP addresses the container can use and brings up the network interface with this address inside the container. If used with the --ifname option, adds an IP address to the specified container virtual network adapter.

--ipadd <addr>/<net_mask>

Assigns the IP address and network mask to the container.

Note

Note: You can assign network masks to containers operating in the venet0 networking mode only if the USE_VENET_MASK parameter in the OpenVZ containers configuration file is set to yes.

--ipdel {<addr>|all}

Allows you to revoke IP address from the container. If "all" is used instead of IP address than all IP addresses will be revoked. If used with the --ifname option, deletes an IP address from the specified container virtual network adapter.

--nameserver <addr>

The DNS server IP address for the container. If used with the --ifname option, sets the DNS server for the specified container virtual network adapter.

--searchdomain <domain>

The DNS search domain for the container. More than one domain may be specified.

--netfilter <disabled|stateless|stateful|full>

Indicates which iptables modules are allowed for the container. If some of the allowed modules are not loaded on the destination Hardware Node after migration or restoration from backup, they will be automatically loaded on the migrated or restored container start. The following modes are available:

  • disabled: none.
  • stateless: (default) all modules except conntrack and NAT-related.
  • stateful: all modules except NAT-related.
  • full: all modules.

--netif_add <name>[, <MAC>, <host_MAC>]

Creates a new veth virtual network adapter and assigns the name of <name> to the Ethernet interface inside the container. Along with the Ethernet interface name inside the container, you can set the following parameters when creating the veth adapter:

  • <MAC>: the MAC address to be assigned to the veth Ethernet interface inside the container.
  • <host_MAC>: the MAC address to be assigned to the veth Ethernet interface on the server.

Only the Ethernet interface name (<name>) is mandatory; all the other parameters, if not specified, are automatically generated by OpenVZ during the veth adapter creation.

--netif_del <name>

Removes the veth virtual network adapter with the specified name from the container.

--ifname <name>

Specifies the name of the veth virtual network adapter whose settings are to be configured. This option can be used along with one of the following options: --ipadd, --ipdel, --nameserver, --gw, --network, --dhcp, --mac, --host_mac.

--mac <addr>

The MAC address to be assigned to the veth virtual Ethernet interface inside the container. Should be used along with the --ifname option.

--host_mac <addr>

The MAC address to be assigned to the veth virtual Ethernet interface on the server. Should be used along with the --ifname option.

--host_ifname <name>

The name to be assigned to the veth virtual Ethernet interface on the server. Should be used along with the --ifname option.

--network <network_ID>

Connects the veth virtual network adapter to the bridge associated with the specified network ID. Should be used along with the --ifname option. You can also use this option to disconnect the veth virtual network adapter from the bridge. To this effect, you should specify "" after the option.

--dhcp <yes|no>

Specifies whether the virtual network adapter should obtain the IPv4 settings through a DHCP server.

--dhcp6 <yes|no>

Specifies whether the virtual network adapter should obtain the IPv6 settings through a DHCP server.

--gw <gw>

The default gateway to be used by the container.

--gw6 <gw>

The default IPv6 gateway to be used by the container.

--apply-iponly <yes|no>

If set to yes, the hostname, nameserver, and search domain settings from the container configuration file are ignored.

--configure <yes|no>

If set to yes, the settings above are applied to the virtual network adapter instead of its original settings. Configuring any of the settings above automatically sets this option to yes.