2

I have a Raspberry Pi 3 with Stretch and wish to install a Realtek USB WLAN adapter. There are various tutorials on how to do this in the Pi 2, but none on the Pi 3 since it has a built-in wifi adapter. Also I understand things work a little differently with Stretch. How should I install the USB WLAN adapter?

Running usb-devices indicates it recognises the USB dongle:

S:  Manufacturer=Realtek
S:  Product=802.11n WLAN Adapter

Running iwconfig shows that the native adapter is running:

wlan0     IEEE 802.11  ESSID:off/any
          Mode:Managed  Access Point: Not-Associated
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:on

What steps should I take to get the USB WLAN adapter up and running?

3

Assuming that;

  1. You're using the Command Line ('Lite') version of Stretch
  2. You have an eth0 connection already set up
  3. You are on a network in the 10.1.1.x space (netmask 255.255.255.0 and gateway 10.1.1.1)

If you are comfortable having a dynamic address set by the local DHCP provider (ADSL modem or similar) you should be able to simply edit wpa_supplicant.conf;

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Add the ssid (the wireless network name) and the password for the WiFi network here so that the file looks as follows (using your ssid and password of course);

country=NZ
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
network={
    ssid="homenetwork"
    psk="h0mepassw0rd"
    key_mgmt=WPA-PSK
}

(The country=NZ line will probably indicate a different country depending on what you have set up as your localisation configuration.)

To allow the changes to become operative we can type in;

sudo reboot

Once we have rebooted, we can check the status of our network interfaces by typing in;

ifconfig

This should show all the configured connections;

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.1.1.8  netmask 255.255.255.0  broadcast 10.1.1.255
        inet6 fe80::1cee:e236:9bda:2be8  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:b6:2e:da  txqueuelen 1000  (Ethernet)
        RX packets 6475  bytes 681495 (665.5 KiB)
        RX errors 0  dropped 20  overruns 0  frame 0
        TX packets 5557  bytes 705463 (688.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 2  bytes 224 (224.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2  bytes 224 (224.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 10.1.1.10  netmask 255.255.255.0  broadcast 10.1.1.255
        inet6 fe80::c0e4:a1e5:8788:c2c2  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:e3:7b:8f  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.1.1.11  netmask 255.255.255.0  broadcast 10.1.1.255
        inet6 fe80::c0e4:a1e5:8788:c2c2  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:0b:47:0b:39  txqueuelen 1000  (Ethernet)
        RX packets 6648  bytes 815679 (796.5 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 681  bytes 100619 (98.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

So long as your usb dongle has been recognized automagically at the start (which you indicated it was) you should now be able to use wlan1 at the IP address 10.1.1.11.

If you want to make the wlan1 IP address static edit the /etc/dhcpcd.conf file with the command…

sudo nano /etc/dhcpcd.conf

This time add the details for the wlan1 connection to the end of the file. Those details (assuming we will use the 10.1.1.11 IP address) should look like the following;

# Custom static IP address for wlan1.
interface wlan1
static ip_address=10.1.1.11/24
static routers=10.1.1.1
static domain_name_servers=10.1.1.1

Where your main router (and presumeably your gateway) have the address 10.1.1.1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.