Last active
June 10, 2019 20:02
-
-
Save ggerogery/54c45797d136d9b0857c502a2e22cea3 to your computer and use it in GitHub Desktop.
docker-ipsec.sh
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 | |
for DOCKER_INET in $(ip a|grep docker|grep inet|awk '{print $2}') ; do | |
iptables -j SNAT -t nat -I POSTROUTING 1 \ | |
-o $(ip a|grep -e "10.9.9.[0-9]\+"| sed -e "s/.*global //g") \ | |
-d 10.9.9.0/24 \ | |
-s ${DOCKER_INET} \ | |
--to-source $(ip a|grep -o -e '10.9.9.[0-9]\+') | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment