Skip to content

Instantly share code, notes, and snippets.

@ggerogery
Last active June 10, 2019 20:02
Show Gist options
  • Save ggerogery/54c45797d136d9b0857c502a2e22cea3 to your computer and use it in GitHub Desktop.
Save ggerogery/54c45797d136d9b0857c502a2e22cea3 to your computer and use it in GitHub Desktop.
docker-ipsec.sh
#!/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