This question is related to the answer & comment in What is kernel ip forwarding?
from @LawrenceC
post1:
So in the above example, if you have an internet connection on NIC 2, you'd set NIC 2 as your default route and then any traffic coming in from NIC 1 that isn't destined for something on 192.168.2.0/24 will go through NIC 2.
and also post2:
the internet-facing interface (NIC 1 per above) needs a MASQUERADE rule in iptables's POSTROUTING on a chain to do that. See revsys.com/writings/quicktips/nat.html
At http://www.revsys.com/writings/quicktips/nat.html it says:
Then you'll need to configure iptables to forward the packets from your internal network, on /dev/eth1, to your external network on /dev/eth0.
/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE /sbin/iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT /sbin/iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
Why I'd use FORWARD (according to post2) if the forward is already done by only setting ip_forward (according to post1):
echo 1 > /proc/sys/net/ipv4/ip_forward