dmacvicar / terraform-provider-libvirt

Terraform provider to provision infrastructure with Linux's KVM using libvirt
Apache License 2.0
1.6k stars 458 forks source link

looking for networking doc #777

Closed muj85 closed 1 month ago

muj85 commented 4 years ago

System Information

HP Bare Metal Server

Linux distribution

NAME=Fedora VERSION="29 (Server Edition)"

Terraform version

Terraform v0.12.26


Description of Issue/Question

I would like to give some kvm guests direct network access. manual configuration of a vm guest works and creates the following (eno1 is main interface):

<interface type='direct'>
<mac address='52:54:00:f0:8a:3a'/>
<source dev='eno1' mode='bridge'/>
<target dev='macvtap1'/>
<model type='virtio'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</interface>
65536: macvtap1@eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 500
    link/ether 52:54:00:f0:8a:3a brd ff:ff:ff:ff:ff:ff
    inet6 fe80::5054:ff:fef0:8a3a/64 scope link

Setup

Installed docker and libvirt on the Host

virbr0 network is internal kvm network virbr1 network created using terraform for guest only communication

brctl show
bridge name     bridge id               STP enabled     interfaces
br-5d6f55713f15         8000.0242c54f5707       no              vethdd6e16a
                                                        vethe25819d
                                                        vethf860f75
docker0         8000.02420d129272       no              veth425a6a9
virbr0          8000.525400bb5f23       yes             virbr0-nic
                                                        vnet1
virbr1          8000.525400821abe       yes             virbr1-nic
                                                        vnet0
                                                        vnet2
                                                        vnet3
                                                        vnet4
                                                        vnet5
                                                        vnet6
                                                        vnet7
                                                        vnet8

Question: how can I create a network config using terraform that uses direct host access (without creating a bridge on the host)?


Additional information:

selinux and firewall disabled

MalloZup commented 4 years ago

hi! checkout

https://github.com/dmacvicar/terraform-provider-libvirt/blob/master/website/docs/r/network.markdown

if you find something otherwise we need to provide an example or research a bit. let me know

muj85 commented 4 years ago

Hi, thx for the link - I already found that page, but as I understand this requires the configuration of a bridge on the host system, then linking the bridge to the vm using the bridge name: "The bridge network attribute is mandatory in this case"

yes, an example would be great!

muj85 commented 4 years ago

hi @MalloZup! any chance to get some docs for this? thx and br

scabala commented 1 month ago

Hi @muj85 some upstream libvirt documentation: https://wiki.libvirt.org/VirtualNetworking.html What exactly do you mean by 'direct host access'?

muj85 commented 1 month ago

Hi @scabala,

I solved it using bridge setup with script during kvm host boot process, later moved to systemd network config, works for me.

thank you!