set -x # Update APT and ensure our required packages are installed apt-get -y update apt-get -y install lxc bridge-utils debootstrap yum iptables ntpdate ntp sshpass # Ensure the default lxc networking services are off service lxc-net stop # Ensure NTP services are enabled and running service ntp restart || service ntp start # Enable ipv4 forwarding sysctl net.ipv4.ip_forward | grep "net.ipv4.ip_forward = 1" || sysctl -w net.ipv4.ip_forward=1 # Install an iptable NAT rule iptables -t nat --list -v | grep "MASQUERADE all -- any eth0 anywhere anywhere" || iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE