Debugging Your Wireless
Mar 30, 2016
Sometimes you will run into issues while using your wireless. There are thankfully some tools in LEDE/OpenWRT that you can use to help debug and diagnose the faults.
Capture Management Traffic
You can capture management traffic from your LEDE/OpenWRT device. For example, run the command below, which will do the following:
- Open a monitor session with a mac80211 based driver
- Start tcpdump
-
Save the captured data locally into /tmp
ssh [email protected] ‘grep -q mon0 /proc/net/dev || /usr/sbin/iw phy phy0 interface add mon0 type monitor; /sbin/ifconfig mon0 up; /usr/sbin/tcpdump -s 0 -i mon0 -y IEEE802_11_RADIO -w -‘ > /tmp/wifi.pcap
Logging hostapd
First you will need to SSH into your device. If you are using Windows then start PuTTY and click Session on the left side, select SSH from the options, and then enter in the IP Address of your LEDE/OpenWRT box into the Host Name field.
Once you’ve done this just click on Open to start up the SSH connection.
If you are connecting via terminal, then just SSH to your OpenWRT device using the following command, where 192.168.1.1 is your OpenWRT device’s IP address.
Once connected, if you want to see what level the logs are on at the moment, run the following that will show the hostapds running:
ps | grep hostapd
and you should get something similar to the following output:
6948 root 1784 S /usr/sbin/hostapd -P /var/run/wifi-phy1.pid -B /var/run/hostapd-phy1.conf
6987 root 1784 S /usr/sbin/hostapd -P /var/run/wifi-phy0.pid -B /var/run/hostapd-phy0.conf
7019 root 1448 S grep hostapd
Then select which one you want to check the level of, in this case we are going to check phy1. So run the following:
grep _level /var/run/hostapd-phy1.conf
Which will output something similar to this:
logger_syslog_level=2
logger_stdout_level=2
Each level is numbered as follows:
- Debugging
- Informational Messages
- Notification
- Warning
Now if you want to change the level, run the following commands:
uci set wireless.radio0.log_level=1
uci commit wireless
wifi up
Now you can run the logread command to display the logs at the level you have specified.
CT WiFi is a cloud based WiFi management platform for businesses. The firmware gives consumer-grade WiFi access points enterprise-like capabilities. Or you can utilise the captive portal solution with your existing infrastructure. Create a free account and check it here ct-networks.io