Managed mode w/ WPA supplicant

Search for Masters

identify and give birth to your wireless interface

#rfkill list
ifconfig -a
iwconfig
netif=NETIF
ifconfig $netif up

have a look at the existing SSIDs around

iwlist $netif scan | grep SSID | sort -u
iwlist $netif scan | egrep 'Cell|SSID|Signal|Channel|802\.11' | less

now look more precisely what kind of authentication they want

iwlist $netif scan | less

e.g. you might see WPA-PSK/TKIP

IE: WPA Version 1
    Group Cipher : TKIP
    Pairwise Ciphers (1) : TKIP
    Authentication Suites (1) : PSK

or WPA2-EAP/CCMP

IE: IEEE 802.11i/WPA2 Version 1
    Group Cipher : CCMP
    Pairwise Ciphers (1) : CCMP
    Authentication Suites (1) : 802.1x

or non-protected and open network

Encryption key:off

WPA-PSK/TKIP

#ubuntu
cp /usr/share/doc/wpa_supplicant/examples/wpa-psk-tkip.conf /etc/wpa.conf
chmod 600 /etc/wpa.conf
wpa_passphrase SSID PASSPHRASE
vi /etc/wpa.conf

comment out ctrl_interface and change ssid/psk

network={
        ssid="SSID-HERE"
        key_mgmt=WPA-PSK
        proto=WPA
        pairwise=TKIP
        group=TKIP
        psk="GENERATED-PSK-HERE"
}

WPA2-EAP/CCMP using EAP-PEAP

#ubuntu
cat /usr/share/doc/wpa_supplicant/examples/wpa2-eap-ccmp.conf
cat /usr/share/doc/wpa_supplicant/examples/ieee8021x.conf
vi /etc/wpa.conf

network={
    ssid="SSID-HERE"
    key_mgmt=WPA-EAP
    proto=WPA2
    pairwise=CCMP
    group=CCMP
    eap=PEAP
    identity="user name"
    password="password"
}

open network / non-protected

no need for WPA supplicant here

iwconfig $netif essid SSID-HERE

Ready to go

check that you wireless interface gets Associated and that you get a DHCP lease

wpa_supplicant -h
wpa_supplicant -i $netif -c /etc/wpa.conf
iwconfig $netif
dhclient -v $netif
ifconfig $netif
#ifconfig $netif promisc
dhclient -r $netif

then eventually enable the WPA client at boot-time while using syslog (-s)

#tail -F /var/log/kern.log /var/log/syslog
nohup wpa_supplicant -s -i NETIF -c /etc/wpa.conf &

otherwise use debian’s network setup

auto wlan0
iface wlan0 inet dhcp 
    wpa-ssid {ssid}
    wpa-psk  {password}

Ad-hoc mode

we can also have a look at the ad-hoc cells,

draft, only the ad-hoc interface can see itself – why?

ifconfig $netif down
iwconfig $netif mode ad-hoc
iwconfig $netif channel X

ifconfig $netif up
iwlist $netif scan
iwconfig $netif rate 54Mb/s
iwconfig $netif essid 'ESSID'
ifconfig $netif x.x.x.x/xx up

Resources

IEEE 802.11 Wireless Networks http://www.vias.org/wirelessnetw/wndw_05_04.html

HakTip 9 – WiFi 101: The 6 Modes of Wireless https://www.hak5.org/episodes/haktip-9

WPA supplicant https://wiki.archlinux.org/index.php/WPA_supplicant

wpa_supplicant https://wiki.gentoo.org/wiki/Wpa_supplicant

Using WPA_Supplicant to Connect to WPA2 Wi-fi from Terminal on Ubuntu 16.04 Server https://www.linuxbabe.com/command-line/ubuntu-server-16-04-wifi-wpa-supplicant

Configuring WPA2 using wpa_supplicant on the Raspberry Pi https://kerneldriver.wordpress.com/2012/10/21/configuring-wpa2-using-wpa_supplicant-on-the-raspberry-pi/

Example wpa_supplicant configuration file https://w1.fi/cgit/hostap/plain/wpa_supplicant/wpa_supplicant.conf https://www.cs.upc.edu/lclsi/Manuales/wireless/files/wpa_supplicant.conf

open/non-protected & wep?

Connecting to a wireless network (open and protected) from terminal https://superuser.com/questions/1119937/connecting-to-a-wireless-network-open-and-protected-from-terminal

Connecting to wifi network through command line https://unix.stackexchange.com/questions/92799/connecting-to-wifi-network-through-command-line

EAP

Connect to a WPA2 Enterprise network with wpa_supplicant https://gist.github.com/kyleraymorgan/fb404500adafe1ebdb66

802.1x/radius https://wiki.archlinux.org/index.php/WPA_supplicant#802.1x/radius

ad-hoc

Mobile Ad Hoc Networking https://books.google.ru/books?id=GnkcHEsxAigC (&hl=en)


Nethence | Pub | Lab | Pbraun | SNE Russia | xhtml