.:Hledání:.



Pripojeni pres GPRS / Nasdileni pripojeni


Hlasování: 2.8 (19)   +-


Autor: Sinker
nasdileni pripojeni

<net_share.sh>


#!/bin/sh
echo "sdileni"

IPTABLES=/sbin/iptables

if [ "$1" ]
then
EXTIF=$1
else
EXTIF="ppp0"
fi


if [ "$2" ]
then
INTIF=$2
else
INTIF="eth0"
fi


INTIP="192.168.1.1"

# nastaveni ip adresy na internim zarizeni
ifconfig $INTIF $INTIP

echo "1" > /proc/sys/net/ipv4/ip_forward

$IPTABLES -P FORWARD DROP
$IPTABLES -F FORWARD
$IPTABLES -t nat -F

$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT
$IPTABLES -A FORWARD -j LOG

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



echo "EXTERNI SIT: $EXTIF se sdili na VNITRNI SIT: $INTIF - IP: $INTIP"


# nameservery
cat /etc/resolv.conf | grep nameserver



pripojeni pres GPRS

<gprs.sh>


#bin/sh

sudo rfcomm release rfcomm0

# n80 00:12:d2:64:6e:f1
# nevim 00:16:20:0F:A5:2E
# sinker97 00:26:69:6b:58:d8

mac="00:26:69:6b:58:d8 22"
sudo rfcomm connect rfcomm0 $mac &
sudo ln -s /dev/rfcomm0 /dev/modem

sleep 8


sudo kppp &

sleep 20

# jak zjisti kanal - sdptool search dun
# jak zjistit mac adresu - hcitool scan

#nastaveni sdileni
. /home/sinker/scripts/net_share.sh ppp0 eth0