EBC Exercise 06 Setting Up Wifi

From eLinux.org
Jump to: navigation, search

thumb‎ Embedded Linux Class by Mark A. Yoder

See https://forum.beagleboard.org/t/debian-11-x-bullseye-monthly-snapshots/31280#network-1 for current instructions on the Wifi.


Here are details on how to set up Wifi:

Make sure you have registered the MAC address of the Wifi-Dongle. (This is different that the MAC address of the Beagle.)

bone$ ip a
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether c8:a0:30:a6:26:e8 brd ff:ff:ff:ff:ff:ff
    inet brd scope global dynamic eth0
       valid_lft 2591768sec preferred_lft 2591768sec
7: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 82:77:16:86:16:94 brd ff:ff:ff:ff:ff:ff
    inet brd scope global dynamic wlan0
       valid_lft 3403sec preferred_lft 3403sec
    inet6 fe80::8077:16ff:fe86:1694/64 scope link
       valid_lft forever preferred_lft forever

The MAC address for the wifi is 82:77:16:86:16:94

Next configure the Wifi (wpa_supplicant). Do this by editing the file /etc/wpa_supplicant/wpa_supplicant-wlan0.conf and put the following in it.

ctrl_interface=DIR=/run/wpa_supplicant GROUP=netdev


and then restart network with:

bone$ sudo /etc/init.d/networking restart

Connect to network:

bone$ sudo wpa_cli -i wlan0 reconfigure

Test by pinging google:

bone $ping -c2 google.com

Realtek Wifi adaptor

Hey all, just a note about the wifi dongles. If you've plugged yours in and don't see wlan0 after running ip a, check that it is connected by running

bone$ lsusb
Bus 001 Device 005: ID 0bda:f179 Realtek Semiconductor Corp. RTL8188FTV 802.11b/g/n 1T1R 2.4G WLAN Adapter
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

It should print out info about all the attached USB devices, including the chipset on the wifi dongle. If your dongle is using the rtl8188ftv chipset, you may need to get the correct driver for it before the beaglebone can use it. This page walks you through how to do it https://github.com/kelebek333/rtl8188fu.

Note: it involves rebuilding kernel modules, so it will take about 20 minutes to run on the Beaglebone.

Fixed MAC address

IF YOU NEED A STATIC MAC ADDRESS READ ON. Confused why your MAC, that you painstakingly registered with EIT, changes every time you reboot or disconnect your wifi dongle? Turns out RTL8188FTV chipsets are supposed to pull their MAC addresses from EEPROM, and these cheap Realtek RTL8188FTV wifi dongles don't appear to have included that EEPROM. As a result, the driver can't read a valid MAC address from the dongle, so it chooses a random MAC address anytime it detects and sets up the device. If you want to see this in action run

bone$ journalctl | grep mac

after connecting the dongle. Should get something like this:

Happily, we can override this and force the driver to use a MAC of our choosing (I suggest grabbing one of the random ones it generates, as they will be valid for this device type/manufacturer).

How do we do this? Edit the driver's config file (rtl8188fu.conf located in /etc/modprobe.d/) to add the line options rtl8188fu rtw_initmac=XX:XX:XX:XX:XX:XX where you replace the XXs with the desired MAC address. Reboot, and you should see that the MAC address is now the one you picked (and it shouldn't change if you unplug and replug the dongle now). If, in the future, you need to do something like this, you can search up what options can be configured for a driver with modinfo rtl8188fu where you replace rtl8188fu with the name of the driver.


Here's how to set up wifi on the Bone.

bone$ connmanctl
Error getting VPN connections: The name net.connman.vpn was not provided by any
connmanctl> scan wifi
Scan completed for wifi
connmanctl> services
*AR RHIT-OPEN            wifi_987bf3d2e45e_524849542d4f50454e_managed_none
    BeagleBone-DF34      wifi_987bf3d2e45e_426561676c65426f6e652d44463334_managed_psk
    eduroam              wifi_987bf3d2e45e_656475726f616d_managed_ieee8021x
    DIRECT-da-HP M132 LaserJet wifi_987bf3d2e45e_4449524543542d64612d4850204d313332204c617365724a6574_managed_psk

Here is a list of all the access points the Bone can see. Let's pick RHIT-OPEN and connect to it.

connmanctl> connect wifi_987bf3d2e45e_524849542d4f50454e_managed_none

If you get a "Not registered" error when trying to connect, run this:

connmanctl> agent on

Fortunately connmanctl has TAB completion, so you don't have to type the whole name, just type a few characters and then hit TAB. Once connected you can configure it so it will stay connected.

connmanctl> config wifi_987bf3d2e45e_524849542d4f50454e_managed_none --autoconnect yes

Then you can quit.

connmanctl> quit

See if you can hit google.

bone$ ping -c2 www.google.com
PING www.google.com ( 56(84) bytes of data.
64 bytes from ord36s02-in-f4.1e100.net ( icmp_seq=1 ttl=53 time=9.56 ms
64 bytes from ord36s02-in-f4.1e100.net ( icmp_seq=2 ttl=53 time=14.5 ms

--- www.google.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 9.563/12.045/14.528/2.484 ms

It looks good.

More Details

Yes can see help in connmanctl.

bone$ connmanctl
connmanctl> help
state                                 Shows if the system is online or offline
technologies                          Display technologies
clock                                 Get System Clock Properties
help                                  Show help
exit                                  Exit
quit                                  Quit

thumb‎ Embedded Linux Class by Mark A. Yoder