#!/bin/sh
# add to end of rc.local to activate at boot
# will allow a private network on eth1 access to corporate/internet netork on eth0
# great for maintaining the same private network settings on laptops
# no need to change network settings going back and forth to work
#

/sbin/modprobe iptable_nat
/sbin/iptables -A POSTROUTING -t nat -o eth0 -s 192.168.1.0/24 -d 0/0 -j MASQUERADE
/sbin/iptables -A FORWARD -t filter -i eth1 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
/sbin/iptables -A FORWARD -t filter -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT

echo 1 > /proc/sys/net/ipv4/ip_forward