Score:1

Howto set a host virtual interface (failover) to a vm in kvm+libvirt?

br flag

Have a Ubuntu Server 20.04 and 2 address, one in eno1 interface with first default public address and a failover with second address.

I can create a virtual interface using a netplan called failover1 and works fine:

network:
    version: 2
    ethernets:
        eno1:
            dhcp4: true
            match:
                macaddress: xx:xx:xx:xx:xx:xx
            set-name: eno1
    bridges:
        failover1:
            addresses:
                - xxx.xxx.xxx.xxx/32
            dhcp4: true
root@server:~# ip addr
...
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
    inet xxx.xxx.xxx.xxx/24 brd xxx.xxx.xxx.xxx scope global dynamic eno1
       valid_lft 86125sec preferred_lft 86125sec
...
4: failover1: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
    inet xxx.xxx.xxx.xxx/32 scope global failover1
       valid_lft forever preferred_lft forever

My virtual machine works fine using the default nat network:

<network>
  <name>default</name>
  <uuid>...</uuid>
  <forward mode='nat'/>
  <bridge name='virbr0' stp='on' delay='0'/>
  <mac address='xx:xx:xx:xx:xx:xx'/>
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.2' end='192.168.122.254'/>
    </dhcp>
  </ip>
</network>

When navigate using a web browser use the primary public address, but need use the secondary address only.

I try creating a phisical brigde using:

<network>
    <name>bridged-network</name>
    <forward mode="bridge" />
    <bridge name="failover1" />
</network>

But virtual machine has not internet access, but from host using wget works fine:

wget -qO- http://checkip.dyndns.com/ --bind-address xxx.xxx.xxx.xxx
<html><head><title>Current IP Check</title></head><body>Current IP Address: xxx.xxx.xxx.xxx</body></html>

I try using a passthrout but does not work:

 <network>
   <name>passthrough</name>
   <forward mode='hostdev' managed='yes'>
     <pf dev='failover1'/>
   </forward>
 </network>
root@server:~# virsh net-start passthrough
error: Failed to start network passthrough
error: internal error: No usable Vf's present on SRIOV PF failover1

I try using direct network device in mode vepa and brigde:

<interface type='direct'>
  <source dev='failover1' mode='vepa'/>
</interface>

But does not have internet connection from vm.

How to set the specific failover address or interface to the virtual machine?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.