Created
March 17, 2016 07:49
-
-
Save teopeurt/acd7e94715e8d6164050 to your computer and use it in GitHub Desktop.
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 | |
CONTAINER=$2 | |
HOSTPORT=$1 | |
CONTAINERPORT=$3 | |
container_ip=$(lxc info $CONTAINER | grep 'eth0' | head -n1 | awk '{print $3}') | |
iptables -t nat -A PREROUTING -p tcp -i eth0 --dport $HOSTPORT -j DNAT \ | |
--to-destination $container_ip:$CONTAINERPORT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sudo sh lxdip.sh public_port container_name container_port