dev.nlited.com

>>

WiFi

<<<< prev
next >>>>

2015-12-23 04:45:42 chip Page 1484 📢 PUBLIC

Disabling WiFi

To temporarily stop the WiFi from spamming the console:
systemctl stop wpa_supplicant@wlan0.service
To permanently stop WiFi:
systemctl disable wpa_supplicant@wlan0.service
To re-enable:
systemctl enable wpa_supplicant@wlan0.service



Mistake icon

The only reason why WiFi did not just work out of the box was because I failed to connect the antenna. However, if the WiFi AP requires a passphrase (mine does), the wpa_supplicant configuration needs to be updated before the overo will be able to authenticate.

The only change that was actually required was to edit /etc/wpa_supplicant/wpa_supplicant-wlan0.conf to add the ssid and passphrase for my network. The file /etc/wpa_supplicant.conf is not used and should be deleted if it exists.


This post has some hints about enabling WiFi.


/etc/network/interfaces: auto wlan0 iface wlan0 inet static pre-up wpa_supplicant -Dwext -iwlan0 -c/etc/network/wpa_supplicant.conf -B down killall wpa_supplicant address 192.168.0.244 netmask 255.255.255.0 gateway 192.168.0.1
/etc/network/wpa_supplicant.conf: ctrl_interface=/var/run/wpa_supplicant eapol_version=1 ap_scan=1 fast_reauth=1 ### WPA2-PSK network={ ssid="Anchor1-24" psk="*****" proto=WPA2 RSN key_mgmt=WPA2-PSK pairwise=CCMP TKIP group=CCMP TKIP priority=10 scan_ssid=1 }

Dec 23 2015

It worked! It only seemed to work, it was actually routing the traffic out the ethernet port.

overo: root@overo:/etc/network# rm /var/run/wpa_supplicant/wlan0 root@overo:/etc/network# ifup wlan0 Successfully initialized wpa_supplicant [ 403.323760] wlcore: PHY firmware version: Rev 8.2.0.0.195 [ 403.430541] wlcore: firmware booted (Rev 8.8.0.0.13) [ 403.473144] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready ioctl[SIOCSIWMODE]: Operation not supported ioctl[SIOCGIWRANGE]: Operation not supported ioctl[SIOCGIWMODE]: Operation not supported ioctl[SIOCSIWAP]: Operation not supported ioctl[SIOCSIWESSID]: Operation not supported ioctl[SIOCSIWENCODEEXT]: Operation not supported ioctl[SIOCSIWENCODE]: Operation not supported ioctl[SIOCSIWENCODEEXT]: Operation not supported ioctl[SIOCSIWENCODE]: Operation not supported ioctl[SIOCSIWENCODEEXT]: Operation not supported ioctl[SIOCSIWENCODE]: Operation not supported ioctl[SIOCSIWENCODEEXT]: Operation not supported ioctl[SIOCSIWENCODE]: Operation not supported run-parts: /etc/network/if-up.d: No such file or directory root@overo:/etc/network# ifconfig eth0 Link encap:Ethernet HWaddr 00:15:C9:29:2B:75 inet addr:192.168.0.215 Bcast:192.168.0.255 Mask:255.255.255.0 inet6 addr: fe80::215:c9ff:fe29:2b75/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:654 errors:0 dropped:0 overruns:0 frame:0 TX packets:58 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:66991 (65.4 KiB) TX bytes:7728 (7.5 KiB) Interrupt:32 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:65536 Metric:1 RX packets:167 errors:0 dropped:0 overruns:0 frame:0 TX packets:167 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:12762 (12.4 KiB) TX bytes:12762 (12.4 KiB) wlan0 Link encap:Ethernet HWaddr 5C:31:3E:58:5D:5E inet addr:192.168.0.244 Bcast:192.168.0.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) root@overo:/etc/network#

