Procedimiento WiFi

De WikiEtl
Saltar a: navegación, buscar

Contenido

Prueba funcionamiento Wifi en linux (módulo MADWIFI)

Para comprobar el correcto funcionamiento del WiFi en Linux, se siguen estos pasos:

Cargar el módulo de MadWifi "ath_pci", si no lo está ya:

root@jbit101:/# modprobe ath_pci
root@jbit101:/# lsmod | grep ath
ath_rate_sample        13184  1
ath_pci                89376  0
wlan                  184004  4 wlan_scan_sta,ath_rate_sample,ath_pci
ath_hal               192848  3 ath_rate_sample,ath_pci

Crear el interfaz de red inalámbrico con el comando ifconfig:

root@jbit101:/# ifconfig ath0 up
root@jbit101:/# ifconfig
ath0      Link encap:Ethernet  HWaddr 00:0F:B5:61:16:C5
          inet6 addr: fe80::20f:b5ff:fe61:16c5/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
wifi0     Link encap:UNSPEC  HWaddr 00-0F-B5-61-16-C5-30-3A-00-00-00-00-00-00-00-00
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:18 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:199
          RX bytes:0 (0.0 b)  TX bytes:828 (828.0 b)
          Interrupt:23

Comprobar que el módulo "wlan_scan_sta" está cargado en el sistema:

root@jbit101:/# lsmod | grep wlan
wlan_scan_sta          13952  1
wlan                  184004  4 wlan_scan_sta,ath_rate_sample,ath_pci

4- Verificar que el interfaz funciona, escaneando redes wifi. Para ello, usar el comando wlanconfig o iwlist:

root@jbit101:/# wlanconfig ath0 list scan
root@jbit101:/# iwlist ath0 scan


Prueba funcionamiento Wifi en linux (módulo ATH5K)

Para comprobar el correcto funcionamiento del WiFi en Linux, se siguen estos pasos:

Cerciorarnos que nuestra tarjeta Atheros está reconocida por el sistema. Para ello utilizaremos el comando "lspci" filtrando con un "grep" por "Atheros":

lspci | grep Atheros
01:01.0 Ethernet controller: Atheros Communications Inc. AR5212/AR5213 Multiprotocol MAC/baseband processor (rev 01)

Vamos a comprobar que tenemos cargado el modulo “ath5k”. Para ello listamos los modulos cargados con “lsmod” y filtramos con “grep” los resultados que contengan “ath5k”:

lsmod | grep ath5k
ath5k          112194  0 
mac80211       136924  1 ath5k
ath            8006    1 ath5k
cfg80211       101160  3 ath5k,mac80211,ath

Si no esta cargado el módulo lo cargamos:

modprobe ath5k

Averiguamos el nombre de la interfaz wireless mediante el comando iwconfig:

iwconfig

lo        no wireless extensions.
eth0      no wireless extensions.
eth1      no wireless extensions.
wlan0     IEEE 802.11bg  ESSID:off/any  
         Mode:Managed  Access Point: Not-Associated   Tx-Power=0 dBm   
         Retry  long limit:7   RTS thr:off   Fragment thr:off
         Encryption key:off
         Power Management:off

Crear el interfaz de red inalámbrico con el comando ifconfig:

root@jbit101:/# ifconfig wlan0 up
root@jbit101:/# ifconfig
eth0     Link encap:Ethernet  HWaddr f4:6d:04:e4:6c:61  
         inet addr:163.117.168.110  Bcast:163.117.168.255  Mask:255.255.255.0
         inet6 addr: 2001:720:410:1008::110/64 Scope:Global
         inet6 addr: fe80::f66d:4ff:fee4:6c61/64 Scope:Link
         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
         RX packets:2928 errors:0 dropped:39 overruns:0 frame:0
         TX packets:1077 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000 
         RX bytes:407934 (398.3 KiB)  TX bytes:142697 (139.3 KiB)
         Interrupt:18 Base address:0xe000 
