Welcome to Pulumi Registry, your window into the cloud. Read the announcement.

Network

Manages a VM network resource within libvirt. For more information see the official documentation.

Create a Network Resource

new Network(name: string, args?: NetworkArgs, opts?: CustomResourceOptions);
@overload
def Network(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            addresses: Optional[Sequence[str]] = None,
            autostart: Optional[bool] = None,
            bridge: Optional[str] = None,
            dhcp: Optional[NetworkDhcpArgs] = None,
            dns: Optional[NetworkDnsArgs] = None,
            domain: Optional[str] = None,
            mode: Optional[str] = None,
            mtu: Optional[int] = None,
            name: Optional[str] = None,
            routes: Optional[Sequence[NetworkRouteArgs]] = None,
            xml: Optional[NetworkXmlArgs] = None)
@overload
def Network(resource_name: str,
            args: Optional[NetworkArgs] = None,
            opts: Optional[ResourceOptions] = None)
func NewNetwork(ctx *Context, name string, args *NetworkArgs, opts ...ResourceOption) (*Network, error)
public Network(string name, NetworkArgs? args = null, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args NetworkArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args NetworkArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args NetworkArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args NetworkArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Network Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The Network resource accepts the following input properties:

Addresses List<string>
A list of (0 or 1) IPv4 and (0 or 1) IPv6 subnets in CIDR notation. This defines the subnets associated to that network. This argument is also used to define the address on the real host. If dhcp { enabled = true } addresses is also used to define the address range served by the DHCP server. No DHCP server will be started if addresses is omitted.
Autostart bool
Set to true to start the network on host boot up. If not specified false is assumed.
Bridge string
The bridge device defines the name of a bridge device which will be used to construct the virtual network (when not provided, it will be automatically obtained by libvirt in none, nat and route modes).
Dhcp NetworkDhcpArgs
DHCP configuration. You need to use it in conjuction with the adresses variable.
Dns NetworkDnsArgs
configuration of DNS specific settings for the network
Domain string
The domain used by the DNS server.
Mode string

One of:

  • none: the guests can talk to each other and the host OS, but cannot reach any other machines on the LAN.
  • nat: it is the default network mode. This is a configuration that allows guest OS to get outbound connectivity regardless of whether the host uses ethernet, wireless, dialup, or VPN networking without requiring any specific admin configuration. In the absence of host networking, it at least allows guests to talk directly to each other.
  • route: this is a variant on the default network which routes traffic from the virtual network to the LAN without applying any NAT. It requires that the IP address range be pre-configured in the routing tables of the router on the host network.
  • bridge: use a pre-existing host bridge. The guests will effectively be directly connected to the physical network (i.e. their IP addresses will all be on the subnet of the physical network, and there will be no restrictions on inbound or outbound connections). The bridge network attribute is mandatory in this case.
Mtu int
The MTU to set for the underlying network interfaces. When not supplied, libvirt will use the default for the interface, usually 1500. Libvirt version 5.1 and greater will advertise this value to nodes via DHCP.
Name string
A unique name for the resource, required by libvirt. Changing this forces a new resource to be created.
Routes List<NetworkRouteArgs>
a list of static routes. A cidr and a gateway must be provided. The gateway must be reachable via the bridge interface.
Xml NetworkXmlArgs
Addresses []string
A list of (0 or 1) IPv4 and (0 or 1) IPv6 subnets in CIDR notation. This defines the subnets associated to that network. This argument is also used to define the address on the real host. If dhcp { enabled = true } addresses is also used to define the address range served by the DHCP server. No DHCP server will be started if addresses is omitted.
Autostart bool
Set to true to start the network on host boot up. If not specified false is assumed.
Bridge string
The bridge device defines the name of a bridge device which will be used to construct the virtual network (when not provided, it will be automatically obtained by libvirt in none, nat and route modes).
Dhcp NetworkDhcpArgs
DHCP configuration. You need to use it in conjuction with the adresses variable.
Dns NetworkDnsArgs
configuration of DNS specific settings for the network
Domain string
The domain used by the DNS server.
Mode string

One of:

  • none: the guests can talk to each other and the host OS, but cannot reach any other machines on the LAN.
  • nat: it is the default network mode. This is a configuration that allows guest OS to get outbound connectivity regardless of whether the host uses ethernet, wireless, dialup, or VPN networking without requiring any specific admin configuration. In the absence of host networking, it at least allows guests to talk directly to each other.
  • route: this is a variant on the default network which routes traffic from the virtual network to the LAN without applying any NAT. It requires that the IP address range be pre-configured in the routing tables of the router on the host network.
  • bridge: use a pre-existing host bridge. The guests will effectively be directly connected to the physical network (i.e. their IP addresses will all be on the subnet of the physical network, and there will be no restrictions on inbound or outbound connections). The bridge network attribute is mandatory in this case.
Mtu int
The MTU to set for the underlying network interfaces. When not supplied, libvirt will use the default for the interface, usually 1500. Libvirt version 5.1 and greater will advertise this value to nodes via DHCP.
Name string
A unique name for the resource, required by libvirt. Changing this forces a new resource to be created.
Routes []NetworkRouteArgs
a list of static routes. A cidr and a gateway must be provided. The gateway must be reachable via the bridge interface.
Xml NetworkXmlArgs
addresses string[]
A list of (0 or 1) IPv4 and (0 or 1) IPv6 subnets in CIDR notation. This defines the subnets associated to that network. This argument is also used to define the address on the real host. If dhcp { enabled = true } addresses is also used to define the address range served by the DHCP server. No DHCP server will be started if addresses is omitted.
autostart boolean
Set to true to start the network on host boot up. If not specified false is assumed.
bridge string
The bridge device defines the name of a bridge device which will be used to construct the virtual network (when not provided, it will be automatically obtained by libvirt in none, nat and route modes).
dhcp NetworkDhcpArgs
DHCP configuration. You need to use it in conjuction with the adresses variable.
dns NetworkDnsArgs
configuration of DNS specific settings for the network
domain string
The domain used by the DNS server.
mode string

One of:

  • none: the guests can talk to each other and the host OS, but cannot reach any other machines on the LAN.
  • nat: it is the default network mode. This is a configuration that allows guest OS to get outbound connectivity regardless of whether the host uses ethernet, wireless, dialup, or VPN networking without requiring any specific admin configuration. In the absence of host networking, it at least allows guests to talk directly to each other.
  • route: this is a variant on the default network which routes traffic from the virtual network to the LAN without applying any NAT. It requires that the IP address range be pre-configured in the routing tables of the router on the host network.
  • bridge: use a pre-existing host bridge. The guests will effectively be directly connected to the physical network (i.e. their IP addresses will all be on the subnet of the physical network, and there will be no restrictions on inbound or outbound connections). The bridge network attribute is mandatory in this case.
mtu number
The MTU to set for the underlying network interfaces. When not supplied, libvirt will use the default for the interface, usually 1500. Libvirt version 5.1 and greater will advertise this value to nodes via DHCP.
name string
A unique name for the resource, required by libvirt. Changing this forces a new resource to be created.
routes NetworkRouteArgs[]
a list of static routes. A cidr and a gateway must be provided. The gateway must be reachable via the bridge interface.
xml NetworkXmlArgs
addresses Sequence[str]
A list of (0 or 1) IPv4 and (0 or 1) IPv6 subnets in CIDR notation. This defines the subnets associated to that network. This argument is also used to define the address on the real host. If dhcp { enabled = true } addresses is also used to define the address range served by the DHCP server. No DHCP server will be started if addresses is omitted.
autostart bool
Set to true to start the network on host boot up. If not specified false is assumed.
bridge str
The bridge device defines the name of a bridge device which will be used to construct the virtual network (when not provided, it will be automatically obtained by libvirt in none, nat and route modes).
dhcp NetworkDhcpArgs
DHCP configuration. You need to use it in conjuction with the adresses variable.
dns NetworkDnsArgs
configuration of DNS specific settings for the network
domain str
The domain used by the DNS server.
mode str

One of:

  • none: the guests can talk to each other and the host OS, but cannot reach any other machines on the LAN.
  • nat: it is the default network mode. This is a configuration that allows guest OS to get outbound connectivity regardless of whether the host uses ethernet, wireless, dialup, or VPN networking without requiring any specific admin configuration. In the absence of host networking, it at least allows guests to talk directly to each other.
  • route: this is a variant on the default network which routes traffic from the virtual network to the LAN without applying any NAT. It requires that the IP address range be pre-configured in the routing tables of the router on the host network.
  • bridge: use a pre-existing host bridge. The guests will effectively be directly connected to the physical network (i.e. their IP addresses will all be on the subnet of the physical network, and there will be no restrictions on inbound or outbound connections). The bridge network attribute is mandatory in this case.
mtu int
The MTU to set for the underlying network interfaces. When not supplied, libvirt will use the default for the interface, usually 1500. Libvirt version 5.1 and greater will advertise this value to nodes via DHCP.
name str
A unique name for the resource, required by libvirt. Changing this forces a new resource to be created.
routes Sequence[NetworkRouteArgs]
a list of static routes. A cidr and a gateway must be provided. The gateway must be reachable via the bridge interface.
xml NetworkXmlArgs

Outputs

All input properties are implicitly available as output properties. Additionally, the Network resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing Network Resource

Get an existing Network resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: NetworkState, opts?: CustomResourceOptions): Network
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        addresses: Optional[Sequence[str]] = None,
        autostart: Optional[bool] = None,
        bridge: Optional[str] = None,
        dhcp: Optional[NetworkDhcpArgs] = None,
        dns: Optional[NetworkDnsArgs] = None,
        domain: Optional[str] = None,
        mode: Optional[str] = None,
        mtu: Optional[int] = None,
        name: Optional[str] = None,
        routes: Optional[Sequence[NetworkRouteArgs]] = None,
        xml: Optional[NetworkXmlArgs] = None) -> Network