I had to manually delete the file /var/run/wpa_supplicant/wlan0 that was left over from a previous failed attempt. There were several error/warning messages that I ignored. This configuration sets a static IP address of 192.168.0.244. I was able to ping the wlan0 interface from my host machine, but I later determined that the traffic was somehow still using the ethernet cable.

I should have looked a bit closer: These files already existed with default values:
/etc/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant-wlan0.conf

/etc/wpa_supplicant.conf: ctrl_interface=/var/run/wpa_supplicant ctrl_interface_group=0 update_config=1 network={ key_mgmt=NONE }
/etc/wpa_supplicant/wpa_supplicant-wlan0.conf: # Adjust this file for your network. See [1] for # more details. # [1] http://linux.die.net/man/5/wpa_supplicant.conf ctrl_interface=/var/run/wpa_supplicant ctrl_interface_group=0 update_config=1 # Connect to any open network network={ key_mgmt=NONE } # Connect to a WPA2 protected network #network={ # ssid="add-your-ascii-ssid" # proto=WPA2 # key_mgmt=WPA-PSK # pairwise=CCMP TKIP # group=CCMP TKIP # scan_ssid=1 # psk="add-your-ascii-passphrase" # priority=10 #}

Side note: I discovered that the overo includes a full version of vim, not just the busybox version.

I changed /etc/wpa_supplicant.conf and /etc/wpa_supplicant/wpa_supplicant-wlan0.conf, disconnected the ethernet cable, and rebooted. I then ran "ifup wlan0". It complained about /var/run/wpa_supplicant/wlan0 so I deleted it and tried again. It worked!

