Guía PS2: jugar compartiendo conexion con la misma config. en win y en linux

Lo primero que tienes que hacer es copiar el script en un archivo de texto con el que tu uses ( KWrite) y ponerle el nombre que quieras. Lo guardas en home/tunombre ( en linux).

Abres la consola y haces...
#su
tucontraseña

chmod 777 nombredelarxivoque has hecho ( esto es para dar permiso de ejecución)

./nombredelarxivo start

y ahora pondra starting firewall.
YA ESTÁ!


el script:

#!/bin/sh
#. /etc/rc.config

IPTABLES="/sbin/iptables"
IP_PUBLICA="`/sbin/ifconfig eth0 | grep 'inet addr' | awk '{print $2}' | sed -e 's/.*://'`"


case "$1" in
start)
echo "Starting firewall"
/sbin/depmod -a
echo "1" > /proc/sys/net/ipv4/ip_forward
/sbin/ifconfig eth1 down
/sbin/ifconfig eth1 192.168.0.1 netmask 255.255.255.0
$IPTABLES -P INPUT ACCEPT
$IPTABLES -P FORWARD ACCEPT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -t nat -P PREROUTING ACCEPT
$IPTABLES -t nat -P POSTROUTING ACCEPT
$IPTABLES -t nat -P OUTPUT ACCEPT
$IPTABLES -F
$IPTABLES -t nat -F
$IPTABLES -X
$IPTABLES -t nat -X
$IPTABLES -t nat -A POSTROUTING -o eth0 -j SNAT --to-source $IP_PUBLICA
;;
stop)
echo "Stoping firewall"
echo "0" > /proc/sys/net/ipv4/ip_forward
#echo -e "$return"

;;
restart)
$0 stop
$0 start
;;
status)
valor=`cat /proc/sys/net/ipv4/ip_forward`
if [ $valor -eq 1 ]; then
echo -n "Firewall is "
echo -e "running"
elif [ $valor -eq 0 ]; then
echo -n "Firewall is "
echo -e "stoped"
fi
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac

exit 0


GUÍA POR ROTPUNK PUBLICADA POR MUSICE.
Gracias rotpunk!
uuuu xD cuanta gente usa linux con ps2 xD :-P
weno, pos yo si ala :P
1 respuesta