Created
February 1, 2016 20:23
-
-
Save arbo-hacker/09a7e0c04c9daf17702f to your computer and use it in GitHub Desktop.
Como dar salida/entrada a internet a tu Container (LXC) de Proxmox 4
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
#!/bin/sh | |
case "$1" in | |
start) echo "Starting iptables NAT" | |
#----------------------------------------------------------------- | |
#START NAT ///////////////////////////// | |
#----------------------------------------------------------------- | |
/sbin/iptables -t nat -A POSTROUTING -s '10.0.0.0/24' -o vmbr0 -j MASQUERADE #BRIDGE | |
#VM 100-----------+ | |
/sbin/iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 1022 -j DNAT --to 10.0.0.1:22 | |
/sbin/iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 80 -j DNAT --to 10.0.0.1:80 | |
;; | |
stop) echo "Stopping iptables NAT" | |
#----------------------------------------------------------------- | |
#STOP NAT ///////////////////////////// | |
#----------------------------------------------------------------- | |
/sbin/iptables -t nat -D POSTROUTING -s '10.0.0.0/24' -o vmbr0 -j MASQUERADE #BRIDGE | |
#VM 100-----------+ | |
/sbin/iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 1022 -j DNAT --to 10.0.0.1:22 | |
/sbin/iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 80 -j DNAT --to 10.0.0.1:80 | |
;; | |
*) echo "Usage: /etc/init.d/nat-container.sh {start|stop}" | |
exit 2 | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment