#!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. ifconfig eth0:0 10.0.1.156 netmask 255.255.254.0 up ifconfig eth0:1 10.0.1.158 netmask 255.255.254.0 up iptables -t nat -F ##Add for DNAT & SNAT #iptables -t nat -A PREROUTING -j DNAT -i eth0 -d 10.0.1.156 --to 192.168.0.6 iptables -t nat -A PREROUTING -j DNAT -i eth0 -d 10.0.1.158 --to 192.168.0.8 #iptables -t nat -A POSTROUTING -j SNAT -o eth0 -s 192.168.0.6 --to 10.0.1.156 iptables -t nat -A POSTROUTING -j SNAT -o eth0 -s 192.168.0.8 --to 10.0.1.158 ##Add for loadbalance iptables -t nat -A POSTROUTING -j SNAT -o eth0 -s 192.168.0.7 --to 10.0.1.152 iptables -t nat -A POSTROUTING -j SNAT -o eth0 -s 192.168.0.6 --to 10.0.1.152 #iptables -t nat -A POSTROUTING -j SNAT -o eth0 -s 192.168.0.12 --to 10.0.1.152 #iptables -t nat -A POSTROUTING -j SNAT -o eth0 -s 192.168.0.13 --to 10.0.1.152 exit 0