[libvirt-users] routed mode

Laine Stump laine at laine.org
Mon May 19 12:29:43 UTC 2014


On 05/17/2014 11:06 PM, JvR O wrote:
> /etc/sysctl.conf
> net.ipv4.ip_forward = 1
>
> centos 65 host has static private ip 192.168.1.15
> I have added a route
>
> ip route add 192.168.1.0/24 <http://192.168.1.0/24> via 192.168.1.15
>
> but each time I use 'service network restart' the new route disappears

In general adding a route with the "ip" commandline utility will only
make that change temporarily.

At any rate, it's not the virtualization host that needs a route added
(there will already be a direct route for that added when the bridge is
created), but *all the other machines on your network* (or at least the
default router) that will need a route added. (Or possibly I've
misunderstood the mistake you made, and you actually tried to enter the
above route on some other machine on the network, not the virtualization
host itself. In that case, the reason it didn't work when you first
added the route is because you have the wrong destination)


For example, if your virtualization host has a physical ethernet adapter
at 10.0.0.40, and you've created a libvirt network with forward
mode='route' and an ip address of 192.168.20.1, all other hosts on the
physical network will need to know how to get to machines on the
192.168.20.1 network; this is done by adding a route equivalent to this
on (at least) the default router for the 10.0.0.0 network:

    destination 192.168.20.0/24
    gateway: 10.0.0.40

Likewise, on any other subnet that isn't on the far side of a NAT
gateway, you will need to add a route with destination 192.168.20.0/24
with the gateway being the local-subnet IP address of some router that
is also connected to the 10.0.0.0 network.

Beyond this short explanation, this really is a straight networking
question, not virtualization-related, so you could be better serviced by
looking up some IP routing FAQs.


> anyway I have made a ping before restarting the network and is still
> not working

Because the machines out on the physical network do not have access to
the routing table on your virtualization host, and have no idea where
192.168.1.15 is anyway. The rule for a useful route is that the
destination should be some subnet that none of the local machine's
interfaces are directly connected to, and the gateway must be an address
that *is* on a subnet directly connected to one of the machine's interfaces.

>
> Thank you.
>
>
> 2014-05-15 12:23 GMT+02:00 Sven Schwedas <sven.schwedas at tao.at
> <mailto:sven.schwedas at tao.at>>:
>
>     On 2014-05-15 12:10, JvR O wrote:
>     > Why is not working?
>
>     . sysctl ? ip_forward?
>
>     . Target hosts have a correct route to your new subnet?
>
>
>     --
>     Mit freundlichen Grüßen, / Best Regards,
>     Sven Schwedas
>     Systemadministrator
>     TAO Beratungs- und Management GmbH | Lendplatz 45 | A - 8020 Graz
>     Mail/XMPP: sven.schwedas at tao.at <mailto:sven.schwedas at tao.at> |
>     +43 (0)680 301 7167 <tel:%2B43%20%280%29680%20301%207167>
>     http://software.tao.at
>
>
>     _______________________________________________
>     libvirt-users mailing list
>     libvirt-users at redhat.com <mailto:libvirt-users at redhat.com>
>     https://www.redhat.com/mailman/listinfo/libvirt-users
>
>
>
>
> _______________________________________________
> libvirt-users mailing list
> libvirt-users at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20140519/f5461a05/attachment.htm>


More information about the libvirt-users mailing list