From a8a738870c0be813c05d76d05afad259bdf3e46b Mon Sep 17 00:00:00 2001 From: TRaSH Date: Thu, 6 Jul 2023 20:15:35 +0200 Subject: [PATCH] fix(backed): Synology docker iptables-fix.sh --- docs/Hardlinks/How-to-setup-for/Synology.md | 28 +++------------------ includes/hardlinks/docker-iptables-fix.sh | 28 +++++++++++++++++++++ 2 files changed, 31 insertions(+), 25 deletions(-) create mode 100644 includes/hardlinks/docker-iptables-fix.sh diff --git a/docs/Hardlinks/How-to-setup-for/Synology.md b/docs/Hardlinks/How-to-setup-for/Synology.md index 34344ec3a..1608d9b41 100644 --- a/docs/Hardlinks/How-to-setup-for/Synology.md +++ b/docs/Hardlinks/How-to-setup-for/Synology.md @@ -375,28 +375,6 @@ To fix this, you will need to add a Scheduled Task that executes at boot with ro ??? question "Task bash command - [CLICK TO EXPAND]" - ```bash - #!/bin/bash - currentAttempt=0 - totalAttempts=10 - delay=15 - - while [ $currentAttempt -lt $totalAttempts ] - do - currentAttempt=$(( $currentAttempt + 1 )) - echo "Attempt $currentAttempt of $totalAttempts..." - result=$(iptables-save) - 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 "Done!" - - break - fi - echo "Docker rules not found! Sleeping for $delay seconds..." - sleep $delay - done - ``` + ```bash + --8<-- "includes/hardlinks/docker-iptables-fix.sh" + ``` diff --git a/includes/hardlinks/docker-iptables-fix.sh b/includes/hardlinks/docker-iptables-fix.sh new file mode 100644 index 000000000..6a96720b8 --- /dev/null +++ b/includes/hardlinks/docker-iptables-fix.sh @@ -0,0 +1,28 @@ +#!/bin/bash +currentAttempt=0 +totalAttempts=10 +delay=15 + +while [ $currentAttempt -lt $totalAttempts ] +do + currentAttempt=$(( $currentAttempt + 1 )) + + echo "Attempt $currentAttempt of $totalAttempts..." + + result=$(iptables-save) + + 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 "Done!" + + break + fi + + echo "Docker rules not found! Sleeping for $delay seconds..." + + sleep $delay +done \ No newline at end of file