summaryrefslogtreecommitdiff
path: root/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S22iptables
diff options
context:
space:
mode:
authorUlf Samuelsson <ulf.samuelsson@atmel.com>2007-07-29 07:17:01 +0000
committerUlf Samuelsson <ulf.samuelsson@atmel.com>2007-07-29 07:17:01 +0000
commitb32a95eced1d0f22be1751467ff365117e200f3f (patch)
tree7b968f96d4cf05704a84881272e00a92431c9c7c /target/device/Atmel/atngw100/target_skeleton/etc/init.d/S22iptables
parentafd718e7cd831503d7485e7e291bcd336e6a2789 (diff)
Add atngw100 target
Diffstat (limited to 'target/device/Atmel/atngw100/target_skeleton/etc/init.d/S22iptables')
-rwxr-xr-xtarget/device/Atmel/atngw100/target_skeleton/etc/init.d/S22iptables43
1 files changed, 43 insertions, 0 deletions
diff --git a/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S22iptables b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S22iptables
new file mode 100755
index 000000000..dff63c200
--- /dev/null
+++ b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S22iptables
@@ -0,0 +1,43 @@
+#!/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 > /dev/null 2> /dev/null; 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 > /dev/null 2> /dev/null; then
+ echo "done"
+else
+ echo "failed"
+ exit 1
+fi
+
+echo -n " iptables outgoung trafic: "
+if ${IPTABLES} -A FORWARD -i eth1 -o eth0 -j ACCEPT > /dev/null 2> /dev/null; then
+ echo "done"
+else
+ echo "failed"
+ exit 1
+fi
+
+exit 0