[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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

On 02/06/2016 04:16 PM, pichon wrote:

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='' prefix='8' gateway='’/> where my aim is to route to the

What should I do , to make it works ?

You've misunderstood the purpose of the <route> element in a network. That element is used to setup a route that will be added *to the host* when the network is started; guest routing tables are not affected (that would require a dhcp option, which you allude to in your later message on the same subject, and which isn't currently supported by libvirt).

If you look on the host after starting this network, you'll find that it has a route that looks like this:

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface       ?     ?      ?      ?   virbr3

This feature was added with the idea in mind of automatically setting up routes from the host to networks that are behind guests connected to a virtual network; the idea of automatically adding routes to guests who use DHCP to acquire their config is also a good one, but not what this feature does.

(btw, what you're trying to set isn't a "default gateway" either, it is just a route for traffic to A default gateway is for traffic with a destination of, i.e. anything that doesn't match any other route in the routing table.)


  <bridge name='virbr3' stp='off' delay='0'/>
  <mac address='52:54:00:08:1e:d8'/>
  <domain name='prd.pipiche.net'/>
    <forwarder addr=''/>
    <forwarder addr=''/>
  <ip address='' netmask=''>
      <range start='' end=''/>
      <host mac='52:54:10:b6:35:ca'  ip=''/>
      <host mac='52:54:10:5f:92:05'  ip=''/>
      <host mac='52:54:10:7d:3a:3f'  ip=''/>
      <host mac='52:54:10:30:93:56'  ip=''/>
      <host mac='52:54:10:78:c1:c2'  ip=''/>
      <host mac='52:54:10:64:00:21'  ip=''/>
      <host mac='52:54:10:5a:5f:63'  ip=''/>
      <host mac='52:54:10:4c:b2:61'  ip=''/>
      <host mac='52:54:10:62:de:5f' ' ip=''/>
  <route address='' prefix='8' gateway=''/>

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

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

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

ens4: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet  netmask  broadcast
        inet6 fe80::5054:10ff:fe4c:b261  prefixlen 64  scopeid 0x20<link>
        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

libvirt-users mailing list
libvirt-users redhat com

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]