Filed under Linux
Tagged as Linux Wireless TL-WN725N Command Line
Article Contents
Overview
I like using an old fashioned desktop machine at home. It’s always on and acts as a hub machine, or “server”, if you will. Unfortunately, my current home isn’t cabled with Ethernet, and I’ve recently rearranged furniture and needed a wireless card. We had a TP-Link TL-WN725N laying around and decided to use that.
I’m using Arch Linux and do all configuration from the command line. I found some conflicting information online about setting these devices up so I wanted to post my config in case it helps someone else.
The trick to getting these devices working is using the deprecated wext driver in wpa_supplicant.
Device Details
These adapters use a Realtec 8188EUS chipset, and, at least on Arch, the firmware is installed with the base system.
First the output from lsusb | grep 8188
. The grep
command supresses the output of lsusb that we don’t care to see, i.e., other usb devices.
|
|
We can do the same thing with lsmod
to verify that the driver [r8188eu] has been loaded by the kernel.
|
|
The device should show up as a network adapter using the ip link
command.
|
|
You’ll often see tutorials usingwlan0
as the network device name. I’m not sure which distros might use that naming convention in 2019, but Arch, CentOS, and Ubuntu aren’t among them. You can see above my wireless adapter is named wlp0s26f7u6
.
Device Configuration
To configure my wireless network I am using wpa_supplicant. To make this work I needed to create a wpa_supplicant configuration file. Then we can bring up the connection and tell dhcpcd to grab an IP address.
One caveat with this chipset is that we must tell wpa_supplicant to use the deprecated driver wext
and not nl80211
.
Configuration File wpa_supplicant.conf
Configuration files go in /etc/wpa_supplicant/
. If you want to start this card and connect on boot my suggestion is to name your configuration file using this convention wpa_supplicant-wext-interface.conf (wext to specify the driver). On my system this file is called /etc/wpa_supplicant/wpa_supplicant-wext-wlp0s26f7u6.conf
. Later I will show how to setup systemd to connect the wireless interface on boot.
My file looks like this:
# specify thelocation of the controller interface socket.
ctrl_interface=/run/wpa_supplicant
# allow frontend to be used by all users in 'wheel' group. if you don't
# have this or you aren't part of the wheel group you *must* run wpa_supplicant as root (not sudo).
ctrl_interface_group=wheel
# allow wpa_supplicant to overwrite the config file
update_config=1
# country code for the device
country=US
# defines wireless network specific settings
network={
# SSID of network
ssid="SUPER_WIFLY"
# plantext psk
# psk="hacktheplanet!"
# hashed psk
psk=49a10b06e9031de9dd49895a9cc5bcbe0ee3642119ba7a64ef93d49426c9751e
}
I used wpa_password to generate a hashed password for use in the conf file. However, you can use a plaintext password if you prefer by putting it in quotes after psk=
.
Using wpa_password is simple. Run it as wpa_password [SSID] [PASSWORD]
replacing SSID and PASSWORD with the appropriate values. It will then output a network configuration block that you can append to your interface config file.
|
|
Alrighty then, now that we have a everything squared away we can connect to the network and continue with life. While testing I created a two line bash script to bring up the network
|
|
The script starts wpa_supplicant and then tells dhcpcd to try to get an IP.
On the wpa_supplicant -B tells wpa_supplicant to go into the background after initializing, -D wext specifies the driver we need to use for this card, -i wlp0s26f7u6 is the interface we want to use, and -c /etc/wpa_supplicant/wpa_supplicant-wext-wlp0s26f7u6.conf specifies the configuration files.
To verify we have wpa_supplicant setup correctly run those commands and verify that you are connected and have an ip address. You can check that with the ip addr command. If you have an inet line under your wireless adapter you should also have network access.
|
|
Starting the Interface on Boot
This’s great so far, but I really prefer the network come up on it’s own after a reboot. So, I chose to use systemd.
Systemd is going to start wpa_supplicant for us, BUT our configuration file must be named in a specific way. That way is wpa_supplicant-wext-_interface_.conf
. That is the reason I suggested using that naming confection.
There are two ways we can force the interface to start using the wext driver. First, we could edit the standard wpa_supplicant@.service, or we can create a n ew wpa_supplicant-wext@.service unit. One isn’t provided for us, but there is a wpa_supplicant-nl80211@.service file we can copy and edit. So, yay!
That’’s what we’re gonna do.
|
|
Now we have our wpa_supplicant-wext@.service file open we just need to find and replace all instances of nl80211 with wext. Easy peasy lemon squeezy, my friend.
In vi use
:%s/nl80211/wext/g
to find and replace all nl80211 with wext.
After the replace our new .service file should look like this:
larntz@z400> cat /usr/lib/systemd/system/wpa_supplicant-wext@.service
[Unit]
Description=WPA supplicant daemon (interface- and wext driver-specific version)
Requires=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device
Before=network.target
Wants=network.target
# NetworkManager users will probably want the dbus version instead.
[Service]
Type=simple
ExecStart=/usr/bin/wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant-wext-%I.conf -Dwext -i%I
[Install]
Alias=multi-user.target.wants/wpa_supplicant-wext@%i.service
Now we can enable the systemd service for our wireless interface by sticking the interface name in between the @ and the .
|
|
Conclusion
On boot the wireless interface should be started and recieve an address via DHCP.
If these instructions aren’t working for you or you see an error please send me an email and let me know.