eth1     Link encap:Ethernet  HWaddr 00:13:f7:1a:94:40  
         inet addr:192.100.100.110  Bcast:192.100.100.255  Mask:255.255.255.0
         UP BROADCAST MULTICAST  MTU:1500  Metric:1
         RX packets:0 errors:0 dropped:0 overruns:0 frame:0
         TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000 
         RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
         Interrupt:17 Base address:0x2000 
lo       Link encap:Local Loopback  
         inet addr:127.0.0.1  Mask:255.0.0.0
         inet6 addr: ::1/128 Scope:Host
         UP LOOPBACK RUNNING  MTU:16436  Metric:1
         RX packets:78 errors:0 dropped:0 overruns:0 frame:0
         TX packets:78 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:0 
         RX bytes:6375 (6.2 KiB)  TX bytes:6375 (6.2 KiB)
wlan0    Link encap:Ethernet  HWaddr 00:18:4d:7a:59:5c  
         UP BROADCAST MULTICAST  MTU:1500  Metric:1
         RX packets:0 errors:0 dropped:0 overruns:0 frame:0
         TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000 
         RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Para verificar que el interfaz funciona usaremos el comando iwlist con opción de escanear:

sudo iwlist wlan0 scan
wlan0     Scan completed :
         Cell 01 - Address: 00:1B:B1:00:49:77
                   Channel:1
                   Frequency:2.412 GHz (Channel 1)
                   Quality=41/70  Signal level=-69 dBm  
                   Encryption key:off
                   ESSID:"NETC-OPEN"
                   Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                             9 Mb/s; 12 Mb/s; 18 Mb/s
                   Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
                   Mode:Master
                   Extra:tsf=0000001162c9f401
                   Extra: Last beacon: 544ms ago
                   IE: Unknown: 00094E4554432D4F50454E
                   IE: Unknown: 010882848B960C121824
                   IE: Unknown: 030101
                   IE: Unknown: 2A0104
                   IE: Unknown: 32043048606C

Para probar el modo master de la interfaz seguiremos los siguientes pasos:

       - Creamos un fichero de configuración para hostapd en /tmp con los siguientes datos:
           rbravo@dit154:/tmp$ cat a.conf
           interface=wlan0
           driver=nl80211
           ssid=test
           channel=1
       - Ejecutamos sudo hostapd <config_file>
           rbravo@dit154:/tmp$ sudo hostapd -d a.conf
           random: Trying to read entropy from /dev/random
           Configuration file: a.conf
           nl80211: interface wlan0 in phy phy0
           rfkill: Cannot open RFKILL control device
           nl80211: RFKILL status not available
           nl80211: Using driver-based off-channel TX
           nl80211: Add own interface ifindex 4
           nl80211: Set mode ifindex 4 iftype 3 (AP)
           nl80211: Create interface iftype 6 (MONITOR)
           nl80211: New interface mon.wlan0 created: ifindex=6
           nl80211: Add own interface ifindex 6
           BSS count 1, BSSID mask 00:00:00:00:00:00 (0 bits)
           nl80211: Regulatory information - country=00
           nl80211: 2402-2472 @ 40 MHz
           nl80211: 2457-2482 @ 40 MHz
           nl80211: 2474-2494 @ 20 MHz
           nl80211: 5170-5250 @ 40 MHz
           nl80211: 5735-5835 @ 40 MHz
           nl80211: 57240-63720 @ 2160 MHz
           nl80211: Added 802.11b mode based on 802.11g information
           Completing interface initialization
           Mode: IEEE 802.11b Channel: 1 Frequency: 2412 MHz
           nl80211: Set freq 2412 (ht_enabled=0 sec_channel_offset=0)
           Failed to update rate sets in kernel module
           RATE[0] rate=10 flags=0x1
           RATE[1] rate=20 flags=0x1
           RATE[2] rate=55 flags=0x0
           RATE[3] rate=110 flags=0x0
           Flushing old station entries
           Deauthenticate all stations
           wpa_driver_nl80211_set_key: ifindex=4 alg=0 addr=(nil) key_idx=0 set_tx=0 seq_len=0 key_len=0
           wpa_driver_nl80211_set_key: ifindex=4 alg=0 addr=(nil) key_idx=1 set_tx=0 seq_len=0 key_len=0
           wpa_driver_nl80211_set_key: ifindex=4 alg=0 addr=(nil) key_idx=2 set_tx=0 seq_len=0 key_len=0
           wpa_driver_nl80211_set_key: ifindex=4 alg=0 addr=(nil) key_idx=3 set_tx=0 seq_len=0 key_len=0
           Using interface wlan0 with hwaddr 00:18:4d:7a:4b:8f and ssid 'test'
           VLAN: vlan_set_name_type(name_type=2)
           nl80211: Set beacon (beacon_set=0)
           wpa_driver_nl80211_set_operstate: operstate 0->1 (UP)
           netlink: Operstate: linkmode=-1, operstate=6
           wlan0: Setup of interface done.
           random: Got 20/20 bytes from /dev/random
           RTM_NEWLINK: operstate=1 ifi_flags=0x1002 ()
           nl80211: Ignore interface down event since interface mon.wlan0 is up
           RTM_NEWLINK: operstate=1 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP])
           RTM_NEWLINK, IFLA_IFNAME: Interface 'mon.wlan0' added
           Unknown event 5
           RTM_NEWLINK: operstate=1 ifi_flags=0x1003 ([UP])
           RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
           nl80211: if_removed already cleared - ignore event
           mgmt::deauth cb
           RTM_NEWLINK: operstate=1 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP])
           RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
           nl80211: if_removed already cleared - ignore event
           VLAN: vlan_newlink(wlan0)


       - Ejecutamos sudo iwconfig
           rbravo@dit154:/tmp$ sudo iwconfig
           mon.wlan0 IEEE 802.11bg Mode:Monitor Tx-Power=20 dBm
           Retry long limit:7 RTS thr:off Fragment thr:off
           Power Management:on
           wlan0 IEEE 802.11bg Mode:Master Tx-Power=20 dBm
           Retry long limit:7 RTS thr:off Fragment thr:off
           Power Management:off
           lo no wireless extensions.
           eth0 no wireless extensions.
           eth1 no wireless extensions.

Prueba funcionamiento Wifi en linux (módulo ATH9K)

Para comprobar el correcto funcionamiento del WiFi en Linux, se siguen pasos exactamente iguales a los del modulo ATH5K:

Comprobar que la tarjeta es reconocida por el equipo. Comandos: "lspci" filtrando con un "grep" por "Atheros":

# lspci | grep Atheros
02:00.0 Network controller: Atheros Communications Inc. AR9285 Wireless Network Adapter (PCI-Express) (rev 01)

Comprobar que tenemos cargado el modulo “ath9k”. Comandos: “lsmod” y filtramos con “grep” los resultados que contengan “ath9k”:

# lsmod | grep ath9k
ath9k                 118119  0 
ath9k_common            2587  1 ath9k
ath9k_hw              387281  2 ath9k_common,ath9k
mac80211              369529  1 ath9k
ath                    13494  3 ath9k_common,ath9k,ath9k_hw
cfg80211              354234  3 ath,ath9k,mac80211

Si no está cargado el módulo, lo cargamos:

modprobe ath9k

Saber el nombre de la interfaz wireless asociada al modulo ATH9K. Comando: iwconfig

# sudo iwconfig
wlan0     IEEE 802.11bgn  ESSID:off/any  
         Mode:Managed  Access Point: Not-Associated   Tx-Power=0 dBm   
         Retry  long limit:7   RTS thr:off   Fragment thr:off
         Encryption key:off
         Power Management:off
lo        no wireless extensions.
eth0      no wireless extensions.
eth1      no wireless extensions.

Crear el interfaz de red inalámbrico con el comando ifconfig:

# sudo ifconfig wlan0 up
# sudo ifconfig
wlan0     Link encap:Ethernet  HWaddr 54:e6:fc:da:e6:ac  
         UP BROADCAST MULTICAST  MTU:1500  Metric:1
         RX packets:0 errors:0 dropped:0 overruns:0 frame:0
         TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000 
         RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Verificar que el interfaz funciona. Comando iwlist con opción de escanear, saldra una lista con las Wi-Fi disponibles:

# sudo iwlist wlan0 scan

...

Cell 21 - Address: 00:1B:B1:00:49:8D
                   Channel:11
                   Frequency:2.462 GHz (Channel 11)
                   Quality=30/70  Signal level=-80 dBm  
                   Encryption key:off
                   ESSID:"NETC-OPEN"
                   Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                             9 Mb/s; 12 Mb/s; 18 Mb/s
                   Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
                   Mode:Master
                   Extra:tsf=00000417cfd54401
                   Extra: Last beacon: 128ms ago
                   IE: Unknown: 00094E4554432D4F50454E
                   IE: Unknown: 010882848B960C121824
                   IE: Unknown: 03010B
                   IE: Unknown: 050400020000
                   IE: Unknown: 2A0104
                   IE: Unknown: 32043048606C

Comprobar el modo master (Punto de Acceso) de la interfaz.

       - Crear un fichero de configuración para hostapd en /tmp con los siguientes datos:
           /tmp# cat a.conf
           interface=wlan0
           driver=nl80211
           ssid=test
           channel=1


       - Asignar una direccion a la interfaz wlanX:
         #sudo ifconfig wlanX <direccion ip>
       - Ejecutar el comando sudo hostapd <config_file>
           /tmp# sudo hostapd -d a.conf
           random: Trying to read entropy from /dev/random
           Configuration file: a.conf
           nl80211: interface wlan0 in phy phy0
           rfkill: Cannot open RFKILL control device
           nl80211: RFKILL status not available
           nl80211: Using driver-based off-channel TX
           nl80211: Use separate P2P group interface (driver advertised support)
           nl80211: TDLS supported
           nl80211: TDLS external setup
           nl80211: Add own interface ifindex 3
           nl80211: Set mode ifindex 3 iftype 3 (AP)
           nl80211: Create interface iftype 6 (MONITOR)
           nl80211: New interface mon.wlan0 created: ifindex=7
           nl80211: Add own interface ifindex 7
           BSS count 1, BSSID mask 00:00:00:00:00:00 (0 bits)
           nl80211: Regulatory information - country=00
           nl80211: 2402-2472 @ 40 MHz
           nl80211: 2457-2482 @ 40 MHz
           nl80211: 2474-2494 @ 20 MHz
           nl80211: 5170-5250 @ 40 MHz
           nl80211: 5735-5835 @ 40 MHz
           nl80211: 57240-63720 @ 2160 MHz
           nl80211: Added 802.11b mode based on 802.11g information
           Completing interface initialization
           Mode: IEEE 802.11b  Channel: 1  Frequency: 2412 MHz
           nl80211: Set freq 2412 (ht_enabled=0 sec_channel_offset=0)
           Failed to update rate sets in kernel module
           RATE[0] rate=10 flags=0x1
           RATE[1] rate=20 flags=0x1
           RATE[2] rate=55 flags=0x0
           Flushing old station entries
           Deauthenticate all stations
           wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=(nil) key_idx=0 set_tx=0 seq_len=0 key_len=0
           wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=(nil) key_idx=1 set_tx=0 seq_len=0 key_len=0
           wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=(nil) key_idx=2 set_tx=0 seq_len=0 key_len=0
           wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=(nil) key_idx=3 set_tx=0 seq_len=0 key_len=0
           Using interface wlan0 with hwaddr 54:e6:fc:da:e6:ac and ssid 'test'
           VLAN: vlan_set_name_type(name_type=2)
           nl80211: Set beacon (beacon_set=0)
           wpa_driver_nl80211_set_operstate: operstate 0->1 (UP)
           netlink: Operstate: linkmode=-1, operstate=6
           wlan0: Setup of interface done.
           random: Got 20/20 bytes from /dev/random
           RTM_NEWLINK: operstate=1 ifi_flags=0x1002 ()
           nl80211: Ignore interface down event since interface mon.wlan0 is up
           RTM_NEWLINK: operstate=1 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP])
           RTM_NEWLINK, IFLA_IFNAME: Interface 'mon.wlan0' added
           Unknown event 5
           RTM_NEWLINK: operstate=1 ifi_flags=0x1003 ([UP])
           RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
           nl80211: if_removed already cleared - ignore event
           RTM_NEWLINK: operstate=1 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP])
           RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
           nl80211: if_removed already cleared - ignore event
           VLAN: vlan_newlink(wlan0)
           mgmt::auth
           authentication: STA=f0:25:b7:01:f2:d8 auth_alg=0 auth_transaction=1 status_code=0 wep=0
           New STA
           wlan0: STA f0:25:b7:01:f2:d8 IEEE 802.11: authentication OK (open system)
           wlan0: STA f0:25:b7:01:f2:d8 MLME: MLME-AUTHENTICATE.indication(f0:25:b7:01:f2:d8, OPEN_SYSTEM)
           wlan0: STA f0:25:b7:01:f2:d8 MLME: MLME-DELETEKEYS.request(f0:25:b7:01:f2:d8)
           authentication reply: STA=f0:25:b7:01:f2:d8 auth_alg=0 auth_transaction=2 resp=0 (IE len=0)
           mgmt::auth cb
           wlan0: STA f0:25:b7:01:f2:d8 IEEE 802.11: authenticated
           mgmt::assoc_req
           association request: STA=f0:25:b7:01:f2:d8 capab_info=0x21 listen_interval=10
           new AID 1
           wlan0: STA f0:25:b7:01:f2:d8 IEEE 802.11: association OK (aid 1)
           mgmt::assoc_resp cb
           wlan0: STA f0:25:b7:01:f2:d8 IEEE 802.11: associated (aid 1)
           wlan0: AP-STA-CONNECTED f0:25:b7:01:f2:d8
           wlan0: STA f0:25:b7:01:f2:d8 MLME: MLME-ASSOCIATE.indication(f0:25:b7:01:f2:d8)
           wlan0: STA f0:25:b7:01:f2:d8 MLME: MLME-DELETEKEYS.request(f0:25:b7:01:f2:d8)
           wlan0: STA f0:25:b7:01:f2:d8 RADIUS: starting accounting session 538F3947-00000000
           IEEE 802.1X: Ignore STA - 802.1X not enabled or forced for WPS
           nl80211: Event message available
           nl80211: New station f0:25:b7:01:f2:d8
       - Comprobacion final:
         En el dispositivo que se quiera conectar (pc, movil, tablet...) buscar la ESSID del fichero de configuracion anterior (test) y conectar. Tener en cuenta que a esta conexion se le debe asignar una direccion ip en el rango de la wlanX.
           #sudo iwconfig

           mon.wlan0  IEEE 802.11bgn  Mode:Monitor  Tx-Power=14 dBm   
           Retry  long limit:7   RTS thr:off   Fragment thr:off
           Power Management:on         
           wlan0     IEEE 802.11bgn  Mode:Master  Tx-Power=14 dBm   
           Retry  long limit:7   RTS thr:off   Fragment thr:off
           nagement:off
           lo         extensions.
           eth0       extensions.
           eth1      no wireless extensions.


Pruebas especificas.

       - Escanear redes: 
         
         sudo iw dev <interface> scan
         ...
         BSS 00:26:cb:c6:8b:f1 (on wlan0)
         TSF: 1216672194247 usec (14d, 01:57:52)
         freq: 2412
         beacon interval: 100
         capability: ESS Privacy ShortPreamble ShortSlotTime (0x0431)
         signal: -87.00 dBm
         last seen: 624 ms ago
         SSID: eduroam
         Supported rates: 1.0 2.0 5.5 6.0 9.0 11.0 12.0 18.0*
         DS Parameter set: channel 1
         Country: ES	Environment: Indoor/Outdoor
         Channels [1 - 13] @ 20 dBm
         ERP: <no flags>
         RSN:	 * Version: 1
                * Group cipher: TKIP
                * Pairwise ciphers: TKIP CCMP
                * Authentication suites: IEEE 802.1X
                * Capabilities: 4-PTKSA-RC 4-GTKSA-RC (0x0028)
         Extended supported rates: 24.0* 36.0 48.0 54.0
         WPA:	 * Version: 1
                * Group cipher: TKIP
                * Pairwise ciphers: TKIP CCMP
                * Authentication suites: IEEE 802.1X
                * Capabilities: (0x0000)
         WMM:	 * Parameter version 1
                * u-APSD
                * BE: CW 15-1023, AIFSN 3
                * BK: CW 15-1023, AIFSN 7
                * VI: CW 7-15, AIFSN 2, TXOP 3008 usec
                * VO: CW 3-7, AIFSN 2, TXOP 1504 usec


         sudo iwlist <interface> scan
         ...
         Cell 23 - Address: 00:26:CB:C6:8B:F1
                   Channel:1
                   Frequency:2.412 GHz (Channel 1)
                   Quality=30/70  Signal level=-80 dBm  
                   Encryption key:on
                   ESSID:"eduroam"
                   Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 6 Mb/s; 9 Mb/s
                             11 Mb/s; 12 Mb/s; 18 Mb/s
                   Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
                   Mode:Master
                   Extra:tsf=0000011b6813e140
                   Extra: Last beacon: 79ms ago
                   IE: Unknown: 0007656475726F616D
                   IE: Unknown: 010802040B0C121618A4
                   IE: Unknown: 030101
                   IE: Unknown: 0706455320010D14
                   IE: Unknown: 0B050000348D5B
                   IE: Unknown: 2A0100
                   IE: IEEE 802.11i/WPA2 Version 1
                       Group Cipher : TKIP
                       Pairwise Ciphers (2) : TKIP CCMP
                       Authentication Suites (1) : 802.1x
                   IE: Unknown: 3204B048606C
                   IE: Unknown:         851E04008F000F00FF0359004230343146303141503100000000000000000027
                   IE: Unknown: 9606004096000800
                   IE: WPA Version 1
                       Group Cipher : TKIP
                       Pairwise Ciphers (2) : TKIP CCMP
                       Authentication Suites (1) : 802.1x
                   IE: Unknown: DD180050F2020101800003A4000027A4000042435E0062322F00
                   IE: Unknown: DD06004096010104
                   IE: Unknown: DD050040960305
                   IE: Unknown: DD050040960B09
                   IE: Unknown: DD050040961400
                   IE: Unknown: DD16000B85F800015395D7222ADE0810FD46B6648CFDCB8F
       - Para crear los puntos de acceso:
         sudo hostapd hostapd.conf
         Using interface wlan0 with hwaddr 54:e6:fc:da:e6:ac and ssid 'test_X'
       - Para crear los puntos de accesso con bridge:
         sudo hostapd hostapd_bridge.conf
         Using interface wlan0 with hwaddr 54:e6:fc:da:e6:ac and ssid 'test_X'
         
         sudo brctl addif br0 eth1
         sudo ip link set br0 up
         sudo brctl show
         
         bridge name	bridge id		STP enabled	interfaces
         br0		8000.0040f46436a6	no		eth1
         							wlan0
       - Para conectarse:
         sudo iw dev <interface> connect [-w] <ssid> [freq] [bssid]
         sudo iw dev <interface> link
         Connected to 00:27:0d:56:03:20 (on wlan0)
         SSID: WiFi-UC3M
         freq: 2462
         RX: 21058 bytes (120 packets)
         TX: 3286 bytes (15 packets)
         signal: -54 dBm
         tx bitrate: 54.0 MBit/s
         bss flags:	short-preamble short-slot-time
         dtim period:	0
         beacon int:	100
         sudo iw dev <interface> disconnect
         
         sudo iwconfig <interface> essid <ssid> ap <bssid> ch <channel>
         sudo iwconfig <interface> essid <off>
       - Para el modo ad-hoc:
         sudo ip link set <interface> down
         sudo iw dev <interface> set type ibss
         sudo ip link set <interface> up
         iw dev <interface> ibss join <name-ad-hoc> <freq>
         iw dev <interface> ibss leave <name-ad-hoc> <freq>
         sudo ip link set <interface> down
         sudo iwconfig <interface> mode ad-hoc
         sudo ip link set <interface> up
         sudo iwconfig <interface> essid <name-ad-hoc> ch <freq>
         sudo iwconfig <interface> essid <off>
       - Para crear una interfaz monitora:
         sudo iw dev <devname> interface add <name> type monitor
         sudo ip link set <name> up
         tcpdump -ln -i <name>
         
         ...
         3756 packets captured
         3756 packets received by filter
         0 packets dropped by kernel
       - Para el modo RTC/CTS
         sudo hostapd hostapd_rtscts.conf
         sudo iw phy <phyname> set rts <rts threshold|off>
         
         Otra forma...
         sudo iwconfig <interface> rts {N|auto|fixed|off}

isaleh

Resolver el cambio de nombre de la interfaz (sirve para cualquier interfaz)

Hay veces que la interfaz wlan0 se cambia de nombre al clonarse. Esto se soluciona de la siguiente manera


sudo ifconfig -a 


Apuntamos la MAC de la interfaz a la que queremos cambiar el nombre.

A continuación modificamos el nombre de la interfaz en /etc/udev/rules.d/70-persistent-net.rules

sudo nano /etc/udev/rules.d/70-persistent-net.rules

Aquí, buscamos la MAC que hemos apuntado en el paso anterior.


Modificamos el contenido de KERNEL y NAME por el nombre que queremos dar a la interfaz, por ejemplo:

# PCI device (atheros)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="e8:94:f6:fb:46:b0", ATTR{type}=="1", KERNEL=="athk*", NAME="athk1"

Lo cambiamos por:

# PCI device (atheros) 
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="e8:94:f6:fb:46:b0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"

Por último, para que los cambios surtan efecto reiniciamos el equipo.

Casos de uso:

Configurar un punto de acceso WiFi para capturar paquetes en wireshark

Paso 1: Bajar la interfaz wlan0

Para bajar la interfaz se usa el comando "ifconfig":

sudo ifconfig wlan0 down

Paso 2: Poner el modo monitor

Para poder ponerlo debemos tener permisos de sudo al igual que con ifconfig. En este caso usamos el comando iwconfig:

sudo iwconfig wlan0 mode monitor

Paso 3: Poner el modo manager

El modo manager es parecido a poner el modo monitor, simplemente es intercambiar monitor por manager:

sudo iwconfig wlan0 mode manger

Paso 4: Configurar el nombre de essid:

Esto no es del todo necesario pero si quisieramos cambiar el nombre a "XXXX" sería así:

sudo iwconfig wlan0 essid XXXX


Paso 5: Poner el modo monitor para capturar paquetes:

Es necesario volver a poner el modo monitor para capturar paquetes:

sudo iwconfig wlan0 mode monitor

Paso 6: Levantar la interfaz wlan0

Por último hay que levantar la interfaz puesto que la hemos tenido que bajar para poder configurarla.

sudo ifconfig wlan0 up

isaleh


Miguelg

Enlaces Externos

--Miguel 11:42 25 sep 2007 (CEST)

Configuracion de equipo como punto de acceso (módulo MADWIFI)

En el punto de acceso realizamos los siguientes pasos una vez cargado el modulo de red (ath_pci)

root@monitor02# wlanconfig ath0 create wlandev wifi0 wlanmode master

NOTA: Si el dispositivo ya hubiera estado creado con anterioridad al ejecutar el comando anterior podria producierse un erro de E/S. Para solucionar este problema habria que destruir del dispositivo previamente utilizando el comnado wlanconfig ath0 destroy

root@monitor02# ifconfig ath0 172.1.1.2 netmask 255.255.255.0

root@monitor02# iwconfig ath0 essid "LAB" channel 1

root@monitor02# ifconfig ath0 up

root@monitor02# ifconfig ath0

 ath0    Link encap:Ethernet  HWaddr 00:0F:B5:61:15:02
         inet addr:172.1.1.2  Bcast:172.1.1.255  Mask:255.255.255.0
         inet6 addr: fe80::20f:b5ff:fe61:1502/64 Scope:Link
         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
         RX packets:0 errors:0 dropped:0 overruns:0 frame:0
         TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:0
         RX bytes:0 (0.0 b)  TX bytes:230 (230.0 b 

root@monitor02# iwconfig ath0

ath0     IEEE 802.11g  ESSID:"LAB"
         Mode:Master  Frequency:2.412 GHz  Access Point: 00:0F:B5:61:15:02
         Bit Rate:0 kb/s   Tx-Power:15 dBm   Sensitivity=0/3
         Retry:off   RTS thr:off   Fragment thr:off
         Encryption key:off
         Power Management:off
         Link Quality=0/94  Signal level=-95 dBm  Noise level=-95 dBm
         Rx invalid nwid:3  Rx invalid crypt:0  Rx invalid frag:0
         Tx excessive retries:0  Invalid misc:0   Missed beacon:0

arrancamos el servicio ser

root@monitor02:/var/home/lab/alum0/00/48/051# /etc/init.d/ser start Nota: Si está lanzado ya el ser o se cambia la ip de la interfaz, hay que hacer un restart

Y en los clientes

ines@doc001:/$modprobe ath_pci

ines@doc001:/$ifconfig ath0 up

ines@doc001:/$ifconfig ath0 172.1.1.6 netmask 255.255.255.0

ines@doc001:/$ifconfig

ath0     Link encap:Ethernet  HWaddr 00:14:6C:85:63:43
         inet addr:172.1.1.6  Bcast:172.1.1.255  Mask:255.255.255.0
         inet6 addr: fe80::214:6cff:fe85:6343/64 Scope:Link
         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
         RX packets:0 errors:0 dropped:0 overruns:0 frame:0
         TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:0
         RX bytes:0 (0.0 b)  TX bytes:160 (160.0 b)
wifi0    Link encap:UNSPEC  HWaddr 00-14-6C-85-63-43-30-3A-00-00-00-00-00-00-00-00
         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
         RX packets:1031 errors:0 dropped:0 overruns:0 frame:70
         TX packets:17 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:199
         RX bytes:110732 (108.1 KiB)  TX bytes:905 (905.0 b)
         Interrupt:21


ines@doc001:/$iwconfig ath0 encryp off

ines@doc001:/$iwconfig ath0 essid "LAB" channel 1

ines@doc001:/$iwconfig

lo        no wireless extensions.
eth0      no wireless extensions.
wifi0     no wireless extensions.
Warning: Driver for device ath0 has been compiled with version 22
of Wireless Extension, while this program supports up to version 20.
Some things may be broken...
ath0      IEEE 802.11g  ESSID:"LAB"  Nickname:""
         Mode:Managed  Frequency:2.412 GHz  Access Point: 00:0F:B5:61:15:02
         Bit Rate:2 Mb/s   Tx-Power:18 dBm   Sensitivity=1/1
         Retry:off   RTS thr:off   Fragment thr:off
         Encryption key:off
         Power Management:off
         Link Quality=15/70  Signal level=-80 dBm  Noise level=-95 dBm
         Rx invalid nwid:14379  Rx invalid crypt:0  Rx invalid frag:0
         Tx excessive retries:0  Invalid misc:0   Missed beacon:0
eth1      no wireless extensions.
eth3      no wireless extensions.
eth4      no wireless extensions.
eth2      no wireless extensions.


ines@doc001:/$sudo route add -net 172.1.1.0 netmask 255.255.255.0 gw 172.1.1.2

ines@doc001:/$sudo route -n

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.100.100.0   0.0.0.0         255.255.255.0   U     0      0        0 eth1
172.1.1.0       172.1.1.2       255.255.255.0   UG    0      0        0 ath0
172.1.1.0       0.0.0.0         255.255.255.0   U     0      0        0 ath0
163.117.144.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0
0.0.0.0         163.117.144.2   0.0.0.0         UG    0      0        0 eth0

Ya tendriamos configurado el punto de acceso

--Ines 12:51 19 dic 2007 (CET)