Page -> Diferencia entre revisiones de «PPTP-Ubuntu» | Vistas : Página Discusión Ver fuente Historial |
De DIT-CDC
(→Script dit) |
(→Script dit) |
||
Línea 107: | Línea 107: | ||
# Parámetros | # Parámetros | ||
− | |||
TUNNAME="DIT" | TUNNAME="DIT" | ||
TUNSRV="rpv.dit.upm.es" | TUNSRV="rpv.dit.upm.es" | ||
Línea 117: | Línea 116: | ||
$0 off --> Liberar túnel | $0 off --> Liberar túnel | ||
" | " | ||
− | |||
if [ "$#" -ne 1 ]; then | if [ "$#" -ne 1 ]; then | ||
echo "$usage" 1>&2 | echo "$usage" 1>&2 |
Revisión de 16:59 1 abr 2007
Configuración de túneles PPTP en Ubuntu
Contenido
Ubuntu 6.06 (Dapper Drake)
Instalación
Procedimiento para configurar el acceso PPTP al DIT sobre un Ubuntu 6.06:
- Instalar pptp-linux
apt-get install pptp-linux
- Añadir la fuente de pptpconfig a /etc/apt/sources.list:
- Añadir el repositorio "universe" si no está disponible ya. Para ello, descomentar la línea siguiente en /etc/apt/sources.list:
- Actualizar la lista de paquetes e instalar PPTP Client GUI:
echo -e '\n# PPTP GUI\ndeb http://quozl.netrek.org/pptp/pptpconfig ./' >> /etc/apt/sources.list
deb http://es.archive.ubuntu.com/ubuntu/ edgy universe
apt-get update apt-get install pptpconfig
pptpconfig
Solapa Server: Name: DIT Server: rpv.dit.upm.es Domain: Username: fulanito Password: clavedefulanito
Solapa Encryption: Seleccionar "Require Microsoft Point-to-Point (MPPE)"
Establecimiento/liberación del tunel
El establecimiento y liberación del túnel se puede realizar gráficamente desde la aplicación pptpconfig:
- Establecimiento: seleccionar la línea "DIT" en la parte superior y pinchar en la opción "Start".
- Liberación: pinchar en la opción "Stop".
También puede realizarse desde la línea de comandos mediante:
- Establecimiento:
pptpconfig DIT start
pptpconfig DIT stop
Ubuntu 6.10 (Edgy Eft)
Instalación
Existe un fallo conocido del script pptpconfig en Ubuntu 6.10, por lo que no se puede utilizar para establecer o liberar el túnel.
El procedimiento de instalación es igual al descrito más arriba para Ubuntu 6.06. Unicamente hay que realizar el siguiente paso adicional:
- Crear un script llamado dit con el contenido que aparece más abajo y darle permisos de ejecución:
chmod +x dit
Establecimiento/liberación del tunel
El establecimiento y liberación del túnel se realiza desde la línea de comandos mediante:
- Establecimiento:
dit on
- Liberación:
dit off
Script dit
#!/bin/bash # Parámetros TUNNAME="DIT" TUNSRV="rpv.dit.upm.es" usage=" Conexión PPTP a la intranet del DIT ----------------------------------- Uso: $0 on --> Establecer túnel $0 off --> Liberar túnel " if [ "$#" -ne 1 ]; then echo "$usage" 1>&2 exit fi TUNSRVIPADDR=`host $TUNSRV | grep address | awk '{printf $4}'` establecer_tunel() { ROUTER=`ip route list | grep default | awk '{printf $3; exit}'` IF=`ip route list | grep default | awk '{printf $5; exit}'` IPADDR=`ip addr show dev $IF | grep "inet " | awk '{print substr ($2, 1, length($2)-3)}'` echo "Connecting to DIT with PPTP (router=$ROUTER,if=$IF,ipaddr=$IPADDR)..." cp /etc/resolv.conf /etc/resolv.conf.orig.DIT pon $TUNNAME sleep 2 if [ $? -eq 0 ] then echo "ip route replace $TUNSRVIPADDR via $ROUTER dev $IF src $IPADDR" ip route replace $TUNSRVIPADDR via $ROUTER dev $IF src $IPADDR sleep 2 echo "ip route replace default dev ppp0" ip route replace default dev ppp0 echo "done" else echo "error" exit 1 fi } liberar_tunel() { IF=`ip route list | grep "^$TUNSRVIPADDR" | awk '{printf $5; exit}'` ROUTER=`ip route list | grep "^$TUNSRVIPADDR" | awk '{printf $3; exit}'` IPADDR=`ip addr show dev $IF | grep "inet " | awk '{print substr ($2, 1, length($2)-3)}'` echo "Disconnecting from DIT (if=$IF,router=$ROUTER,ipaddr=$IPADDR)..." poff $TUNNAME if [ $? -eq 0 ] then echo "ip route del $TUNSRVIPADDR via $ROUTER dev $IF src $IPADDR" ip route del $TUNSRVIPADDR via $ROUTER dev $IF src $IPADDR echo "ip route replace default via $ROUTER dev $IF" ip route replace default via $ROUTER dev $IF mv /etc/resolv.conf.orig.DIT /etc/resolv.conf echo "done" else exit 1 fi } # Main case $1 in on) establecer_tunel ;; off) liberar_tunel ;; *) echo "$usage" 1>&2 exit 1 ;; esac