echo "1" > /proc/sys/net/ipv4/ip_forward
echo "0" > /proc/sys/net/ipv4/conf/all/send_redirects
echo "0" > /proc/sys/net/ipv4/conf/default/send_redirects
echo "0" > /proc/sys/net/ipv4/conf/eth0/send_redirects
# IP_SG_ZEWN is an external IP address assigned automatically by VMWARE for eth0
# this address can be found in the result of "ip a s dev eth0" command line cosnsisting "inet" word
# CAUTION 192.168.47.129 needs to be changed to eth0 external address.
IP_SG_ZEWN=192.168.47.111
IP_SW1=192.168.1.100
IP_SW2=192.168.1.200
IP_NET_LOCAL=192.168.1.0/24
ipvsadm -C
#ipvsadm -A -t $IP_SG_ZEWN:www -s rr
#ipvsadm -a -t $IP_SG_ZEWN:www -r $IP_SW1:www -m -w 1
#ipvsadm -a -t $IP_SG_ZEWN:www -r $IP_SW2:www -m -w 1
#ipvsadm
iptables -t nat --flush
iptables -t nat -A POSTROUTING -s $IP_NET_LOCAL -d 0.0.0.0/0 -j SNAT --to-source $IP_SG_ZEWN
iptables -L -t nat -n