Create a gist now

Instantly share code, notes, and snippets.

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