PPTP airos
De Guifi.net - Wiki Hispano
Tenemos que editar un archivo y crear 4 diferentes:
vi /var/tmp/system.cfg
ppp.1.name=USUARIO ppp.1.password=PASSWORD ppp.1.status=disabled ppp.status=disabled pptp.1.serverip=IP_SERVIDOR_PPTP pptp.status=enabled
Una vez editado, guardamos los cambios desde la raíz /var/tmp/
cfgmtd -w -p /etc/
Nos dirigimos a /etc/persistent/ , para ejecutar 2 líneas al arrancar la antena. Una deja el túnel y la segunda permite acceder a Internet desde la interfaz LAN, haciendo un MASQUERADING de la LAN.
vi /etc/persistent/rc.poststart
#!/bin/sh sh /etc/persistent/tunel iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -j MASQUERADE
vi /etc/persistent/tunel
#!/bin/sh cfg="/tmp/system.cfg" pptp=`cat $cfg |grep pptp.status=enabled` if [ ! -z $pptp ] then logger -t poststart "PPTP Enabled" logger -t poststart "Configuring PPPd" user=`cat $cfg | grep ppp.1.name= |sed s/ppp.1.name=//` pass=`cat $cfg | grep ppp.1.password= |sed s/ppp.1.password=//` serverIP=`cat $cfg | grep pptp.1.serverip= |sed s/pptp.1.serverip=//` wangw=`cat $cfg | grep route.1.gateway= |sed s/route.1.gateway=//` # echo "DEBUG: using username: $user password: $pass for $serverIP" echo "\"$user\" * \"$pass\"" > /etc/ppp/pap-secrets echo "\"$user\" * \"$pass\"" > /etc/ppp/chap-secrets cat << EOF > /etc/ppp/options.pptp lock noauth nobsdcomp nodeflate persist holdoff 5 EOF mkdir -p /etc/ppp/peers 2> /dev/null cat << EOF > /etc/ppp/peers/pptp pty "pptp $serverIP --nolaunchpppd" name $user defaultroute remotename PPTP file /etc/ppp/options.pptp ipparam pptp EOF logger -t poststart "Setting up gateway" route del default gw $wangw route add -host $serverIP gw $wangw route add -net 10.0.0.0/8 gw $wangw cp /etc/persistent/ip* /etc/ppp/ logger -t poststart "Calling PPTP server" /sbin/pppd call pptp echo "$?" fi
vi /etc/persistent/ip-down
#!/bin/sh if [ -f /etc/ppp/resolv.conf ]; then if [ -f /etc/ppp/resolv.prev ]; then cp -f /etc/ppp/resolv.prev /etc/resolv.conf else rm -f /etc/resolv.conf fi fi rm -f /etc/ppp/info.$IFNAME if [ -x /bin/sysled ]; then /bin/sysled -i 0 2>/dev/null fi if [ -f /etc/ppp/rssi_decode.sh ]; then . /etc/ppp/rssi_decode.sh stop fi
vi /etc/persistent/ip-up
if [ -f /etc/ppp/resolv.conf ]; then rm -f /etc/ppp/resolv.prev if [ -f /etc/resolv.conf ]; then cp /etc/resolv.conf /etc/ppp/resolv.prev grep domain /etc/ppp/resolv.prev > /etc/resolv.conf grep search /etc/ppp/resolv.prev >> /etc/resolv.conf cat /etc/ppp/resolv.conf >> /etc/resolv.conf else cp /etc/ppp/resolv.conf /etc/. fi fi # set the txqueuelen higher than crappy 3 ifconfig $IFNAME txqueuelen 32 2>&1 > /dev/null if [ -x /bin/sysled ]; then /bin/sysled -i 1 2>/dev/null fi if [ -f /etc/ppp/rssi_decode.sh ]; then . /etc/ppp/rssi_decode.sh start fi cat > /etc/ppp/info.$IFNAME << EOF started = `cat /proc/uptime | cut -d '.' -f 1` device = $DEVICE ifname = $IFNAME name = `sed '/^name /!d; s///; s/^"//; s/"$//; q' /etc/ppp/options` iplocal = $IPLOCAL ipremote = $IPREMOTE dns1 = $DNS1 dns2 = $DNS2 peername = $PEERNAME linkname = $LINKNAME EOF
Para acabar solo nos queda darle permisos de ejecución (+x) a ip-up ip-down y túnel y ya podemos reiniciar
Suerte!