#!/bin/sh

################################################
# insert your lan_ip_range and inet_iface here #
################################################
LAN_IP_RANGE="192.168.0.0/24"
INET_IFACE="ppp0"
IPTABLES="/sbin/iptables"

######################################################
# uncomment 'poff dsl-provider' (next line) and      #
# 'pon dsl-provider' (in the end of this file) lines #
# if you want ETC to manage your ppp-connection      #
# (recommended)                                      #
######################################################
#poff dsl-provider
$IPTABLES -F
$IPTABLES -t nat -F
$IPTABLES -t mangle -F
$IPTABLES -X
$IPTABLES -t nat -X
$IPTABLES -t mangle -X

$IPTABLES -P FORWARD DROP
$IPTABLES -P INPUT ACCEPT
$IPTABLES -P OUTPUT ACCEPT

$IPTABLES -I INPUT -p tcp -s 127.0.0.1 --dport 0:1023 -j ACCEPT
$IPTABLES -A INPUT -p tcp -i $INET_IFACE -s $LAN_IP_RANGE -j DROP
$IPTABLES -A INPUT -p tcp -s! $LAN_IP_RANGE --dport 0:1023 -j DROP

$IPTABLES -t nat -A POSTROUTING -o $INET_IFACE -j MASQUERADE

#modprobe  ip_conntrack_ftp
modprobe ip_nat_ftp
sysctl -w kernel.printk="4 1 1 7"
sysctl -w net.ipv4.ip_forward=1

rm /media/log/*
umount /media/log
mount -t ramfs none /media/log -o maxsize=10000
#pon dsl-provider
