Issue:
Both the Host machine and VM built with CentOS 6.10. The ExternalMachine⇔VM is routed by using the nat function of Host iptables. As a problem, iptables have started("service iptables status") after restarting the Host machine or turning on the power, but it is not possible for us to route to the VM that has been automatically started. After this phenomenon, restarting iptables("service iptables restart") passes all routing.
Both iptables and VM are running and iptables settings are as expected.
I have no idea why its not possible to route to the VM. I would be grateful If you could teach me what is the problem.
---------AutostartSetting/StopSetting------------
# vi /etc/sysconfig/libvirt-guests
START_DELAY=30
ON_SHUTDOWN=shutdown
SHUTDOWN_TIMEOUT=180
# virsh autostart <VM NAME>
-----OS-------
cat /etc/redhat-release
CentOS release 6.10 (Final)
----kvm----
qemu-kvm-0.12.1.2-2.506.el6_10.5.x86_64
additional info:
---------------
#virsh net-edit default
<network>
<name>default</name>
<uuid>1d4f2476-0da2-45d5-b97f-xxxxxxxxxxx</uuid>
<forward mode='nat'/>
<bridge name='virbr0' stp='off' delay='0' />
<mac address='XX:XX:XX:XX:XX:XX'/>
<ip address='1.2.3.4' netmask='255.255.255.0'>
</ip>
</network>
-----------------
After confirming it, the startup order of Host daemons are as below.
1.iptables 2.network 3.qemu-ga 4.libvirtd 5.libvirt-guest
libvirt depends on network and network depends on iptables The order of chkconfig could not be changed. In this case, should I have the iptables restart script run at the end of chkconfig, or have anacron restart iptables? or Do you have any other way to archieve it?