Open alexeyyakimovich opened 8 months ago
Ubuntu 22.04
OpenTofu v1.6.1 on darwin_arm64
provider registry.opentofu.org/dmacvicar/libvirt v0.7.6 libvirtd (libvirt) 8.0.0
I want to bind virtual network to specific host interface, but i can't find the way to do it. I don't know if this feature is missing or it's just a documentation issue.
terraform { required_providers { libvirt = { source = "dmacvicar/libvirt" version = "0.7.6" } } } provider "libvirt" { uri = "qemu+ssh://..." } resource "libvirt_network" "services-network" { name = "office-services" mode = "route" domain = "services.office.internal" addresses = ["192.168.2.0/28"] bridge = "office-services" autostart = true dhcp { enabled = true } dns { enabled = true local_only = true forwarders { address = "172.16.0.9" domain = "office.internal" } } }
This setup will generate the following network xml:
<network> <name>office-services</name> <uuid>553965c9-578c-4d58-abbf-e2fab9107430</uuid> <forward mode='route'/> <bridge name='office-services' stp='on' delay='0'/> <mac address='52:54:00:2d:74:e3'/> <domain name='services.office.internal' localOnly='yes'/> <dns enable='yes'> <forwarder domain='office.internal' addr='172.16.0.9'/> </dns> <ip family='ipv4' address='192.168.2.1' prefix='28'> <dhcp> <range start='192.168.2.2' end='192.168.2.14'/> <host mac='02:00:00:00:00:01' name='reverse' ip='192.168.2.2'/> </dhcp> </ip> </network>
I've edited it manually to define dev attribute of forward node. After saving network xml becomes this way:
dev
forward
<network> <name>office-services</name> <uuid>553965c9-578c-4d58-abbf-e2fab9107430</uuid> <forward dev='office' mode='route'> <interface dev='office'/> </forward> <bridge name='office-services' stp='on' delay='0'/> <mac address='52:54:00:2d:74:e3'/> <domain name='services.office.internal' localOnly='yes'/> <dns enable='yes'> <forwarder domain='office.internal' addr='172.16.0.9'/> </dns> <ip family='ipv4' address='192.168.2.1' prefix='28'> <dhcp> <range start='192.168.2.2' end='192.168.2.14'/> <host mac='02:00:00:00:00:01' name='reverse' ip='192.168.2.2'/> </dhcp> </ip> </network>
Is it possible to achieve this result with provider?
Hello, does specifying device work with pure libvirt?
And out curiosity, what are you trying to achieve?
Hello, yes, it works with pure libvirt )
I want to pass nic port direct to vm
System Information
Linux distribution
Ubuntu 22.04
Terraform version
Provider and libvirt versions
Description of Issue/Question
I want to bind virtual network to specific host interface, but i can't find the way to do it. I don't know if this feature is missing or it's just a documentation issue.
Setup
Steps to Reproduce Issue
This setup will generate the following network xml:
I've edited it manually to define
dev
attribute offorward
node. After saving network xml becomes this way:Is it possible to achieve this result with provider?