0

Is there a way to automatically add a host route (pointing to the VM IP) when VM starts ? ATM I'm doing this by hand. I've also tried to add a route via /etc/sysconfig/network-scripts/route-virbr0 file, but it doesn't work, probably due to the fact that I don't have the appropriate ifcfg-virbr0 file.

Adding just a static route pointing to the VM doesn't work for obvious reason - there's no appropriate network interface (virbr0) when the host enters the multiuser mode, so route addition just fails.

1

If you're using libvirt, you can add static routes in the libvirt network XML.

For example:

  <route address="192.168.222.0" prefix="24" gateway="192.168.122.2"/>

  <route family="ipv6" address="2001:db8:ca2:3::" prefix="64" gateway="2001:db8:ca2:2::2"/>

Now libvirt will bring up the routes when it activates the virtual network.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.