#!/bin/bash # iwconfig DEV=wlan0 # Dispositivo inalambrico ESSID="Nodo-1" # ESSID de la red MODE=Managed # Modo de la red KEY=1111111111 # Clave WEP CHANNEL=6 # Canal usado en la red # ifconfig IP=192.168.1.78 # Direccion IP de la interfaz MS=255.255.255.0 # Mascara de subred BC=192.168.1.255 # Direccion de Broadcast DG=192.168.1.1 # Ruta por defecto DNS1=80.58.0.33 # Primer servidor de nombres DNS2=80.58.32.97 # Segundo servidor de nombres # Driver INF=/lib/windrivers/w22n51.INF # Driver Mircro$oft NDIS=w22n51 # Driver NDIS # Funciones function inicio() { echo Iniciando Wireless! ndiswrapper -i $INF modprobe ndiswrapper loadndisdriver $NDIS iwconfig $DEV essid $ESSID mode $MODE iwconfig $DEV key $KEY iwconfig $DEV channel $CHANNEL ifconfig $DEV up ifconfig $DEV $IP netmask $MS broadcast $BC route add default gw $DG echo "nameserver $DNS1" > /etc/resolv.conf echo "nameserver $DNS2" >> /etc/resolv.conf } function parada() { echo "Parando Wireless!" ifconfig $DEV down route del default gw $DW ndiswrapper -e $NDIS rmmod ndiswrapper } function estado() { echo "Driver:" ndiswrapper -l |grep $NDIS echo echo "WLAN:" iwconfig $DEV echo cat /proc/net/wireless echo echo "INTERFACE:" ifconfig $DEV } case "$1" in start) inicio echo;; stop) parada echo;; status) estado echo;; *) echo "Opcion Incorrecta" echo "Uso: " echo " start : Inicia Wireless" echo " stop : Detiene Wireless" echo " status: Muestra el estado";; esac