I just got
Code:
Failed to restart iptables-persistent.service: Unit iptables-persistent.service failed to load: No such file or directory.
pbxstatus
IPtables DN
Did this-
Code:
sed -i 's|service iptables-persistent|/etc/init.d/netfilter-persistent|' /root/add-ip
but
pbxstatus
IPtables DN still down
Should iptables-restart be changed as well with /etc/init.d/netfilter-persistent
Code:
root@raspberrypi3:~ $ cat ./iptables-restart
#!/bin/bash
service netfilter.persistent restart
TEST=`systemctl status netfilter-persistent.service | tail -1 | grep "failed"`
if [[ -z "$TEST" ]]; then
echo "No IPtables problems found."
echo "IPtables now running."
else
echo "Failed"
iptables-restore /etc/iptables/rules.v4 2>/tmp/errorfile
TEST=`cat /tmp/errorfile`
while [[ "$TEST" == *Error* ]]; do
LINENUM=`cat /tmp/errorfile | cut -f 2 -d ":" | tail -2 | head -n 1 | tr -d ' '`
FQDN=`cat /tmp/errorfile | cut -f 1 -d "'" | head -n 1 | cut -f 4 -d " "`
echo " "
echo "******** 10-SECOND WARNING ALERT ***********"
echo "IPtables FQDN problem on line: $LINENUM"
echo "The unresolvable FQDN is $FQDN."
echo "This rule will be temporarily disabled to allow IPtables to start."
echo "Check and correct line $LINENUM in /etc/iptables/rules.v4."
echo "******** 10-SECOND WARNING ALERT ***********"
echo " "
sed -i "$LINENUM s:^:#***:" /etc/iptables/rules.v4
sleep 10
service netfilter.persistent restart
TEST=`systemctl status netfilter-persistent.service | tail -1 | grep "failed"`
iptables-restore /etc/iptables/rules.v4 2>/tmp/errorfile
TEST=`cat /tmp/errorfile`
done
service netfilter-persistent restart
#sed -i 's|#\*\*\*||' /etc/iptables/rules.v4
echo "IPtables problems noted above were commented out."
echo "Fix the problems identified in /etc/iptables/rules.v4"
echo "IPtables now running without the offending rules(s)."
fi
service fail2ban restart
root@raspberrypi3:~ $
root@raspberrypi3:~ $ ./iptables-restart
Failed to restart netfilter.persistent.service: Unit netfilter.persistent.service failed to load: No such file or director y.
No IPtables problems found.
IPtables now running.
[/code]
Code:
root@raspberrypi3:~ $ service netfilter-persistent status
● netfilter-persistent.service - netfilter persistent configuration
Loaded: loaded (/lib/systemd/system/netfilter-persistent.service; enabled)
Active: active (exited) since Sun 2016-12-11 01:51:27 GMT; 1 day 22h ago
Main PID: 792 (code=exited, status=0/SUCCESS)
CGroup: /system.slice/netfilter-persistent.service
Dec 11 01:51:27 raspberrypi3 netfilter-persistent[783]: Automatic flush disabled; use '/usr/sbin/netfilter-persistent flush'
Dec 11 01:51:27 raspberrypi3 netfilter-persistent[792]: run-parts: executing /usr/share/netfilter-persistent/plugins.d/15-ip4tables start
Dec 11 01:51:27 raspberrypi3 netfilter-persistent[792]: run-parts: executing /usr/share/netfilter-persistent/plugins.d/25-ip6tables start
Dec 11 01:51:27 raspberrypi3 systemd[1]: Started netfilter persistent configuration.
Dec 11 02:11:44 raspberrypi3 systemd[1]: Started netfilter persistent configuration.
Code:
root@raspberrypi3:~ $ service netfilter-persistent --status
Usage: /etc/init.d/netfilter-persistent {start|restart|reload|force-reload|save|flush}
Got my /etciptables/rules.v4 running again after all lines had been disabled by the software prefixing #*** to every line. I downloaded the rules.v4 to win7 then using
npp I did a Replace of the "#***" to substitute "" Replace All; saved the file and uploaded it to the server using Webmin Upload and download/upload to /etc/iptables with the chown setting to root:root
Then a
and followed through with some double checking of the added stuff with /root/del-acct ; /root/add-fqdn ; and /root/add-ip .
Anyways iptables is now UP so for me that is now SOLVED.