func GetNetwork(ctx *Context, name string, id IDInput, state *NetworkState, opts ...ResourceOption) (*Network, error)
public static Network Get(string name, Input<string> id, NetworkState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

Addresses List<string>
A list of (0 or 1) IPv4 and (0 or 1) IPv6 subnets in CIDR notation. This defines the subnets associated to that network. This argument is also used to define the address on the real host. If dhcp { enabled = true } addresses is also used to define the address range served by the DHCP server. No DHCP server will be started if addresses is omitted.
Autostart bool
Set to true to start the network on host boot up. If not specified false is assumed.
Bridge string
The bridge device defines the name of a bridge device which will be used to construct the virtual network (when not provided, it will be automatically obtained by libvirt in none, nat and route modes).
Dhcp NetworkDhcpArgs
DHCP configuration. You need to use it in conjuction with the adresses variable.
Dns NetworkDnsArgs
configuration of DNS specific settings for the network
Domain string
The domain used by the DNS server.
Mode string

One of:

  • none: the guests can talk to each other and the host OS, but cannot reach any other machines on the LAN.
  • nat: it is the default network mode. This is a configuration that allows guest OS to get outbound connectivity regardless of whether the host uses ethernet, wireless, dialup, or VPN networking without requiring any specific admin configuration. In the absence of host networking, it at least allows guests to talk directly to each other.
  • route: this is a variant on the default network which routes traffic from the virtual network to the LAN without applying any NAT. It requires that the IP address range be pre-configured in the routing tables of the router on the host network.
  • bridge: use a pre-existing host bridge. The guests will effectively be directly connected to the physical network (i.e. their IP addresses will all be on the subnet of the physical network, and there will be no restrictions on inbound or outbound connections). The bridge network attribute is mandatory in this case.
Mtu int
The MTU to set for the underlying network interfaces. When not supplied, libvirt will use the default for the interface, usually 1500. Libvirt version 5.1 and greater will advertise this value to nodes via DHCP.
Name string
A unique name for the resource, required by libvirt. Changing this forces a new resource to be created.
Routes List<NetworkRouteArgs>
a list of static routes. A cidr and a gateway must be provided. The gateway must be reachable via the bridge interface.
Xml NetworkXmlArgs
Addresses []string
A list of (0 or 1) IPv4 and (0 or 1) IPv6 subnets in CIDR notation. This defines the subnets associated to that network. This argument is also used to define the address on the real host. If dhcp { enabled = true } addresses is also used to define the address range served by the DHCP server. No DHCP server will be started if addresses is omitted.
Autostart bool
Set to true to start the network on host boot up. If not specified false is assumed.
Bridge string
The bridge device defines the name of a bridge device which will be used to construct the virtual network (when not provided, it will be automatically obtained by libvirt in none, nat and route modes).
Dhcp NetworkDhcpArgs
DHCP configuration. You need to use it in conjuction with the adresses variable.
Dns NetworkDnsArgs
configuration of DNS specific settings for the network
Domain string
The domain used by the DNS server.
Mode string

One of:

  • none: the guests can talk to each other and the host OS, but cannot reach any other machines on the LAN.
  • nat: it is the default network mode. This is a configuration that allows guest OS to get outbound connectivity regardless of whether the host uses ethernet, wireless, dialup, or VPN networking without requiring any specific admin configuration. In the absence of host networking, it at least allows guests to talk directly to each other.
  • route: this is a variant on the default network which routes traffic from the virtual network to the LAN without applying any NAT. It requires that the IP address range be pre-configured in the routing tables of the router on the host network.
  • bridge: use a pre-existing host bridge. The guests will effectively be directly connected to the physical network (i.e. their IP addresses will all be on the subnet of the physical network, and there will be no restrictions on inbound or outbound connections). The bridge network attribute is mandatory in this case.
Mtu int
The MTU to set for the underlying network interfaces. When not supplied, libvirt will use the default for the interface, usually 1500. Libvirt version 5.1 and greater will advertise this value to nodes via DHCP.
Name string
A unique name for the resource, required by libvirt. Changing this forces a new resource to be created.
Routes []NetworkRouteArgs
a list of static routes. A cidr and a gateway must be provided. The gateway must be reachable via the bridge interface.
Xml NetworkXmlArgs
addresses string[]
A list of (0 or 1) IPv4 and (0 or 1) IPv6 subnets in CIDR notation. This defines the subnets associated to that network. This argument is also used to define the address on the real host. If dhcp { enabled = true } addresses is also used to define the address range served by the DHCP server. No DHCP server will be started if addresses is omitted.
autostart boolean
Set to true to start the network on host boot up. If not specified false is assumed.
bridge string
The bridge device defines the name of a bridge device which will be used to construct the virtual network (when not provided, it will be automatically obtained by libvirt in none, nat and route modes).
dhcp NetworkDhcpArgs
DHCP configuration. You need to use it in conjuction with the adresses variable.
dns NetworkDnsArgs
configuration of DNS specific settings for the network
domain string
The domain used by the DNS server.
mode string

One of:

  • none: the guests can talk to each other and the host OS, but cannot reach any other machines on the LAN.
  • nat: it is the default network mode. This is a configuration that allows guest OS to get outbound connectivity regardless of whether the host uses ethernet, wireless, dialup, or VPN networking without requiring any specific admin configuration. In the absence of host networking, it at least allows guests to talk directly to each other.
  • route: this is a variant on the default network which routes traffic from the virtual network to the LAN without applying any NAT. It requires that the IP address range be pre-configured in the routing tables of the router on the host network.
  • bridge: use a pre-existing host bridge. The guests will effectively be directly connected to the physical network (i.e. their IP addresses will all be on the subnet of the physical network, and there will be no restrictions on inbound or outbound connections). The bridge network attribute is mandatory in this case.
mtu number
The MTU to set for the underlying network interfaces. When not supplied, libvirt will use the default for the interface, usually 1500. Libvirt version 5.1 and greater will advertise this value to nodes via DHCP.
name string
A unique name for the resource, required by libvirt. Changing this forces a new resource to be created.
routes NetworkRouteArgs[]
a list of static routes. A cidr and a gateway must be provided. The gateway must be reachable via the bridge interface.
xml NetworkXmlArgs
addresses Sequence[str]
A list of (0 or 1) IPv4 and (0 or 1) IPv6 subnets in CIDR notation. This defines the subnets associated to that network. This argument is also used to define the address on the real host. If dhcp { enabled = true } addresses is also used to define the address range served by the DHCP server. No DHCP server will be started if addresses is omitted.
autostart bool
Set to true to start the network on host boot up. If not specified false is assumed.
bridge str
The bridge device defines the name of a bridge device which will be used to construct the virtual network (when not provided, it will be automatically obtained by libvirt in none, nat and route modes).
dhcp NetworkDhcpArgs
DHCP configuration. You need to use it in conjuction with the adresses variable.
dns NetworkDnsArgs
configuration of DNS specific settings for the network
domain str
The domain used by the DNS server.
mode str

One of:

  • none: the guests can talk to each other and the host OS, but cannot reach any other machines on the LAN.
  • nat: it is the default network mode. This is a configuration that allows guest OS to get outbound connectivity regardless of whether the host uses ethernet, wireless, dialup, or VPN networking without requiring any specific admin configuration. In the absence of host networking, it at least allows guests to talk directly to each other.
  • route: this is a variant on the default network which routes traffic from the virtual network to the LAN without applying any NAT. It requires that the IP address range be pre-configured in the routing tables of the router on the host network.
  • bridge: use a pre-existing host bridge. The guests will effectively be directly connected to the physical network (i.e. their IP addresses will all be on the subnet of the physical network, and there will be no restrictions on inbound or outbound connections). The bridge network attribute is mandatory in this case.
mtu int
The MTU to set for the underlying network interfaces. When not supplied, libvirt will use the default for the interface, usually 1500. Libvirt version 5.1 and greater will advertise this value to nodes via DHCP.
name str
A unique name for the resource, required by libvirt. Changing this forces a new resource to be created.
routes Sequence[NetworkRouteArgs]
a list of static routes. A cidr and a gateway must be provided. The gateway must be reachable via the bridge interface.
xml NetworkXmlArgs

Supporting Types

NetworkDhcp

Enabled bool
when false, disable the DHCP server
Enabled bool
when false, disable the DHCP server
enabled boolean
when false, disable the DHCP server
enabled bool
when false, disable the DHCP server

NetworkDns

Enabled bool
when false, disable the DHCP server
Forwarders List<NetworkDnsForwarder>
Either address, domain, or both must be set
Hosts List<NetworkDnsHost>
a DNS host entry block. You can have one or more of these blocks in your DNS definition. You must specify both ip and hostname.
LocalOnly bool
true/false: true means ‘do not forward unresolved requests for this domain to the part DNS server
Srvs List<NetworkDnsSrv>
a DNS SRV entry block. You can have one or more of these blocks in your DNS definition. You must specify service and protocol.
Enabled bool
when false, disable the DHCP server
Forwarders []NetworkDnsForwarder
Either address, domain, or both must be set
Hosts []NetworkDnsHost
a DNS host entry block. You can have one or more of these blocks in your DNS definition. You must specify both ip and hostname.
LocalOnly bool
true/false: true means ‘do not forward unresolved requests for this domain to the part DNS server
Srvs []NetworkDnsSrv
a DNS SRV entry block. You can have one or more of these blocks in your DNS definition. You must specify service and protocol.
enabled boolean
when false, disable the DHCP server
forwarders NetworkDnsForwarder[]
Either address, domain, or both must be set
hosts NetworkDnsHost[]
a DNS host entry block. You can have one or more of these blocks in your DNS definition. You must specify both ip and hostname.
localOnly boolean
true/false: true means ‘do not forward unresolved requests for this domain to the part DNS server
srvs NetworkDnsSrv[]
a DNS SRV entry block. You can have one or more of these blocks in your DNS definition. You must specify service and protocol.
enabled bool
when false, disable the DHCP server
forwarders Sequence[NetworkDnsForwarder]
Either address, domain, or both must be set
hosts Sequence[NetworkDnsHost]
a DNS host entry block. You can have one or more of these blocks in your DNS definition. You must specify both ip and hostname.
local_only bool
true/false: true means ‘do not forward unresolved requests for this domain to the part DNS server
srvs Sequence[NetworkDnsSrv]
a DNS SRV entry block. You can have one or more of these blocks in your DNS definition. You must specify service and protocol.

NetworkDnsForwarder

Address string
Domain string
The domain used by the DNS server.
Address string
Domain string
The domain used by the DNS server.
address string
domain string
The domain used by the DNS server.
address str
domain str
The domain used by the DNS server.

NetworkDnsHost

Hostname string
Ip string
Hostname string
Ip string
hostname string
ip string
hostname str
ip str

NetworkDnsSrv

Domain string
The domain used by the DNS server.
Port string
Priority string
Protocol string
Service string
Target string
Weight string
Domain string
The domain used by the DNS server.
Port string
Priority string
Protocol string
Service string
Target string
Weight string
domain string
The domain used by the DNS server.
port string
priority string
protocol string
service string
target string
weight string
domain str
The domain used by the DNS server.
port str
priority str
protocol str
service str
target str
weight str

NetworkRoute

Cidr string
Gateway string
Cidr string
Gateway string
cidr string
gateway string
cidr str
gateway str

NetworkXml

Xslt string
Xslt string
xslt string
xslt str

Package Details

Repository
https://github.com/pulumi/pulumi-libvirt
License
Apache-2.0
Notes
This Pulumi package is based on the libvirt Terraform Provider.