overo: Poky (Yocto Project Reference Distro) 1.8 overo ttyO2 overo login: root root@overo:~# ifconfig eth0 Link encap:Ethernet HWaddr 00:15:C9:29:2B:75 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:1 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:64 (64.0 B) Interrupt:32 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:65536 Metric:1 RX packets:160 errors:0 dropped:0 overruns:0 frame:0 TX packets:160 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:12160 (11.8 KiB) TX bytes:12160 (11.8 KiB) wlan0 Link encap:Ethernet HWaddr 5C:31:3E:58:5D:5E 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) root@overo:~# ifup wlan0 Successfully initialized wpa_supplicant ioctl[SIOCSIWMODE]: Operation not supported ioctl[SIOCGIWRANGE]: Operation not supported ioctl[SIOCGIWMODE]: Operation not supported ioctl[SIOCSIWAP]: Operation not supported ioctl[SIOCSIWESSID]: Operation not supported ioctl[SIOCSIWENCODEEXT]: Operation not supported ioctl[SIOCSIWENCODE]: Operation not supported ioctl[SIOCSIWENCODEEXT]: Operation not supported ioctl[SIOCSIWENCODE]: Operation not supported ioctl[SIOCSIWENCODEEXT]: Operation not supported ioctl[SIOCSIWENCODE]: Operation not supported ioctl[SIOCSIWENCODEEXT]: Operation not supported ioctl[SIOCSIWENCODE]: Operation not supported ctrl_iface exists and seems [ 48.018585] wlcore: down to be in use - cannot override it Delete '/var/run/wpa_supplicant/wlan0' manually if it is not used anymore Failed to initialize control interface '/var/run/wpa_supplicant'. You may have another wpa_supplicant process already running or the file was left by an unclean termination of wpa_supplicant in which case you will need to manually remove this file before starting wpa_supplicant again. ioctl[SIOCGIWMODE]: Operation not supported ioctl[SIOCSIWAP]: Operation not supported ioctl[SIOCSIWESSID]: Operation not supported root@overo:~# rm /var/run/wpa_supplicant/wlan0 root@overo:~# ifup wlan0 Successfully initialized wpa_supplicant [ 67.480194] wlcore: PHY firmware version: Rev 8.2.0.0.195 [ 67.590637] wlcore: firmware booted (Rev 8.8.0.0.13) [ 67.633972] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready ioctl[SIOCSIWMODE]: Operation not supported ioctl[SIOCGIWRANGE]: Operation not supported ioctl[SIOCGIWMODE]: Operation not supported ioctl[SIOCSIWAP]: Operation not supported ioctl[SIOCSIWESSID]: Operation not supported ioctl[SIOCSIWENCODEEXT]: Operation not supported ioctl[SIOCSIWENCODE]: Operation not supported ioctl[SIOCSIWENCODEEXT]: Operation not supported ioctl[SIOCSIWENCODE]: Operation not supported ioctl[SIOCSIWENCODEEXT]: Operation not supported ioctl[SIOCSIWENCODE]: Operation not supported ioctl[SIOCSIWENCODEEXT]: Operation not supported ioctl[SIOCSIWENCODE]: Operation not supported run-parts: /etc/network/if-up.d: No such file or directory root@overo:~# [ 71.212615] wlan0: authenticate with c4:6e:1f:4f:b1:ca [ 71.235992] wlan0: send auth to c4:6e:1f:4f:b1:ca (try 1/3) [ 71.260345] wlan0: authenticated [ 71.275970] wlan0: associate with c4:6e:1f:4f:b1:ca (try 1/3) [ 71.289062] wlan0: RX AssocResp from c4:6e:1f:4f:b1:ca (capab=0x431 status=0 aid=6) [ 71.326751] wlan0: associated [ 71.330444] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready [ 71.527435] wlcore: Association completed. root@overo:~# ifconfig eth0 Link encap:Ethernet HWaddr 00:15:C9:29:2B:75 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:1 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:64 (64.0 B) Interrupt:32 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:65536 Metric:1 RX packets:328 errors:0 dropped:0 overruns:0 frame:0 TX packets:328 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:24970 (24.3 KiB) TX bytes:24970 (24.3 KiB) wlan0 Link encap:Ethernet HWaddr 5C:31:3E:58:5D:5E inet addr:192.168.0.244 Bcast:192.168.0.255 Mask:255.255.255.0 inet6 addr: fe80::5e31:3eff:fe58:5d5e/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:18 errors:0 dropped:0 overruns:0 frame:0 TX packets:30 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1418 (1.3 KiB) TX bytes:4668 (4.5 KiB) root@overo:~# ping 192.168.0.1 PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data. 64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=27.5 ms 64 bytes from 192.168.0.1: icmp_seq=2 ttl=64 time=35.8 ms 64 bytes from 192.168.0.1: icmp_seq=3 ttl=64 time=25.3 ms ^C --- 192.168.0.1 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2003ms rtt min/avg/max/mdev = 25.359/29.571/35.827/4.511 ms root@overo:~#

I am able to ping out from overo to Pogo, but I cannot ping from Pogo into overo. I left overo pinging and it eventually failed.

