-
-
Save maurotdo/1e296edf74fd4e9c60d7 to your computer and use it in GitHub Desktop.
Port forwarding verso un Docker container
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
Scenario: OSX, un servizio in ascolto su di un container docker | |
Avviare il container docker esponendo le porte | |
$ docker run -d -P memcached | |
Abilitare il packet forwarding | |
$ sysctl -w net.inet.ip.forwarding=1 | |
Configurare pf (es. pf.conf) | |
EXT_IF="en3" | |
INT_IF="vboxnet1" | |
EXP_IP = maggi.client.rete.loc | |
EXT_PORT = 11211 | |
DOCKER_IP = 192.168.59.103 | |
DOCKER_PORT = 49153 | |
rdr pass on $EXT_IF inet proto { tcp, udp } from any to $EXT_IP port $EXT_PORT -> $DOCKER_IP port $DOCKER_PORT | |
nat on $INT_IF from any to $DOCKER_IP -> ($INT_IF) | |
Abilitare caricare le regole in pf | |
$ pfctl -v -f pf.conf | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment