How to factory reset OpenWrt with Wi-Fi enabled on first boot

Suddenly my router's LAN ports are not working. (wan port & wifi is working)
I want to see if factory resetting the router fixes the issue.
But we all know after resetting openwrt, Wifi will be disabled as default. (Don't know why) :man_shrugging:
If Wifi and Lan ports are unusable the router is somewhat dead :slightly_smiling_face:

Is there any way to factory reset the router and while booting WiFi will stay enabled.

Did this happen after a change that you made to the configuration, or do you suspect a hardware failure?

This is for security. A router in the factory reset state is not secured (no password)... enabling wifi (even with a default password) would mean that a device left in the default state and the entire network behind it would be vulnerable to attack by anyone in wifi range.

By requiring the user to enable wifi, it means that they must actively go into the router's settings where they are encouraged to set a password for the router itself as well as one for the wifi network.

Yes and no. if you end up in this situation, many routers do have serial ports (inside) that can allow you to connect and configure/recover.

Not with an official OpenWrt image. You can, however, build your own image with default files that include your settings including having the wifi enabled.
See the documentation about the image builder and the "files" section for details

You can also use the Online Image Builder which has the ability to customize with a script to run on first boot. You can set your configuration there (using UCI commands or shell scripts).

With either of these options, you will need to flash a new image to your device. It is important that you are absolutely positive about the changes to the default configuration that you include in a custom image -- if you mess this up, it can become much harder to recover the device.

1 Like

night before I just changed the Wifi mode AC to N, nothing else. I don't think it is related to the the lan port issue :thinking:
And I am also a newbie openwrt user :sweat_smile: :sweat:

can i flash Image file via WiFi?

Yes. You can flash via wifi (some people will advise against it, but it should be fine as long as you verify that the checksum matches after transferring it to your router).

That said, have a contingency plan if your router doesn't operate as you expect after this process -- if you believe your LAN ports may have a hardware failure and if the wifi settings don't work, you will likely have bigger issues... so having a spare router or some other plan is wise.

Thank you Very much for your kind advice :star_struck:
I have a backup router :grin:
I just bought this cheap MI router to get familiar with openwrt :sweat_smile:
I will try to Flash an image file that i believe has WiFi enabled as default

if you manage to build a firmware place in :

\package\base-files\files\etc\uci-defaults a file with name : 99_enable_wifi with this content:


#!/bin/sh
uci set wireless.@wifi-device[0].disabled=0
uci commit wireless
exit 0

just a Note
there are routers out there the DIR-878 comes to mind
where they have a radio on/off button/switch
on that model you just press it & the radios turn on

This is tangential, in this case, because the OP has a specific situation with a router that appears to have non-functional LAN ports -- resetting the router to defaults may brick the unit if there is a hardware failure on the LAN ports. The question really revolves around this specific consideration, and not so much about finding devices that have the ability to turn on the radio via a switch.

But that said...

I have not to used this specific model, but are you sure that a default installation of OpenWrt will turn on the radios based on that button? Typically, OpenWrt defaults to the radio off until it is explicitly enabled by the user. And often the buttons are not mapped to actions such as radio on/off by default.

ok i just checked to see if my memory was working
and yes with a default 21.02.1 fresh factory install "Defaulted"
the radios are off as you would expect
but it has a wifi button that is mapped to "linux,code = <KEY_RFKILL>;"

it would be better to call this RF Toggle
as when you press it if the radios are off like in default they will turn on

how every if you needed such a thing to a device it would be an easy mod to a DTS file
to change the mapping on say the WPS button
from linux,code = <KEY_WPS_BUTTON>;
to linux,code = <KEY_RFKILL>;

but in this case it may not be any use for Thisisakib
but an rs232 console should be able to turn on wifi even if the lan ports are dead
but you need to have the adapter pinds and what ever setup for that device

I have flashed a custom(wifi enabled) openwrt and after flashing lan ports are again working :star_struck: :grinning: :partying_face:

thanks everyone for helping :hugs:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.