Nimm mal das Script. Nach "/ets/init.d/simplerouter.sh" speichern und mit "scriptname start" aufrufen.
Die Interfaces und ip's natürlich noch anpassen.
[code:1]
#!/bin/bash
# file: simplerouter.sh
# description: a very simple router for dialup connection server
OFACE=ppp0 # dein interface zum Internet (meist ppp0, oder ippp0)
NETIP=10.0.1.0/24 #Adressbereich für den der Zugang erlaubt ist
xecho() #(text, x, y, fgColor, bold)
{
#set position if given
if [ $2 -ne -1 ] ; then
if [ $3 -ne -1 ] ; then
tput cup $3 $2
fi
fi
#set color if valid color is given
if [ "`echo $4|cut -c-6`" = "bright" ] ; then
color=`echo $4|cut -c7-`
pre_color_code="\033[01;3"
else
pre_color_code="\033[00;3"
color=$4
fi
case "$color" in
black) colorcode="${pre_color_code}0m";;
red) colorcode="${pre_color_code}1m";;
green) colorcode="${pre_color_code}2m";;
yellow) colorcode="${pre_color_code}3m";;
blue) colorcode="${pre_color_code}4m";;
lila) colorcode="${pre_color_code}5m";;
cyan) colorcode="${pre_color_code}6m";;
grey) colorcode="${pre_color_code}7m";;
*) colorcode="";;
esac
#print out the given string
printf "${colorcode}$1\033[00;00m"
#return and restore variables
return
}
statusexec() #(Msg, Exec, Result)
{
MsgLen=`echo -n $1|wc -c`
ScreenCols=`tput cols`
StatusLen=6
xecho " * " -1 -1 "brightgreen"
echo -n "$1"
execresult="`$2 2>&1`"
execreturn=$?
spacelen=`expr $ScreenCols \- \( 3 \+ $MsgLen \) \- \( $StatusLen \+ 1 \)`
printf "%${spacelen}s" ""
if [ $execreturn -ne $3 ] ; then
xecho "[ " -1 -1 "brightblue"
xecho "!!" -1 -1 "brightred"
xecho " ]\n" -1 -1 "brightblue"
echo $execresult
else
xecho "[ " -1 -1 "brightblue"
xecho "OK" -1 -1 "brightgreen"
xecho " ]\n" -1 -1 "brightblue"
fi
}
enable_routing()
{
statusexec "Setze net.ipv4.ip_forward=1" "sysctl -w net.ipv4.ip_forward=1" 0
statusexec "Setze net.ipv4.ip_dynaddr=1" "sysctl -w net.ipv4.ip_dynaddr=1" 0
statusexec "Erstelle DROP IpTables Rule (NAT-->ppp0)" "iptables -t nat -A PREROUTING -i $OFACE -j DROP" 0
statusexec "Erstelle MASQUERADING IpTables Rule" "iptables -t nat -A POSTROUTING -o $OFACE -s $NETIP -j MASQUERADE" 0
}
disable_routing()
{
statusexec "Setze net.ipv4.ip_forward=0" "sysctl -w net.ipv4.ip_forward=0" 0
statusexec "Setze net.ipv4.ip_dynaddr=0" "sysctl -w net.ipv4.ip_dynaddr=0" 0
statusexec "Lösche DROP IpTables Rule (NAT-->ppp0)" "iptables -t nat -D PREROUTING -i $OFACE -j DROP" 0
statusexec "Lösche MASQUERADING IpTables Rule" "iptables -t nat -D POSTROUTING -o $OFACE -s $NETIP -j MASQUERADE" 0
}
echo "Very Simple Router for Dialup Connection Server"
case "$1" in
start) enable_routing ;;
stop) disable_routing ;;
*) echo -n "usage: "
xecho "$0 " -1 -1 "brightyellow"
xecho "start" -1 -1 "brightgreen"
echo -n "|"
xecho "stop\n" -1 -1 "brightred";;
esac
[/code:1]
Eine richtig gute FW findes du bei
http://firewall.lutel.pl/index.php.