How to enable wifi in OpenWrt? and does luci support wifi?

hi, i want to to enable wifi but dont know how to enable it, what drivers are required for it.
and does luci-app support wifi?

any help will be appreciated
regards

2 Likes

but there is not option of wireless under network tab

depends on your device, and what additional packages it may require.

2 Likes

im using hlk 7621A and usb ports are using not working, drivers are already installed

Doesn't seem to be on the list

2 Likes

as @mbo2o already explained, if it's not a supported device, you've on your own.

2 Likes

@mbo2o @frollic While I am not sure which exact image is needed on the HLK-7621, it does seem supported, since people are running master on it:

It being an evaluation board might mean a generic mt7621 image might be sufficient. The fact @laiba is talking about USB ports, however, seems to suggest he is using some USB WiFi solution and that is definitely hit and miss pretty much any time.

1 Like

Here's how I go about this.

1. Hardware discovery

To do it, we need a utility called lspci. It is not installed by default, and it ships inside a package of PCI utilities called pciutils. So we need to install this package first:

opkg update && opkg install pciutils

Once installation is complete, run:

lspci -nn

This will give you a list of all identifiable devices sitting on the router's PCI bus. Let's say, you got this line among others:

07:00.0 Network controller [0280]: Qualcomm Atheros AR93xx Wireless Network Adapter [168c:0030] (rev 01)

Note the [168c:0030] part; this is the device's PCI identifier, and it is very useful in finding drivers, firmware, etc.

If you don't see your wireless card on the list, we've got a problem. The card may be faulty, or it is not receiving power, or it is installed incorrectly (for example, it sits in a slot that is designed for an SSD), or it is not a PCI card (there are also USB and SDIO cards). For the time being, let's assume that this is not our case.

2. Software search

Once you know the exact name of the device and its PCI identifier, you can do some targeted searching. I usually start at Hardware for Linux. For the device identified above, we could go straight to its Hardware for Linux page:

https://linux-hardware.org/?id=pci:168c-0030

Note the ending of the URL; it is a slightly reworked PCI identifier (you can do this with other devices, too). Hardware for Linux tells us that this device is known and in Linux source code, its driver resides at:

drivers/net/wireless/ath/ath9k/pci.c

In OpenWrt, NIC drivers are usually packaged as kernel modules. Package names for kernel modules usually start with kmod- and continue wtih the driver's name. So we surmise that in OpenWrt, the driver might be packaged as kmod-ath9k. If we search the Internet for OpenWrt kmod-ath9k, we quickly find this page:

https://openwrt.org/packages/pkgdata/kmod-ath9k

It tells us that kmod-ath9k "adds support for wireless adapters based on Atheros IEEE 802.11n AR5008 and AR9001 family of chipsets". We already know that our card is Atheros AR93xx, so AR9001 family sounds close enough and this is probably the package we want.

3. The actual installation

Now that we know what we need to install, let's install it:

opkg install kmod-ath9k

If this package is sufficient for the card's operation, you will immediately see status messages about a port called wlan0; it will change state, join the br-lan bridge, etc. If not, some other things may be needed, so we need to do some more searching. For example, the generation of cards that follows ath9k is ath10k, but unlike kmod-ath9k, kmod-ath10k often cannot work alone; it needs hostapd and card-specific firmware (for example, ath10k-firmware-qca988x) for company. This is something you will need to search out, or you can post a message here, tell us what card you have, what package(s) you have installed so far, and what, if anything, you saw in terms of status messages.

If you think your installation went well, you can run ip link; it will show you a list of ports available on your router. If you see wlan0 on the list, it means your installation has succeeded and your router knows how to use the wireless card. Now you need to give the router some additional instructions.

4. Configuration

Open your Web browser and point it to your router's IP address (by default, it is https://192.168.1.1, but you may have changed it). Enter your password when prompted, then go to Network >> Wireless. On the Wireless screen, click the Edit button. A complicated-looking Device Configuration dialog will open. At the very least, you should do the following:

  • Under Advanced Settings on top of the dialog, use the Country Code selector to choose the country you're in. This will tell the router which radio frequencies it is permitted to use (those are regulated to prevent interference with broadcasting, emergency services, and other uses of radio).
  • Down the dialog, under General Setup make sure that (1) Mode is set to Access Point, (2) you set ESSID (wireless network name) to something you like, and (3) the Network is set to lan (this will make sure that all your client devices, wired and wireless, will be on the same local network).
  • Also down the dialog, under Wireless Security, set Encryption to something secure (I chose WPA2-PSK) and enter the key (network password) under Key. Obviously, if you have a good knowledge of wireless security, you can choose other encryption and authentication options; I am just providing a minimal set of directions here...

