Last active
March 10, 2021 18:26
-
-
Save pedrolamas/47e49d44ea885947a3fce69166238f2f to your computer and use it in GitHub Desktop.
Script to fix Docker iptables on Synology NAS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
start() { | |
iptables -t nat -N DOCKER | |
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 | |
} | |
stop() { | |
iptables -t nat -D PREROUTING -m addrtype --dst-type LOCAL -j DOCKER | |
iptables -t nat -D PREROUTING -m addrtype --dst-type LOCAL ! --dst 127.0.0.0/8 -j DOCKER | |
} | |
status() { | |
iptables -t nat -L PREROUTING | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart) | |
stop | |
start | |
;; | |
status) | |
status | |
;; | |
*) | |
echo "Usage: $0 {start|stop|status|restart}" | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
First, SSH into your Synology, then use
sudo su -
to enter sudo mode.Finally, run the following commands to download the script and set the appropriate permissions: