Mostrando entradas con la etiqueta iwconfig. Mostrar todas las entradas
Mostrando entradas con la etiqueta iwconfig. Mostrar todas las entradas

miércoles, diciembre 06, 2006

wifi con WEP

Configuramos nuestro router wifi con encriptación wep y le ponemos una clave.

Ponemos el essid y channel con en el caso anterior y añadir la opción key:
iwconfig eth1 essid TOLETUM channel 11 key restricted key s:CLAVE


Vemos si hemos conectado iwconfig eth1 tiene que tener puesto el "Access Point" la MAC del router.

Y levantamos el interfaz.

martes, diciembre 05, 2006

wifi con dhcpcd

Primero instalamos la paquete Dhcpcd-2.0.8.

tar xf dhcpcd-2.0.8.tar.bz2
cd dhcpcd-2.0.8
./configure --prefix="/usr/local/dhcp"
make
make install

Luego en /etc/sysconfig/network-devices/services creamos el fichero dhcpcd:
# Based upon lfs-bootscripts-1.12 $network_devices/if{down,up}
# Rewritten by Nathan Coulson
# Adapted for dhcpcd by DJ Lucas

#$LastChangedBy: dnicholson $
#$Date: 2006-10-01 13:07:56 -0500 (Sun, 01 Oct 2006) $

. /etc/sysconfig/rc
. $rc_functions
. $IFCONFIG


DAEMON="/usr/local/dhcp/sbin/dhcpcd"

PIDFILE="/var/run/dhcpcd-$1.pid"
LEASEINFO="/var/lib/dhcpc/dhcpcd-$1.info"

case "$2" in
up)
boot_mesg -n "Starting dhcpcd on the $1 interface..."
# Test to see if there is a stale pid file
if [ -f "$PIDFILE" ]
then
ps `cat "$PIDFILE"` | grep dhcpcd > /dev/null
if [ $? != 0 ]
then
rm -f /var/run/dhcpcd-$1.pid > /dev/null
else
boot_mesg "dhcpcd already running!" ${WARNING}
echo_warning
exit 2
fi
fi
$DAEMON $1 $DHCP_START
# Save the return value
RET="$?"
# Print the assigned settings if requested
if [ "$RET" = "0" -a "$PRINTIP" = "yes" ]; then
. /var/lib/dhcpc/dhcpcd-$1.info
if [ "$PRINTALL" = "yes" ]; then
echo ""
echo_ok
boot_mesg " DHCP Assigned Settings for $1:"
boot_mesg_flush
boot_mesg " IP Address: $IPADDR"
boot_mesg_flush
boot_mesg " Subnet Mask: $NETMASK"
boot_mesg_flush
boot_mesg " Default Gateway: $GATEWAY"
boot_mesg_flush
boot_mesg " DNS Server: $DNS"
boot_mesg_flush
else
boot_mesg " IP Addresss: ""$IPADDR"
echo_ok
fi
else
echo ""
$(exit "$RET")
evaluate_retval
fi
;;

down)
boot_mesg -n "Stopping dhcpcd on the $1 interface..."
# Do nothing with the client daemon if we have an infinate
# lease time as the client exits when started in this case,
# just echo OK.
if [ -e $LEASEINFO ]
then
. $LEASEINFO

if [ "$LEASETIME" = "4294967295" ]
then
# do nothing, just echo ok
echo ""
echo_ok
else
if [ -n "$DHCP_STOP" ]
then
$DAEMON $1 $DHCP_STOP &> /dev/null
RET="$?"
if [ "$RET" -eq 0 ]; then
echo ""
echo_ok
elif [ "$RET" -eq 1 ]; then
boot_mesg "dhcpcd not running!" ${WARNING}
echo_warning
else
echo ""
echo_failure
fi
else
echo ""
killproc dhcpcd
fi
fi
else
boot_mesg -n "LEASEINFO Test failed! - " ${WARNING}
boot_mesg "dhcpcd is not running!" ${WARNING}
echo_warning
exit 1
fi
;;

*)
echo "Usage: $0 [interface] {up|down}"
exit 1
;;
esac

# End $network_devices/services/dhcpcd

chmod 755 dhcpcd

Luego en /etc/sysconfig/network-devices/ifconfig.eth1 (nuestra interfaz wifi) creamos el fichero dhcpcd:
ONBOOT="no"
SERVICE="dhcpcd"
DHCP_START=""
DHCP_STOP="-k"

# Set PRINTIP="yes" to have the script print
# the DHCP assigned IP address
PRINTIP="yes"

# Set PRINTALL="yes" to print the DHCP assigned values for
# IP, SM, DG, and 1st NS. This requires PRINTIP="yes".
PRINTALL="yes"

y levantamos el interfaz: /etc/sysconfig/network-devices/ifup eth1

Conexión a la red Wifi sin seguridad

Ya tenemos el driver instalado y la wireless tools.

Vamos a probar:
iwconfig
lo no wireless extensions.

eth0 no wireless extensions.

eth1 unassociated ESSID:off/any
Mode:Managed Channel=0 Access Point: Not-Associated
Bit Rate:0 kb/s Tx-Power=20 dBm Sensitivity=8/0
Retry limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality:0 Signal level:0 Noise level:0
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

Ahora vamos ver qué redes tenemos a nuestro alcance: iwlist eth1 scanning

Ponemos el id de nuestra red: iwconfig eth1 essid "TOLETUM"
El canal: iwconfig eth1 channel 11


iwconfig eth1

eth1 IEEE 802.11g ESSID:"TOLETUM"
Mode:Managed Frequency:2.462 GHz Access Point: XX:XX:XX:XX:XX:XX
Bit Rate:54 Mb/s Tx-Power=20 dBm Sensitivity=8/0
Retry limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality=97/100 Signal level=-27 dBm Noise level=-87 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

Ya estamos conectados, ahora hay que configurar la eth1

Primero y para evitar problema paramos la eth0: /etc/rc.d/init.d/network stop

En /etc/sysconfig/network-devices/ifconfig.eth0/ipv4 ponemos ONBOOT=no y creamos el directorio /etc/sysconfig/network-devices/ifconfig.eth1 creamos el fichero ipv4:
ONBOOT=yes
SERVICE=ipv4-static
IP=192.168.1.20
GATEWAY=192.168.1.1
PREFIX=24
BROADCAST=255.255.255.0

Yo normalmente no utilizo la eth0 y eth1 al mismo tiempo, es más una vez configurada la wifi no uso el cable, si fuese así en ONBOOT=no y con /etc/sysconfig/network-devices/ifup y /etc/sysconfig/network-devices/ipdown iria cambiando de interfaz

Y arrancamos /etc/rc.d/init.d/network start.

Con esto la eth0 no se va a levantar, pero si nuestra eth1 (wifi)