[libvirt-users] set a different default gateway in an isolated network

pichon
2016-02-06T21:16:03Z

Hello,

I would like to set a specify default gateway for my VMs. However I’m not
succeeding

Here after is the isolated lan, where I added the statement   <route
address='10.0.0.0' prefix='8' gateway='10.10.0.7’/> where
my aim is to route to the 10.10.0.7

What should I do , to make it works ?

Thanks

<network>
 <name>prd-private-lan</name>
 <uuid>255083f4-05a1-4a24-bc66-d3a3a9ab0724</uuid>
 <bridge name='virbr3' stp='off' delay='0'/>
 <mac address='52:54:00:08:1e:d8'/>
 <domain name='prd.pipiche.net'/>
 <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='52:54:10:b6:35:ca'  ip='10.10.0.3'/>
     <host mac='52:54:10:5f:92:05'  ip='10.10.0.7'/>
     <host mac='52:54:10:7d:3a:3f'  ip='10.10.0.10'/>
     <host mac='52:54:10:30:93:56'  ip='10.10.0.21'/>
     <host mac='52:54:10:78:c1:c2'  ip='10.10.0.22'/>
     <host mac='52:54:10:64:00:21'  ip='10.10.0.25'/>
     <host mac='52:54:10:5a:5f:63'  ip='10.10.0.26'/>
     <host mac='52:54:10:4c:b2:61'  ip='10.10.0.27'/>
     <host mac='52:54:10:62:de:5f' ' ip='10.10.0.62'/>
   </dhcp>
 </ip>
 <route address='10.0.0.0' prefix='8'
gateway='10.10.0.7'/>
</network>

When looking on the VM (guest) the route is not correctly set

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

arp -a
? (10.10.0.1) at 52:54:00:08:1e:d8 [ether] on ensue


ifconfig
ens4: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
       inet 10.10.0.27  netmask 255.255.255.0  broadcast 10.10.0.255
inet6 fe80::5054:10ff:fe4c:b261 prefixlen 64 scopeid 0x20
       ether 52:54:10:4c:b2:61  txqueuelen 1000  (Ethernet)
       RX packets 1805  bytes 153644 (150.0 KiB)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 1745  bytes 136075 (132.8 KiB)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0