I am having an issue. I "reset" the firewall to "factory defaults" in virtualizor. It deleted all of the forwarding rules in my IPtables. If I stop and start a VM it adds the rules back. Does anybody know how to rebuild the IPtables with rules for all of the VMs without rebooting my 2 servers with many, many clients on them?
Perhaps a variant of this:
Code #!/bin/bash
xm list | perl -alne 'next if not $F[1] > 0 ; print "@F[0,1]"' | while read VM ID
do
xm network-list $ID | perl -alne 'next if not $F[0] =~ m{^\d+$} ; print $F[0]' | while read IFID
do
VIF="vif$ID.$IFID"
echo iptables -A FORWARD -m physdev --physdev-in $VIF -s $VM -j ACCEPT
echo iptables -A FORWARD -m physdev --physdev-in $VIF -p udp --sport bootpc --dport bootps -j ACCEPT
done
done
|