21

I recently ported Luci to an OpenWrt router. I was just exploring the thing. I disabled the DHCP server on LAN and enabled as DHCP client. I saved and applied the configuration to the router. Now after a restart I am not able to connect the router webpage.

How do I enable the DHCP server again or can anyone let me know how to reset this OpenWrt router to default settings?

I tried in the serial port console. but I can't see any IP address for any interfaces. Before It was 192.168.1.1.

Please suggest...

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
Surjya Narayana Padhi
  • 7,263
  • 23
  • 73
  • 121

5 Answers5

38

Those who are facing this problem: Don't panic.

Short answer:

Restart your router, and this problem will be fixed. (But if your restart button is not working, you need to do a nine-step process to do the restart. Hitting the restart button is just one of them.)

Long answer: Let's learn how to restart the router.

  1. Set your PC's IP address: 192.168.1.2 and subnetmask 255.255.255.0 and gateway 192.168.1.1
  2. Power off the router
  3. Disconnect the WAN cable
  4. Only connect your PC Ethernet cable to ETH0
  5. Power on the router
  6. Wait for the router to start the boot sequence (SYS LED starts blinking)
  7. When the SYS LED is blinking, hit the restart button (the SYS LED will be blinking at a faster rate means your router is in failsafe mode). (You have to hit the button before the router boots.)
  8. telnet 192.168.1.1
  9. Run these commands:

    mount_root ## this remounts your partitions from read-only to read/write mode
    
    firstboot  ## This will reset your router after reboot
    
    reboot -f ## And force reboot
    
  10. Log in the web interface using web browser.

link to see the official failsafe mode.

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
Nafis Ahmad
  • 2,383
  • 1
  • 24
  • 13
  • 2
    It's not `fastboot` it's `firstboot`. See other answers. – JavaRocky May 04 '15 at 12:57
  • After step 9, I cannot login after reboot, both in the static ip mode or dhcp mode. I wonder what I was doing wrong. – moonkey Aug 22 '15 at 04:53
  • after reboot, the device is no longer in failSafe Mode. May be that's why you can not login. (may be) You have to change your PC Static ip address to dhcp. Then reboot your PC or disconnect / reconnect Ethernet Connection. Usually, by then it should work. – Nafis Ahmad Oct 27 '15 at 04:47
  • Funny, I was looking for how to do this, i found my own answer. ... :D – Nafis Ahmad Dec 05 '15 at 02:15
  • Good answer. Bad thing that I think my router is bricked and I'll have to open it. – Mauker Dec 08 '15 at 18:41
  • 1
    With Chaos Calmer, i was able to tftp it back to new image, in the failsafe: atftp -p -l openwrt-15.05-ar71xx-generic-wnr612v2-squashfs-factory.img 192.168.1.1 – vrdhn Dec 27 '15 at 17:49
  • 1
    @kasper-souren Thank you for the edit. Now the answer looks right and nice. – Nafis Ahmad Sep 28 '16 at 23:35
9

Some addition to previous comments: 'firstboot' won't be available until you run 'mount_root' command.

So here is a full recap of what needs to be done. All manipulations I did on Windows 8.1.

  • Enter Failsafe mode (hold the reset button on boot for a few seconds)
  • Assign a static IP address, 192.168.1.2, to your PC. Example of a command: netsh interface ip set address name="Ethernet" static 192.168.1.2 255.255.255.0 192.168.1.1
  • Connect to address 192.168.1.1 from telnet (I use PuTTY) and login/password isn't required).
  • Run 'mount_root' (otherwise 'firstboot' won't be available).
  • Run 'firstboot' to reset.
  • Run 'reboot -f' to reboot.

Now you can enter to the router console from a browser. Also don't forget to return your PC from static to DHCP address assignment. Example: netsh interface ip set address name="Ethernet" source=dhcp

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
yuliskov
  • 1,212
  • 13
  • 15
  • After 'firstboo' and 'reboot -f', I cannot login after reboot, both in the static ip mode or dhcp mode. I wonder what I was doing wrong. – moonkey Aug 22 '15 at 04:54
7

You can run this command for making a factory reset:

killall dropbear uhttpd; sleep 1; mtd -r erase rootfs_data
Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
developer
  • 4,188
  • 5
  • 33
  • 50
  • I hit a bug where [firstboot hangs](https://dev.openwrt.org/ticket/20168) and I didn't need to kill anything but `mtd -r erase rootfs_data` worked. Thanks – KCD Jul 31 '16 at 00:06
4

If you installed the SquashFS image you can run the script firstboot. That will return OpenWrt to the defaults of when you flashed the router.

With your serial access just run firstboot and then power cycle the device.

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
Saverio Proto
  • 837
  • 6
  • 18
3

If you enabled it as a DHCP client then your router should get an IP address from a DHCP server. If you connect your router on a net with a DHCP server you should reach your router's administrator page on the IP address assigned by the DHCP.

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
Pat
  • 2,625
  • 15
  • 26
  • if you have a restart button on the router, you might not need to Setup a DHCP server. I tried it did not work. please read my answer. – Nafis Ahmad Dec 05 '14 at 22:06
  • 1
    5 years on from your answer, this is what i did. i mean, i worked it out for myself, but you can still have the up vote anyway because i'm happy it works :D – rbennell Jan 30 '18 at 16:38