set -x set -e export DEBIAN_FRONTEND="noninteractive" if [ ! -f /.testlab-raring-bootstrap ]; then # 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 pbzip2 touch /.testlab-raring-bootstrap fi # Ensure the default lxc networking services are off service lxc-net stop || (service lxc-net start ; 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