Last active
September 5, 2020 17:31
-
-
Save jeansf/5645c5fc35697944db1ec2a2978ffe4f to your computer and use it in GitHub Desktop.
BBB Support
This file contains 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
PIP=111.111.111.111 | |
DIP=222.222.222.222 | |
iptables -t nat -A OUTPUT -j DNAT -d $PIP --to-destination $DIP |
This file contains 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
CID=bbb | |
PS=16384 | |
PE=32768 | |
CIP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $CID) | |
echo "Ports: $PS:$PE/udp redirect to IP Container: $CIP" | |
iptables -A DOCKER -t nat -p udp -m udp ! -i docker0 --dport $PS:$PE -j DNAT --to-destination $CIP:$PS-$PE | |
iptables -A DOCKER -p udp -m udp -d $CIP/32 ! -i docker0 -o docker0 --dport $PS:$PE -j ACCEPT | |
iptables -A POSTROUTING -t nat -p udp -m udp -s $CIP/32 -d $CIP/32 --dport $PS:$PE -j MASQUERADE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment