Hello,
I am running Merlin Firmware Version: 384.18 on RT-AC68U
I want to allow only IPs from UptimeDoctor in order to check my Internet Connection every 60 seconds (1 minute interval) using ICMP (ping)
here is script I am using /jffs/scripts/ddns-start
Do you have any idea, why this rule keeps disappearing from iptables, it seems that router is deleting this ipset list on its own, for no reason?
Suggestions are welcome, in order to improve script and get this working stable. Thank you!
I am running Merlin Firmware Version: 384.18 on RT-AC68U
I want to allow only IPs from UptimeDoctor in order to check my Internet Connection every 60 seconds (1 minute interval) using ICMP (ping)
here is script I am using /jffs/scripts/ddns-start
Code:
#!/bin/sh
#whitelist uptimedoctor IPv4 for ICMP
curl https://www.uptimedoctor.com/de/network.php?type=xml > /mnt/sda1/router/uptimedoctor-raw.txt
cat /mnt/sda1/router/uptimedoctor-raw.txt | grep -oE '((1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])' > /mnt/sda1/router/uptimedoctor-ipv4.txt
sed -i -e 's/^/add uptimedoctor /' /mnt/sda1/router/uptimedoctor-ipv4.txt
if (ipset list | grep -c uptimedoctor)
#if the keyword is in the conent
then
echo "ipset list uptimedoctor found"
else
ipset create uptimedoctor hash:ip
fi
ipset restore -! < /mnt/sda1/router/uptimedoctor-ipv4.txt
if (iptables -nL | grep -c uptimedoctor)
#if the keyword is in the conent
then
echo "uptimedoctor found in iptables"
else
iptables -I INPUT -p icmp -m set --match-set uptimedoctor src -j ACCEPT
fi
#remove iptables rule and delete uptimedoctor ipset
#iptables -D INPUT -p icmp -m set --match-set uptimedoctor src -j ACCEPT
#ipset destroy uptimedoctor
Do you have any idea, why this rule keeps disappearing from iptables, it seems that router is deleting this ipset list on its own, for no reason?
Suggestions are welcome, in order to improve script and get this working stable. Thank you!