Credits to @smartynov for his solution which I just edited minorly.
The following script lets you reload the network interface and defined iptables without a reboot.
I have added two commands which will clear all ip table rules for PRE- and POST-Routing before executing the reload thus effectively reloading these rules too instead of just appending specified rules to the old ones.
If you want to reload other types of iptables entries just replace the second or third line to your liking.
The following script lets you reload the network interface and defined iptables without a reboot.
I have added two commands which will clear all ip table rules for PRE- and POST-Routing before executing the reload thus effectively reloading these rules too instead of just appending specified rules to the old ones.
If you want to reload other types of iptables entries just replace the second or third line to your liking.
Code:
#!/bin/bash
iptables -t nat -F PREROUTING
iptables -t nat -F POSTROUTING
/etc/init.d/networking restart
grep -FH bridge= /etc/pve/nodes/*/qemu-server/*.conf \
| perl -nle 'print "fwpr$1p$2 master $3" if /\/(\d+).conf:net(\d+):.*?bridge=(vmbr\d+)/' \
| xargs -l1 ip link set
Last edited: