Put shared hard drive to idle on OpenWrt

 There are two applications to put a hard drive to idle in Openwrt:

  1. HDD Idle (hd-idle): This option did not work for me.
  2. HD Parm (hdparm): This option worked perfectly, here is the command to use:

hdparm -S 24 /dev/sdb1

The previous command stops the disk from spinning after 2 minutes. 

Install Simple Adblock on OpenWrt

OpenWrt 15.05.1 Chaos Calmer Instructions:


opkg update; opkg install ca-certificates wget libopenssl;

echo -e -n 'untrusted comment: OpenWrt usign key of Stan Grishin\nRWR//HUXxMwMVnx7fESOKO7x8XoW4/dRidJPjt91hAAU2L59mYvHy0Fa\n' > /tmp/stangri-repo.pub && opkg-key add /tmp/stangri-repo.pub
! grep -q 'stangri_repo' /etc/opkg/customfeeds.conf && echo 'src/gz stangri_repo https://raw.githubusercontent.com/stangri/openwrt-repo/master' >> /etc/opkg/customfeeds.conf

opkg update


opkg --force-overwrite install coreutils-sort

opkg install simple-adblock luci-app-simple-adblock luci-lib-jsonc







Stangri's Github Simple Adblock Readme

Two or more document roots using uhttpd


Edit (nano recommended) /etc/config/uhttpd file for uhttpd to support multiple document roots.

# Server configuration
   config uhttpd main
   list listen_http 0.0.0.0:80
   option home /www
   option cgi_prefix /cgi-bin

config uhttpd secondary
   list listen_http 0.0.0.0:81
   option home /www/fusionpbx
   option cgi_prefix /cgi-bin

# ...


Add this line in the appropiate option to serve php:

option 'index_page' 'index.php'

also, root_doc on php.ini should be empty

Remove failed prerm script on OpenWrt

To uninstall lighttpd package intro the following command in ssh:

opkg remove lighttpd --force-remove

Put router with OpenWrt into repeater mode

Go to address 192.168.1.1 in your browser to access OpenWrt configuration:

To scan for wifi signals and join the signal to repeat: OpenWrt menu -> Network -> Wifi -> on "Wireless Overview" clic "Scan" button.

A list of available networks will appear, then clic "Join Network" button on the right of the selected network.

"Join Network: Settings" screen will appear, then intro the wifi password of the network to join in "WPA passphrase" then clic "submit" button.


Clic "Save & Apply".

... Wait for the changes to be applied.

On the Wireless Overview screen clic the "Add" button to create a wifi network where all your devices will connect.

On the Wireless Network: Master "wifi_name" (radio0.network2) scroll down to Interface Configuration and enter the data of your new network:

Under General Setup tab:
ESSID: "wifi name"
Mode: Access Point
Network: tick "lan"

Under Wireless Security tab:
Choose Encryption: WPA2-PSK
Key: "your_wifi_password"

Clic "Save & Apply" button

------

To put a static route to access the router in the OpenWrt main menu select "Network" -> "Interfaces"

On network "LAN" clic "Edit" button

Put IPv4 Address: 192.168.0.1

Clic "Save & Apply" button

Press the restart button of your router.

How to revert back an OpenWrt router configuration

Your router has been misconfigured and you can't access your router anymore. To fix it you need to do a restart process. Here are the steps:

Put your router in failsafe mode:


Set your PC ip: 192.168.1.2 and subnetmask 255.255.255.0 and gateway 192.168.1.1 (computer may need to restart)

Power off the router

Disconnect the WAN cable

Only connect your PC Ethernet cable to ETH0

Power On the router

Wait for the router to start the boot sequence (SYS LED starts blinking)
When SYS LED is blinking, hit restart button (SYS LED will be blink in a faster rate means your router is in failsafe Mode) (you have to hit the button before the router boots)(you may need to press the restart button twice to enter failsafe mode)


-----

'Factory reset' to default config


Enter console commands:
(You may need to activate Telnet on Windows)

# telnet 192.168.1.1

(wait for the OpenWrt BusyBox front page indicating "FAILSAFE MODE active)

 === IMPORTANT ============================
  Use 'passwd' to set your login password
  this will disable telnet and enable SSH
 ------------------------------------------


BusyBox v1.19.4 (2013-03-14 11:28:31 UTC) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 ATTITUDE ADJUSTMENT (12.09, r36088)
 -----------------------------------------------------
  * 1/4 oz Vodka      Pour all ingredients into mixing
  * 1/4 oz Gin        tin with ice, strain into glass.
  * 1/4 oz Amaretto
  * 1/4 oz Triple sec
  * 1/4 oz Peach schnapps
  * 1/4 oz Sour mix
  * 1 splash Cranberry juice
 -----------------------------------------------------
root@(none):/#





# mount_root (to mount the JFFS2 partition)

# firstboot

# rm -r /overlay/*  (or /overlay/upper/* on some routers)

# mtd -r erase rootfs_data (this will reboot the device as part of the process)



-----------

Once your router restart go to address: 192.168.1.1 in your browser


That's it.