overo: root@overo:~# ping 192.168.0.1 PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data. From 192.168.0.248 icmp_seq=1 Destination Host Unreachable From 192.168.0.248 icmp_seq=2 Destination Host Unreachable From 192.168.0.248 icmp_seq=3 Destination Host Unreachable From 192.168.0.248 icmp_seq=4 Destination Host Unreachable From 192.168.0.248 icmp_seq=5 Destination Host Unreachable From 192.168.0.248 icmp_seq=6 Destination Host Unreachable 64 bytes from 192.168.0.1: icmp_seq=11 ttl=64 time=191 ms 64 bytes from 192.168.0.1: icmp_seq=12 ttl=64 time=99.9 ms 64 bytes from 192.168.0.1: icmp_seq=15 ttl=64 time=104 ms 64 bytes from 192.168.0.1: icmp_seq=16 ttl=64 time=113 ms 64 bytes from 192.168.0.1: icmp_seq=17 ttl=64 time=22.1 ms 64 bytes from 192.168.0.1: icmp_seq=18 ttl=64 time=21.2 ms 64 bytes from 192.168.0.1: icmp_seq=19 ttl=64 time=37.0 ms ^C --- 192.168.0.1 ping statistics --- 19 packets transmitted, 7 received, +6 errors, 63% packet loss, time 18037ms rtt min/avg/max/mdev = 21.210/84.227/191.435/57.386 ms, pipe 4 root@overo:~# ping 192.168.0.1 205 PING 192.168.0.205 (192.168.0.205) 56(84) bytes of data. 64 bytes from 192.168.0.205: icmp_seq=1 ttl=128 time=32.4 ms 64 bytes from 192.168.0.205: icmp_seq=2 ttl=128 time=47.2 ms 64 bytes from 192.168.0.205: icmp_seq=4 ttl=128 time=1026 ms 64 bytes from 192.168.0.205: icmp_seq=5 ttl=128 time=27.7 ms 64 bytes from 192.168.0.205: icmp_seq=6 ttl=128 time=1438 ms 64 bytes from 192.168.0.205: icmp_seq=7 ttl=128 time=1417 ms [ 185.624572] wlcore: Beacon loss detected. roles:0x1 [ 190.434234] wlcore: Connection loss work (role_id: 0). [ 190.440765] wlan0: Connection to AP c4:6e:1f:4f:b1:ca lost [ 190.520294] cfg80211: Calling CRDA to update world regulatory domain [ 194.138275] wlan0: authenticate with c4:6e:1f:4f:b1:ca [ 194.150512] wlan0: send auth to c4:6e:1f:4f:b1:ca (try 1/3) [ 194.181335] wlan0: authenticated [ 194.194610] wlan0: associate with c4:6e:1f:4f:b1:ca (try 1/3) [ 194.382629] wlan0: associate with c4:6e:1f:4f:b1:ca (try 2/3) [ 194.542694] wlan0: associate with c4:6e:1f:4f:b1:ca (try 3/3) [ 194.561553] wlan0: RX AssocResp from c4:6e:1f:4f:b1:ca (capab=0x431 status=0 aid=6) [ 194.596069] wlan0: associated [ 199.296966] wlan0: disassociated from c4:6e:1f:4f:b1:ca (Reason: 2)

I found the list of WiFi failure codes and "Reason 2" is "Previous authentication no longer valid, Client has associated but is not authorised." It appears that wlan0 is associating to the AP, allowing pings out, but then failing to authenticate. This might explain why the AP may allow pings out but not into the device.

While I was reading up on error codes, the overo finally authenticated. I was then able to ping from Pogo to Overo, although the failure rate was very high. This is undoubtedly due to having no antenna connected to the Overo.

WiFi works much better with the antenna! WiFi now activates automatically during boot, no longer requiring the "ifup" command, and is using DHCP. It seems WiFi was already enabled in systemd but was failing due to poor signal. Moral of the lesson: antennas are important.

I am now able to ssh into Overo using Putty over the WiFi interface.

To clean up, I deleted the /etc/network/interfaces and /etc/network/wpa_supplicant.conf files.

Systemd

This page describes how systemd configures the network. The files are found in /etc/systemd/network/

I need to give my little overo a less generic name, now that I am joining the network as a DHCP client. I dub thee, "Tivovy!" This is set in /etc/hostname. Even better, it just works! I am now able to ping "tivovy" from Pogo using both IPv4 and IPv6, and ssh into Tivovy. No more static IP addresses!

/etc/wpa_supplicant/wpa_supplicant-wlan0.conf: # Adjust this file for your network. See [1] for # more details. # [1] http://linux.die.net/man/5/wpa_supplicant.conf ctrl_interface=/var/run/wpa_supplicant ctrl_interface_group=0 update_config=1 # Connect to any open network network={ key_mgmt=NONE } # Connect to a WPA2 protected network network={ ssid="Anchor1-24" proto=WPA2 key_mgmt=WPA-PSK pairwise=CCMP TKIP group=CCMP TKIP scan_ssid=1 psk="******" priority=10 }
/etc/systemd/network/wifi: [Match] Name=wlan0 [Network] DHCP=yes


WebV7 (C)2018 nlited | Rendered by tikope in 35.037ms | 18.222.164.7