Wi-Fi: Difference between revisions
| Line 1: | Line 1: | ||
== Monitoring Access Points == | == Monitoring Access Points == | ||
To monitor data on the wifi network, install aircrack-ng, then run: | 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: | You may get an error like: | ||
<syntaxhighlight lang="text"> | |||
[root@alarmpi ~]# airodump-ng wlan0 | [root@alarmpi ~]# airodump-ng wlan0 | ||
ioctl(SIOCSIWMODE) failed: Device or resource busy | ioctl(SIOCSIWMODE) failed: Device or resource busy | ||
| Line 16: | Line 13: | ||
sure RFMON is enabled: run 'airmon-ng start wlan0 <#>' | sure RFMON is enabled: run 'airmon-ng start wlan0 <#>' | ||
Sysfs injection support was not found either. | Sysfs injection support was not found either. | ||
</syntaxhighlight> | |||
Make sure that the wireless device is in the monitor mode and then try again. | Make sure that the wireless device is in the monitor mode and then try again. | ||
<syntaxhighlight lang="text"> | |||
[root@alarmpi ~]# iwconfig wlan0 | [root@alarmpi ~]# iwconfig wlan0 | ||
wlan0 IEEE 802.11bgn ESSID:off/any | wlan0 IEEE 802.11bgn ESSID:off/any | ||
| Line 35: | Line 32: | ||
Retry short limit:7 RTS thr:off Fragment thr:off | Retry short limit:7 RTS thr:off Fragment thr:off | ||
Power Management:off | Power Management:off | ||
</syntaxhighlight> | |||
== Automatically Connecting == | == Automatically Connecting == | ||
Install wpa_supplicant since it's required to connect to wpa networks: | 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 | You will need to create a netctl profile in /etc/netctl. This can be done either manually or through the <code>wifi-menu</code> command. Example WPA configuration files can be viewed in <code>/etc/netctl/examples/wireless-wpa</code> and can be copied to <code>/etc/netctl</code> and used as a template configuration file. | ||
<syntaxhighlight lang="text"> | |||
# cat /etc/netctl/wlan0-dd-wrt | # cat /etc/netctl/wlan0-dd-wrt | ||
Description='Automatically generated profile by wifi-menu' | Description='Automatically generated profile by wifi-menu' | ||
| Line 54: | Line 49: | ||
IP=dhcp | IP=dhcp | ||
Key=\"f0c8a9e643*************************************************af10f | Key=\"f0c8a9e643*************************************************af10f | ||
</syntaxhighlight> | |||
Your | Your <code>Key</code> can be your password or the PSK key generated using <code>wpa_passphrase</code>. <code>wifi-menu</code> will automatically generate and use the PSK key instead of storing the plain text copy of the password. | ||
<syntaxhighlight lang="text"> | |||
# wpa_passphrase dd-wrt ap_password | # wpa_passphrase dd-wrt ap_password | ||
network={ | network={ | ||
| Line 65: | Line 60: | ||
psk=14c5441f17e930da158a71592c3c7914315424f08d03c225d1092076093c32ee | psk=14c5441f17e930da158a71592c3c7914315424f08d03c225d1092076093c32ee | ||
} | } | ||
</syntaxhighlight> | |||
You can then connect to the access point by running: | You can then connect to the access point by running: | ||
netctl start '''profile-name''' | |||
If it errors out, check the systemd logs using <code>journalctl -xe</code>. 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: | |||
<syntaxhighlight lang="bash">#!/bin/sh | |||
sh -c 'while ! netctl start wlan0-dd-wrt ; do echo Wi-Fi failed to come up. Retrying ; sleep 1 ; done' | |||
</syntaxhighlight> | |||
== See Also == | == See Also == | ||
* https://wiki.archlinux.org/index.php/netctl | * https://wiki.archlinux.org/index.php/netctl | ||
Revision as of 23:34, 12 August 2018
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'