|while [ $currentAttempt -lt $totalAttempts ]|
|currentAttempt=$(( $currentAttempt + 1 ))|
|echo "Attempt $currentAttempt of $totalAttempts..."|
|if [[ $result =~ "-A DOCKER -i docker0 -j RETURN" ]]; then|
|echo "Docker rules found! Modifying..."|
|iptables -t nat -A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER|
|iptables -t nat -A PREROUTING -m addrtype --dst-type LOCAL ! --dst 127.0.0.0/8 -j DOCKER|
|echo "Docker rules not found! Sleeping for $delay seconds..."|
The script will run after every reboot and should survive any updates of DSM!
Please check the following post:
I transferred my perfectly working linuxserver/swag container (I love it!) from Debian to Synology NAS and ran into the same issue.
Pedrolamas' solution solved my first fail2ban problem with 172.17.0.1 host in nginx access.log.
Now fail2ban tries to ban the correct external IP. The word "tries" points to the next problem. But that's stuff for next weekend.
@pedrolamas many thanks for the script. It helped me a lot. I had to make some adaptions to it as some default iptable rules seems to miss in my system (I use default config, noting special here, quite strange...). So if someone else has problems with the script please try the following one. It is nearly the same but just waits for another iptable rule.
This one was tested under Synology DSM 6.2.4-2556 on a 916+