/etc/NetworkManager/dispatcher.d/01ifupdown somewhere at the end:
case "$2" in up) export MODE="start" export PHASE="up" if [ -d /var/run/network/ ] ; then tmpfile=`mktemp -t` if [ -e /var/run/network/ifstate ] ; then cat /var/run/network/ifstate | grep -v ^$IFACE= > $tmpfile || true fi echo $IFACE=$IFACE >> $tmpfile mv $tmpfile /var/run/network/ifstate fi exec run-parts /etc/network/if-up.d exec /etc/iptables.rules ;;
I run iptables.rules script, which is shell script containing something like this:
#!/bin/sh ... echo "restoring iptables..." /sbin/iptables-restore -v <<-EOF; *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -i $EXTIF -p ICMP -s $UNIVERSE -d $EXTIP -j ACCEPT COMMIT EOF
If I run this script from shell then I can see the rule is added. However, after startup the rule is not there. /var/log/messages doesn't show anything, I'm not even sure if the echo from script should be visible there or somewhere else.