github.com/candidpartners/terraform@v0.9.5-0.20171005231213-29f5f88820f6/examples/alicloud-ecs-nat/userdata.sh (about) 1 #!/bin/sh 2 3 PostRouting=${vswitch_cidr} 4 SourceRouting=`ifconfig eth0|grep inet|awk '{print $2}'|tr -d 'addr:'` 5 echo ${worker_private_ip}>> /etc/sysctl.conf 6 echo 'net.ipv4.ip_forward=1'>> /etc/sysctl.conf 7 sysctl -p 8 iptables -t nat -I POSTROUTING -s $PostRouting -j SNAT --to-source $SourceRouting 9 iptables -t nat -I PREROUTING -d $SourceRouting -p tcp --dport 80 -j DNAT --to ${worker_private_ip}