This step by step procedure was written specially for those who's just started command line jorney.

  1. Have WL-500g flashed with 1.9.2.7-CR4 firmware.
  2. Run telnet command and connect to the WL-500g.
    > open my.router
  3. Type in regular login and password.
  4. Check if directory /usr/local/sbin exists.
    $ ls -l /usr/local/
  5. If not create such directory.
    $ mkdir -p /usr/local/sbin
  6. Create the post-boot, post-firewall or any other post processing scripts.
    $ touch /usr/local/sbin/post-boot
    $ touch /usr/local/sbin/post-firewall
  7. Make them executable.
    $ chmod +x /usr/local/sbin/post-boot
    $ chmod +x /usr/local/sbin/post-firewall
  8. Open one of above scripts with vi editor.
    $ vi /usr/local/sbin/post-boot
  9. In vi press i to enter simple insert mode. Type or paste in lines with commands you want (see examples).
    Verify first line is like:
    #!/bin/sh
  10. Press ESC to leave insert mode of vi editor. Type :wq! and press ENTER to write changes and quit vi.
  11. Print file contents to screen and double check all lines.
    $ cat /usr/local/sbin/post-boot
    $ cat /usr/local/sbin/post-firewall
  12. Launch vi editor again if corrections should be made.
  13. Store changes in flash memory.
    $ flashfs save
    $ flashfs commit
    $ flashfs enable
  14. Reboot your router.
    Important! This does not mean reset of any type.
  15. During next firmware upgrade all changes will be disabled but not erased. Activate them with command
    $ flashfs enable

Post-boot script example:

#!/bin/sh
route add -host [ftp.server.IP.address] gw [ISP.gateway.IP.address] dev eth1
iptables -t nat -A POSTROUTING -o eth1 -s 192.168.1.0/24 -j MASQUERADE

Post-firewall script example:

#!/bin/sh
iptables -t nat -A POSTROUTING -o eth1 -s 192.168.1.0/24 -j MASQUERADE