kumquat-buildroot/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S22iptables
2007-08-17 13:01:49 +00:00

44 lines
715 B
Bash
Executable File

#!/bin/sh
IPTABLES=`which iptables`
echo "Enable NAT:"
echo -n " IPv4 forwarding: "
if echo 1 > /proc/sys/net/ipv4/ip_forward; then
echo "done"
else
echo "failed"
return 1
fi
echo -n " iptables postrouting: "
if [ ! -x "${IPTABLES}" ]; then
echo "missing"
exit 1
fi
if ${IPTABLES} -t nat -A POSTROUTING -o eth0 -j MASQUERADE; then
echo "done"
else
echo "failed"
exit 1
fi
echo -n " iptables incoming trafic: "
if ${IPTABLES} -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT; then
echo "done"
else
echo "failed"
exit 1
fi
echo -n " iptables outgoung trafic: "
if ${IPTABLES} -A FORWARD -i eth1 -o eth0 -j ACCEPT; then
echo "done"
else
echo "failed"
exit 1
fi
exit 0