[libvirt] route seems to be not affecting the network behavior

pichon patrick at pichon.me
Mon Feb 8 20:58:25 UTC 2016


Hello,

I’m trying to set a default gateway on an isolated lan (because one of my VM get access to an other lan).

I’m trying to use the option <route > but this doesn’t affect the default route on my VMs.

Here is the network xml


<network>
  <name>prd-private-lan</name>
  <uuid>2222222222222222222222</uuid>
  <bridge name='virbr3' stp='off' delay='0'/>
  <mac address='52:54:00:08:1e:d8'/>
  <domain name=‘pre' />
  <dns>
    <forwarder addr='8.8.4.4'/>
    <forwarder addr='8.8.8.8'/>
  </dns>
  <ip address='10.10.0.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='10.10.0.128' end='10.10.0.254’/>
      <host mac=‘xxxxxx' name=‘finternet.pret' ip='10.10.0.7'/>
    </dhcp>
  </ip>
  <route address='10.10.0.0' netmask='255.255.255.0' gateway='10.10.0.7'/>
</network>


And here is what I get on the guest VM connected to the pre-private-lan

route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.10.0.0       0.0.0.0         255.255.255.0   U     100    0        0 ens4


Can someone help me or tell me what to do ?

What I’m a bit surprise is the file //var/lib/libvirt/dnsmasq/prd-private-lan.conf doesn’t contain any clause defining the new gateway. Something like ‘dhcp-option=3,10.10.0.7'

strict-order
no-resolv
server=8.8.4.4
server=8.8.8.8
domain=prd.pipiche.net
expand-hosts
pid-file=/var/run/libvirt/network/prd-private-lan.pid
except-interface=lo
bind-dynamic
interface=virbr3
dhcp-option=3
no-resolv
dhcp-range=10.10.0.128,10.10.0.254
dhcp-no-override
dhcp-lease-max=127
dhcp-hostsfile=/var/lib/libvirt/dnsmasq/prd-private-lan.hostsfile
addn-hosts=/var/lib/libvirt/dnsmasq/prd-private-lan.addnhosts





Of course I can add an explicit route on the guest - so did I - but for maintenance purposes I would like to avoid and have all configuration in the network XML


Thanks in advance
Patrick




More information about the libvir-list mailing list