Re: set a different default gateway in an isolated network

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

 



On 02/06/2016 04:16 PM, pichon wrote:
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 ?

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
10.0.0.0        10.10.0.7       255.0.0.0       ?     ?      ?      ?   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 10.0.0.0/8. A default gateway is for traffic with a destination of 0.0.0.0/0, i.e. anything that doesn't match any other route in the routing table.)


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<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@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvirt-users

_______________________________________________
libvirt-users mailing list
libvirt-users@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvirt-users




[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux