2

I'm running raspbian stretch on a Pi 3. I used these instructions, to use it as a wifi and ethernet router with systemd-networkd while USB tethering with my phone:

How can I set my up to be WiFi AND ethernet router simultaneously?

It works well, but I'm hoping that using a dedicated wifi usb dongle, rather than the integrated chip will boost the signal range, which is currently quite limited. Thus, I plugged in an 802.11 USB 2.0 wifi dongle by TP-Link: TL-WN721N.

It is recognized and the firmware is found and transferred to the device:

root@raspberrypi:/home/pi# lsusb

Bus 001 Device 009: ID 04e8:6863 Samsung Electronics Co., Ltd GT-I9500 [Galaxy S4] / GT-I9250 [Galaxy Nexus] (network tethering)
Bus 001 Device 011: ID 0cf3:9271 Atheros Communications, Inc. AR9271 802.11n
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

It isn't recognized as an interface:

root@raspberrypi:/home/pi# ifconfig
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet XXX  netmask 255.255.255.0  broadcast XXX
        inet6 XXX  prefixlen 64  scopeid 0x20<link>
        ether XXX  txqueuelen 1000  (Ethernet)
        RX packets 193945  bytes 19974390 (19.0 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 215853  bytes 204862309 (195.3 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether XXX  txqueuelen 1000  (Ethernet)
        RX packets 149329  bytes 11146560 (10.6 MiB)
        RX errors 0  dropped 5  overruns 0  frame 0
        TX packets 153299  bytes 121050626 (115.4 MiB)
        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 1000  (Local Loopback)
        RX packets 198  bytes 15881 (15.5 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 198  bytes 15881 (15.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet XXX  netmask 255.255.255.0  broadcast XXX
        inet6 XXX  prefixlen 64  scopeid 0x20<link>
        ether XXX  txqueuelen 1000  (Ethernet)
        RX packets 34059  bytes 43252645 (41.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 17832  bytes 2613527 (2.4 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 XXX  prefixlen 64  scopeid 0x20<link>
        ether XXX  txqueuelen 1000  (Ethernet)
        RX packets 56321  bytes 9517115 (9.0 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 68291  bytes 87965290 (83.8 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

dmesg:

[ 1670.073838] usb 1-1.3: new high-speed USB device number 11 using dwc_otg
[ 1670.224647] usb 1-1.3: New USB device found, idVendor=0cf3, idProduct=9271, bcdDevice= 1.08
[ 1670.224658] usb 1-1.3: New USB device strings: Mfr=16, Product=32, SerialNumber=48
[ 1670.224663] usb 1-1.3: Product: USB2.0 WLAN
[ 1670.224669] usb 1-1.3: Manufacturer: ATHEROS
[ 1670.224674] usb 1-1.3: SerialNumber: 12345
[ 1670.225308] usb 1-1.3: ath9k_htc: Firmware ath9k_htc/htc_9271-1.4.0.fw requested
[ 1670.516779] usb 1-1.3: ath9k_htc: Transferred FW: ath9k_htc/htc_9271-1.4.0.fw, size: 51008
[ 1670.776458] ath9k_htc 1-1.3:1.0: ath9k_htc: HTC initialized with 33 credits
[ 1671.209588] ath9k_htc 1-1.3:1.0: ath9k_htc: FW Version: 1.4
[ 1671.209597] ath9k_htc 1-1.3:1.0: FW RMW support: On
[ 1671.209603] ath: EEPROM regdomain: 0x809c
[ 1671.209606] ath: EEPROM indicates we should expect a country code
[ 1671.209609] ath: doing EEPROM country->regdmn map search
[ 1671.209613] ath: country maps to regdmn code: 0x52
[ 1671.209617] ath: Country alpha2 being used: CN
[ 1671.209620] ath: Regpair used: 0x52
[ 1671.221842] ieee80211 phy6: Atheros AR9271 Rev:1

What do I need to do register this dongle as an interface?

2

Using ifconfig -a displayed the interface, so the solution was to simply activate it using ifconfig wlan1 up.

I should also add that this will only activate it until the next reboot - in systemd-networkd, interfaces are automatically enabled once they are configured to do something. So you should use ifconfig -a to list them and check that they are working, and then configure them in /etc/systemd/network/ and they will be up automatically on reboot and do what you told them to do and this also seems to work fine with hotplugging. So you can use USB hardware and keep plugging it in and out and rebooting with and without and and once they become available, the interface will too.

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.