I have openSuse 11.4 on my notebook.
I use Network Manager due to using lots of WLANs.
For testing and development I use Virtual Machine Manager and virsh to setup and start/stop kvm images.
Those images usually have an interface for NAT internet access and one or more interfaces to communicate with each other.
Network Manager is running fine. Switching connectivity works well.
The Virtual Machine Manager networks also run fine. VMs can access the internet and talk to eachother.
But as soon as the Network Manager changes something (e.g other WLAN, or reconnect due to WLAN was out of reach) the VMs loose (at least) their internet connection.
I see that the hosts firewall rules for them are lost. Not sure if this is all.
If I restart the virtual interfaces and add them to the bridge manually, all is fine again.
How can I prevent the Network Manager from destroying the firewall rules and bridges related to the VMs?
P.S.: will provide the related commands and output soon…
>
> Just in case someone has the same problem: This is the script I wrote to
> restore the network connectivity.
>
> It would already help me a bit if I could find a Network Manager hook
> where I can run this script. Ideas?
When an interface is brought up/down by Network Manager, the scripts in
/etc/NetworkManager/dispatcher.d/
are called with two arguments:
interface (wlan0, eth0, etc)
action (up, down, vpn-down, etc)
If you put your script there it should be run automatically. I had to do
this approach to make Network Manager keep a fixed ip address.
In the meantime I found out that I can just enable masquerading on the host to have the same effect.
The firewall rules set by libvirt are still destroyed, but the more general rules for masquerading do the same job, so no harm done.
Now I can let libvirtd autostart my bridges for the virtual machines (until now I had to manually start them after the normal network was active) and let network manager switch my external connection as needed. My vm’s just keep their connction: Great!