Wi-Fi: Difference between revisions
m Text replacement - "<code>" to "{{code|" |
m Text replacement - "</code>" to "}}" |
||
| Line 38: | Line 38: | ||
pacman -S wpa_supplicant | pacman -S wpa_supplicant | ||
You will need to create a netctl profile in /etc/netctl. This can be done either manually or through the {{code|wifi-menu | You will need to create a netctl profile in /etc/netctl. This can be done either manually or through the {{code|wifi-menu}} command. Example WPA configuration files can be viewed in {{code|/etc/netctl/examples/wireless-wpa}} and can be copied to {{code|/etc/netctl}} and used as a template configuration file. | ||
<syntaxhighlight lang="text"> | <syntaxhighlight lang="text"> | ||
| Line 51: | Line 51: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Your {{code|Key | Your {{code|Key}} can be your password or the PSK key generated using {{code|wpa_passphrase}}. {{code|wifi-menu}} will automatically generate and use the PSK key instead of storing the plain text copy of the password. | ||
<syntaxhighlight lang="text"> | <syntaxhighlight lang="text"> | ||
| Line 65: | Line 65: | ||
netctl start '''profile-name''' | netctl start '''profile-name''' | ||
If it errors out, check the systemd logs using {{code|journalctl -xe | If it errors out, check the systemd logs using {{code|journalctl -xe}}. If you're still having issues connecting, you may want to try reseating the wireless device or rebooting the machine. | ||
To make the machine join a wireless access point automatically, create a startup script (see [[Systemd]] for more information) containing: | To make the machine join a wireless access point automatically, create a startup script (see [[Systemd]] for more information) containing: | ||
Revision as of 19:15, 24 February 2017
Monitoring Access Points
To monitor data on the wifi network, install aircrack-ng, then run:
airomon-ng start wlan0 airodump-ng wlan0
You may get an error like:
[root@alarmpi ~]# airodump-ng wlan0
ioctl(SIOCSIWMODE) failed: Device or resource busy
ARP linktype is set to 1 (Ethernet) - expected ARPHRD_IEEE80211,
ARPHRD_IEEE80211_FULL or ARPHRD_IEEE80211_PRISM instead. Make
sure RFMON is enabled: run 'airmon-ng start wlan0 <#>'
Sysfs injection support was not found either.
Make sure that the wireless device is in the monitor mode and then try again.
[root@alarmpi ~]# iwconfig wlan0
wlan0 IEEE 802.11bgn ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=20 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
[root@alarmpi ~]# ifconfig wlan0 down
[root@alarmpi ~]# iwconfig wlan0 mode monitor
[root@alarmpi ~]# ifconfig wlan0 up
[root@alarmpi ~]# iwconfig wlan0
wlan0 IEEE 802.11bgn Mode:Monitor Frequency:2.422 GHz Tx-Power=20 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:off
Automatically Connecting
Install wpa_supplicant since it's required to connect to wpa networks:
pacman -S wpa_supplicant
You will need to create a netctl profile in /etc/netctl. This can be done either manually or through the wifi-menu command. Example WPA configuration files can be viewed in /etc/netctl/examples/wireless-wpa and can be copied to /etc/netctl and used as a template configuration file.
# cat /etc/netctl/wlan0-dd-wrt
Description='Automatically generated profile by wifi-menu'
Interface=wlan0
Connection=wireless
Security=wpa
ESSID=dd-wrt
IP=dhcp
Key=\"f0c8a9e643*************************************************af10f
Your Key can be your password or the PSK key generated using wpa_passphrase. wifi-menu will automatically generate and use the PSK key instead of storing the plain text copy of the password.
# wpa_passphrase dd-wrt ap_password
network={
ssid="dd-wrt"
#psk="ap_password"
psk=14c5441f17e930da158a71592c3c7914315424f08d03c225d1092076093c32ee
}
You can then connect to the access point by running:
netctl start profile-name
If it errors out, check the systemd logs using journalctl -xe. If you're still having issues connecting, you may want to try reseating the wireless device or rebooting the machine.
To make the machine join a wireless access point automatically, create a startup script (see Systemd for more information) containing:
#!/bin/sh
sh -c 'while ! netctl start wlan0-dd-wrt ; do echo Wi-Fi failed to come up. Retrying ; sleep 1 ; done'