#!/bin/sh
#
# Start the network....
#

case "$1" in
  start)
 	echo "Starting nat..."
	iptables -F; iptables -t nat -F; iptables -t mangle -F
	#-NAT: ROUTING start-
	#-NAT: ROUTING end-
	# eth0 -> wifi
	#iptables -t nat -A POSTROUTING -s 192.168.0.0/16 -o ra0 -j MASQUERADE
	# eth0 -> ppp0
	#iptables -t nat -A POSTROUTING -s 192.168.0.0/16 -o ppp0 -j MASQUERADE

	###configure port mapping
	#-NAT: MAPPING start-
	#-NAT: MAPPING end-
	#iptables -t nat -I PREROUTING -p tcp -i ppp0 --dport 4280 -j DNAT \
	#--to-destination 192.168.27.42:80
	#iptables -t nat -I PREROUTING -p tcp -i ppp0 --dport 4221 -j DNAT \
	#--to-destination 192.168.27.42:21
	
	#route add default ppp0	
	echo 1 > /proc/sys/net/ipv4/ip_forward
	
	;;
  stop)
	echo -n "Stopping nat..."
	iptables -F; iptables -t nat -F; iptables -t mangle -F
	echo 0 > /proc/sys/net/ipv4/ip_forward
	;;
  restart|reload)
	"$0" stop
	"$0" start
	;;
  *)
	echo $"Usage: $0 {start|stop|restart}"
	exit 1
esac

exit $?

