Skip to content

Instantly share code, notes, and snippets.

@arbo-hacker
Created February 1, 2016 20:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arbo-hacker/09a7e0c04c9daf17702f to your computer and use it in GitHub Desktop.
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
#!/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