When all of this is done, click Save at the bottom of the dialog. The dialog will close, and you will be back to the Wireless Overview. Click Save & Apply on the bottom of the screen and wait for the changes to be made (there will be a pop-up dialog informing you of what's going on). Next, take a look at the button to the left of Edit. Most likely, it says Enable. If so, click it to enable wireless networking. If it says Disable, leave it be; you probably clicked on it before, so wireless is enabled now.

At this point, your device should be fully operational. Just in case, reboot the device to verify that everything that should start at boot actually starts.

If you get stuck, post a note here and tell us what you have done so far, what you expected to happen next, and what actually happened.

4 Likes

"HiLink HLK-7621A evaluation board" is officially supported, images are available through the firmware-selector.
Both 22.03.3 and Snapshot images are working, but there are some minor issues though. I see no issues with USB so far, I'm running my slightly customized build.
I plugged in an adapter I had in the drawer and it was properly detected:

root@OpenWrt:/# lsusb
Bus 001 Device 002: ID 148f:5370 Ralink 802.11 n WLAN
1 Like

If you're using the USB Wi-Fi adapter please refer to How to figure out which driver should I use with my usb wifi adapter - #3 by AndrewZ

You will need to install usbutils package in order to see the information about your USB devices with lsusb
Alternatively you can run cat /sys/kernel/debug/usb/devices and see if there is a mention of your wi-fi device. You will also see there if any driver is loaded for your device.

lspci -nn command show nothing

/etc/config/wireless

config wifi-device 'wl0'
	option type 'mac80211'

config wifi-iface 'wifinet0'
	option device 'wl0'
	option mode 'ap'
	option ssid 'My-WiFi-Home'
	option network 'lan'
	option encryption 'psk2'
	option key 'WiFipassword'

logs:

Sat Mar 11 08:03:05 2023 daemon.notice netifd: wl0 (4629): Could not find PHY for device 'wl0'
Sat Mar 11 08:03:05 2023 daemon.notice netifd: Wireless device 'wl0' set retry=0
Sat Mar 11 08:03:05 2023 daemon.crit netifd: Wireless device 'wl0' setup failed, retry=0
Sat Mar 11 08:03:05 2023 daemon.notice netifd: wl0 (4638): WARNING: Variable 'data' does not exist or is not an array/object
Sat Mar 11 08:03:05 2023 daemon.notice netifd: wl0 (4638): Bug: PHY is undefined for device 'wl0'
Sat Mar 11 08:03:05 2023 daemon.notice netifd: Wireless device 'wl0' is now down
Sat Mar 11 08:04:23 2023 daemon.notice netifd: wl0 (4745): Could not find PHY for device 'wl0'
Sat Mar 11 08:04:23 2023 daemon.notice netifd: Wireless device 'wl0' set retry=0
Sat Mar 11 08:04:23 2023 daemon.crit netifd: Wireless device 'wl0' setup failed, retry=0
Sat Mar 11 08:04:23 2023 daemon.notice netifd: wl0 (4755): WARNING: Variable 'data' does not exist or is not an array/object
Sat Mar 11 08:04:23 2023 daemon.notice netifd: wl0 (4755): Bug: PHY is undefined for device 'wl0'
Sat Mar 11 08:04:23 2023 daemon.notice netifd: Wireless device 'wl0' is now down

after attaching simple usb and after running cat /sys/kernel/debug/usb/devices
got this

T:  Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  2 Spd=480  MxCh= 0
D:  Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=13fe ProdID=6300 Rev= 1.00
S:  Manufacturer=        
S:  Product=USB DISK 3.0
S:  SerialNumber=071318C55E74C758
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=498mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none)
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

and on lsusb got this after attaching usb

Bus 001 Device 002: ID 13fe:6300          USB DISK 3.0
Bus 002 Device 001: ID 1d6b:0003 Linux 5.10.146 xhci-hcd xHCI Host Controller
Bus 001 Device 001: ID 1d6b:0002 Linux 5.10.146 xhci-hcd xHCI Host Controller

before usb:

Bus 002 Device 001: ID 1d6b:0003 Linux 5.10.146 xhci-hcd xHCI Host Controller
Bus 001 Device 001: ID 1d6b:0002 Linux 5.10.146 xhci-hcd xHCI Host Controller

does it mean USB PORTS are not working?

I see no problems with USB.
It is still unclear what kind of Wi-Fi adapter you're trying to use. It would be helpful if you could post a picture and/or model information of your adapter.

No, they are working. Otherwise you wouldn't see the memory stick listed.
But when the Wi-Fi USB sticks aren't recognized, they're either defective or maybe they draw to much power from the usb port, which then perhaps will be disabled. Could please post the last lines of
dmesg
after you insert one of those sticks?

i think this device doesn't have support for wifi.
by the way thanks everyone :+1:

if usb port are working then how can i mount usb?

There is no such limitation on the device side.
Disconnect your adapter. Run logread -f and plug your adapter in. Post the log generated.